Spring security Spring安全性:在自定义身份验证中使用BCryptPasswordEncoder提供
我对密码进行了如下哈希处理:Spring security Spring安全性:在自定义身份验证中使用BCryptPasswordEncoder提供,spring-security,Spring Security,我对密码进行了如下哈希处理: BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); String hashedPassword = passwordEncoder.encode(password); 现在,我将如何使用自定义spring身份验证来验证登录用户名和密码 public Authentication authenticate(Authentication authentication)
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
String hashedPassword = passwordEncoder.encode(password);
现在,我将如何使用自定义spring身份验证来验证登录用户名和密码
public Authentication authenticate(Authentication authentication) throws AuthenticationException{
}
在本文中,我如何使用BCryptPasswordEncoder匹配登录密码是否正确您的身份验证方法的核心可能如下所示: String rawPassword=Stringauthentication.getCredentials; 如果passwordEncoder.matchesrawPassword,hashedPassword{ 抛出新的BadCredentialsException错误的密码; }
我选择了用户服务