嗨,我正在尝试手动拆分身份验证,并希望为spring安全保存用户详细信息。但是我在下面的代码中得到了这个异常
Authentication auth = authManager.authenticate(authReq);例外情况-
org.springframework.security.authentication.BadCredentialsException: Bad credentials服务方法-
@Service
public class UserServiceImpl implements UserService {
@Autowired
private AuthenticationManager authManager;
@Override
public Boolean authenticateUser(User user) {
String password = Utils.generateOtp(6).toString();
user.setPassword(password);
UsernamePasswordAuthenticationToken authReq = new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword());
Authentication auth = authManager.authenticate(authReq);
SecurityContextHolder.getContext().setAuthentication(auth);
return true;
}}
发布于 2018-05-31 18:41:06
您是如何对用户进行身份验证的,比如针对jdbc或内存?请检查是否有加密的密码?
https://stackoverflow.com/questions/50622222
复制相似问题