この方法には習慣AuthenticationProvider
がありauthenticate
ます。
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
> Check username, password, throw exceptions where needed
return new CustomAuthenticationToken(username, grantedAuthorities);
}
そしてトークン:
public class CustomAuthenticationToken extends UsernamePasswordAuthenticationToken
{
public CustomAuthenticationToken(ICurrentUserContext currentUser, List<GrantedAuthority> authorities) {
super(currentUser.getUsername(), currentUser.getPassword(), authorities);
}
}
Chrome、Firefoxでログインしても問題ありません。
IE 8/9では、非常に奇妙な問題が発生します。メソッドを1回だけ呼び出す場合もあり、authenticate
ログインしてすべてが期待どおりに機能します。ただし、ときどきauthenticate
2回呼び出され、ログインに失敗します。
誰か手がかりはありますか?
私はTomcatでそれをテストしました。