SSL的spring security oauth问题

时间:2017-11-06 21:31:19

标签: spring spring-boot spring-security spring-security-oauth2

一切都适用于HTTP,但是当我使用证书启用SSL时,我无法访问带有错误的令牌:

{
error: "invalid_client",
error_description: "Bad client credentials"
}

我的AuthServer配置类:

@Configuration
@EnableAuthorizationServer
@Service
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {

    @Autowired
    private CustomAuthenticationManager authenticationManager; //my custom auth manager

    @Autowired
    private CommonConfig configService; //my config service 

    @Autowired
    private MemoryTokenStore tokenStore;

    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
        security.tokenKeyAccess("permitAll()").checkTokenAccess("isAuthenticated()")
                .allowFormAuthenticationForClients();
    }

    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients.inMemory().withClient(configService.getClientId()).authorizedGrantTypes("password")
                .scopes(configService.getAuthScopes()).resourceIds("oauth2-resource")
                .accessTokenValiditySeconds(configService.getTokenValiditySc()).secret(configService.getClientSecret());
    }

    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        endpoints.authenticationManager(authenticationManager).allowedTokenEndpointRequestMethods(HttpMethod.GET)
                .tokenStore(tokenStore);
    }

}

spring boot v1.5.8。我该如何解决?

0 个答案:

没有答案