Encoded password does not look like BCrypt

后端 未结 17 1866
心在旅途
心在旅途 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条回答
  •  一整个雨季
    2020-12-05 13:50

    Update field client_secret in table oauth_client_details with BCryptPasswordEncoder in case you migrate spring boot from 1x to 2x. To encode secret use:

        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String password = "12345678";
        String encodedPassword = passwordEncoder.encode(password);
    
        System.out.println();
        System.out.println("Password is         : " + password);
        System.out.println("Encoded Password is : " + encodedPassword);
        System.out.println();
    
        boolean isPasswordMatch = passwordEncoder.matches(password, encodedPassword);
        System.out.println("Password : " + password + "   isPasswordMatch    : " + isPasswordMatch);
    

提交回复
热议问题