Encoded password does not look like BCrypt

后端 未结 17 1915
心在旅途
心在旅途 2020-12-05 13:20

I am using Spring Boot, Spring Security, OAuth2 and JWT to authenticate my application, but I keep getting this nasty error and I don\'t have any idea what is wrong. My

17条回答
  •  猫巷女王i
    2020-12-05 13:42

    I struggled with this error while doing a Spring Security Course.

    My problem was that even though in the AuthenticationManager I was using the encoding, e.g:

        @Autowired
        public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception {
            auth.userDetailsService(userDetailsService)
                    .passwordEncoder(passwordEncoder());
        }
    

    The Problem was that I was not Encoding the Password when I was saving the Users!! Example:

    final Principal entity = new Principal(loginName, passwordEncoder.encode(pass), roles);
    

提交回复
热议问题