grails oauth2提供程序插件无法按预期工作

时间:2016-01-11 11:26:53

标签: grails oauth spring-security-oauth2

我一直在尝试在我的grails应用程序中配置oauth2提供程序插件,但我遇到了某些问题,除了插件文档之外,我还没有找到任何其他可能有用的资源。

我已按照文档中提到的所有步骤进行操作,并在Config.groovy中进行了更改

现在点击localhost:8080 / oauth / authorize?response_type = code& client_id = my-client& scope = read应该将我重定向到登录页面。 登录后,我希望授权窗口出现在用户接受或拒绝授权的位置。然而,我只是得到了一个JSON结果:

{" URL":" http://localhost:8080/oauth/authorize?response_type=code&client_id=my-client&scope=read""成功":真}

为什么我没有收到授权提示?我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

好。所以我做了一些改变: grails.plugin.springsecurity.filterChain.filterNames = [ 'cookieSessionFilter', 'securityContextPersistenceFilter','statelessSecurityContextPersistenceFilter','logoutFilter', 'authenticationProcessingFilter','exceptionTranslationFilter','oauth2ProviderFilter','clientCredentialsTokenEndpointFilter', 'oauth2BasicAuthenticationFilter','securityContextHolderAwareRequestFilter', 'rememberMeAuthenticationFilter','anonymousAuthenticationFilter','oauth2ExceptionTranslationFilter','filterInvocationInterceptor' ]

grails.plugin.springsecurity.filterChain.chainMap = [

'/ oauth / token':'JOINED_FILTERS,-cookieSessionFilter,-oauth2ProviderFilter,-securityContextPersistenceFilter,-logoutFilter,-authenticationProcessingFilter,-rememberMeAuthenticationFilter,-exceptionTranslationFilter',

'/ securedOAuth2Resources / **':'JOINED_FILTERS,-cookieSessionFilter,-securityContextPersistenceFilter,-logoutFilter,-authenticationProcessingFilter,-rememberMeAuthenticationFilter,-oauth2BasicAuthenticationFilter,-exceptionTranslationFilter',

'/ **':'JOINED_FILTERS,-statelessSecurityContextPersistenceFilter,-oauth2ProviderFilter,-clientCredentialsTokenEndpointFilter,-oauth2BasicAuthenticationFilter,-oauth2ExceptionTranslationFilter'

正确排序过滤器似乎正在解决问题。 使用此配置,我可以生成access_token。