春のセキュリティ - ログイン显示[悪いの資格情報]

問題の説明

若しくは

org.springframework.security.authentication.BadCredentialsException: Bad credentials。

 

分析

A、ユーザ名やパスワードエラー

デフォルトでは、関係なく、ユーザ名のが存在しない、またはパスワードが間違っている、春のセキュリティが報告されます悪い信用証明書の例外情報、および非現実的な特定のエラーを。

出典:

org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider

try { 
    user = retrieveUser(username, (UsernamePasswordAuthenticationToken) authentication); 
} catch (UsernameNotFoundException notFound) { 
    logger.debug("User '" + username + "' not found"); 
 
    if (hideUserNotFoundExceptions) { 
        throw new BadCredentialsException(messages.getMessage( 
                "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials")); 
    } else { 
        throw notFound; 
    } 
}

第二に、アクセスが十分ではありません

第三に、暗号化されたパスワードの問題

パスワードの暗号化問題は、次のことがあります

1.いいえパスワードのAPIの前に公式の特定の理由を参照してください、そして、{NOOP}を追加する必要があり、パスワードを暗号化

User user = new User(userInfo.getUsername(),"{noop}"+ userInfo.getPassword(),getAuthority(userInfo.getRoles()));

2.設定ファイルではなく、彼らのサービスへの応用に暗号化パスワードを設定します

暗号化アルゴリズムにコントラスト、暗号化アルゴリズム、および春のセキュリティ設定でデータベース3への利用者が同じであるときに使用されます。

ソリューション

分析では、問題を参照してください。

参考記事

https://blog.csdn.net/qq_37252930/article/details/95723940

https://blog.csdn.net/qq_41950229/article/details/98479327

https://www.cnblogs.com/jifeng/archive/2012/06/09/2542928.html

https://blog.csdn.net/weixin_44580977/article/details/98491875

リリース1423元の記事 ウォンの賞賛260 ビュー420 000 +

おすすめ

転載: blog.csdn.net/weixin_43272781/article/details/104720600