私は、WebアプリケーションでJWT Springセキュリティを使用してユーザーログインを認証しています。私のローカルマシン上のサーバーについては、私はtomcatを使用しています。 MySQLデータベース。だから私はサーバーを起動すると、いくつかのユーザーとログインし、私はデータベースに移動し、そのユーザーのパスワードを変更します。ログアウトするよりも新しいパスワードでログインしようとすると、パスワードが間違っているというエラーが表示されます。私は古いパスワードでログインして動作します。しかし、私がTomcatを再起動すると、新しいパスワードでのみログインすることができます。ここに私のCustomUserDetailServiceがあります。JWT Spring認証ログインユーザー
@Service("userDetailsService")
public class CustomUserDetailsService implements UserDetailsService {
@Autowired
private UserDAO userDao;
private User user = null;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
Object[] account = userDao.findByUserName(username);
boolean enabled = true;
boolean accountNonExpired = true;
boolean credentialsNonExpired = true;
boolean accountNonLocked = true;
this.user = new User(
(String) account[0],
(String) account[1],
enabled,
accountNonExpired,
credentialsNonExpired,
accountNonLocked,
getAuthorities((String)account[2])
);
return this.user;
}
public Collection<? extends GrantedAuthority> getAuthorities(String role) {
List<GrantedAuthority> authList = getGrantedAuthorities(getRoles(role));
return authList;
}
public List<String> getRoles(String role) {
List<String> roles = new ArrayList<String>();
roles.add(role);
return roles;
}
public static List<GrantedAuthority> getGrantedAuthorities(List<String> roles) {
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
for (String role : roles) {
authorities.add(new SimpleGrantedAuthority(role));
}
return authorities;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
申し訳ありませんが、わかりません。そのedmxファイルはどこにありますか?私はmysqlデータベースでjava spring jwtを使用しています。 – Hajrudin