Encoded password does not look like BCrypt

后端 未结 17 1914
心在旅途
心在旅途 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:43

    When oauth2 dependecncies moved to cloud, I started facing this issue. Earlier it was part of security framework :

    
        org.springframework.security.oauth
        spring-security-oauth2
    
    

    Now it is part of cloud framework :

    
        org.springframework.cloud
        spring-cloud-starter-oauth2
    
    

    So if you are using cloud dependency (Finchley.RELEASE) then you may need to encode the secret like below :

    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients
                .inMemory()
                .withClient("clientapp")
                .authorizedGrantTypes("password","refresh_token")
                .authorities("USER")
                .scopes("read", "write")
                .resourceIds(RESOURCE_ID)
                .secret(passwordEncoder.encode("SECRET"));
    }
    

提交回复
热议问题