Spring Security OAuth 2.0 - client secret always required for authorization code grant

前端 未结 6 1174
陌清茗
陌清茗 2020-12-03 11:54

According to the spec, requests for a token using the authorization code grant are not required to be authenticated as long as the client_id is included in the

6条回答
  •  有刺的猬
    2020-12-03 12:20

    This worked for me

        @Override
        public void configure(AuthorizationServerSecurityConfigurer cfg) throws Exception {
            cfg
                .tokenKeyAccess("permitAll()")
                .checkTokenAccess("isAuthenticated()")
                .allowFormAuthenticationForClients()
                .passwordEncoder(clientPasswordEncoder());
        }
    
    
        @Bean("clientPasswordEncoder")
        PasswordEncoder clientPasswordEncoder() {
            return new BCryptPasswordEncoder(4);
        }
    

    Test 1:

    Test 2:

提交回复
热议问题