项目用登录输入正确的用户名和密码为什么还是告知,用户名和密码是不正确?
有这几种情况
第一种是不是开启缓存,数据库中存储的是加密后的密码
第二种,查看源代码,这句是关键,presentedPassword是明文密码,userDetails.getPassword()是加密后的密码,进行比较
this.passwordEncoder.matches(presentedPassword, userDetails.getPassword())
protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
if (authentication.getCredentials() == null) {
this.logger.debug("Authentication failed: no credentials provided");
throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credenti