1
votes

I have been trying to configure the oauth2 provider plugin in my grails application, but I am facing certain issues, and other than the plugin documentation, I didn't find any other sources that could help.

I have followed all the stepd mentioned in the doc, and made changes in Config.groovy

Now hitting localhost:8080/oauth/authorize?response_type=code&client_id=my-client&scope=read should redirect me to login page which it does. After login however, I want authorization window to appear where user accepts or rejects granting authorization. I am however just getting a JSON result:

{"url":"http://localhost:8080/oauth/authorize?response_type=code&client_id=my-client&scope=read","success":true}

Why am I not getting an authorization prompt instead? What am I missing here?

1

1 Answers

0
votes

Okay. So I have made some changes: 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'

]

Just proper ordering of filters seems to be solving the problem. With this configuration I am able to generate the access_token.