代码调整
This commit is contained in:
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
public class UserDetailsServiceImpl implements CustomUserDetailsService {
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
@@ -44,4 +44,18 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
return businessUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByPhone(String phone) throws UsernameNotFoundException {
|
||||
String clientId = RequestUtil.getOAuth2ClientId();
|
||||
BusinessUser businessUser = new BusinessUser(phone, null, null);
|
||||
businessUser.setClientId(clientId);
|
||||
HttpResult<UserDTO> result = userFeignClient.getUserByPhone(phone);
|
||||
LogUtil.njcnDebug(log, "用户验证码认证时,用户名:{}获取用户信息:{}", phone, result.toString());
|
||||
//成功获取用户信息
|
||||
UserDTO userDTO = result.getData();
|
||||
BeanUtil.copyProperties(userDTO,businessUser,true);
|
||||
businessUser.setAuthorities(AuthorityUtils.commaSeparatedStringToAuthorityList(String.join(",", userDTO.getRoleName())));
|
||||
return businessUser;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user