feat:
This commit is contained in:
parent
11bec69f6b
commit
287ac0be85
|
@ -24,7 +24,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||
if (user == null) {
|
||||
throw new UsernameNotFoundException("用户不存在");
|
||||
}
|
||||
return convertToUserDetails(user);
|
||||
return convertToUserDetailsWithoutPassword(user);
|
||||
}
|
||||
|
||||
public UserDetails loadUserById(Long userId) throws UsernameNotFoundException {
|
||||
|
@ -32,17 +32,19 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||
if (user == null) {
|
||||
throw new UsernameNotFoundException("用户不存在");
|
||||
}
|
||||
return convertToUserDetails(user);
|
||||
return convertToUserDetailsWithoutPassword(user);
|
||||
}
|
||||
|
||||
private UserDetails convertToUserDetails(UserDTO user) {
|
||||
|
||||
|
||||
private UserDetails convertToUserDetailsWithoutPassword(UserDTO user) {
|
||||
List<SimpleGrantedAuthority> authorities = new ArrayList<>();
|
||||
authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
|
||||
|
||||
return new CustomUserDetails(
|
||||
user.getId(),
|
||||
user.getUsername(),
|
||||
user.getPassword(),
|
||||
null,
|
||||
authorities,
|
||||
user.getStatus() == 1
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue