修改新验证条件下客户端无法登录bug,并去掉明文密码验证的登录代码
| | |
| | | throw new BadCredentialsException("密码为空"); |
| | | } |
| | | String password= authentication.getCredentials().toString(); |
| | | password = password.replace("\n",""); |
| | | password = Base64.decodeToString(password); |
| | | if (!new BCryptPasswordEncoder().matches(password, userDetails.getPassword())) { |
| | | boolean isPass = new BCryptPasswordEncoder().matches(password, userDetails.getPassword()); |
| | | if (!isPass) { |
| | | throw new BadCredentialsException("密码错误"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | protected void configure(AuthenticationManagerBuilder auth) throws Exception { |
| | | auth.authenticationProvider(new DaoAuthenticationProvider()); |
| | | auth.userDetailsService(userDetailsService).passwordEncoder(new BCryptPasswordEncoder()); |
| | | //auth.userDetailsService(userDetailsService).passwordEncoder(new BCryptPasswordEncoder()); |
| | | } |
| | | |
| | | @Override |