bluesliverx / grails-spring-security-oauth2-provider

Grails Spring Security OAuth2 Provider Plugin
http://grails.org/plugin/spring-security-oauth2-provider
57 stars 58 forks source link

Approval store not working when in application.groovy #132

Closed magx2 closed 5 years ago

magx2 commented 7 years ago

I was following your docs about adding approval store from here https://bluesliverx.github.io/grails-spring-security-oauth2-provider/v3/manual/guide/single.html#approvalHandler

I have added (at the bottom) in application.groovy this line:

grails.plugin.springsecurity.oauthprovider.approval.auto = UserApproval.APPROVAL_STORE

The problem is that every time I start application in file SpringSecurityOauth2ProviderGrailsPlugin I always get UserApproval.EXPLICIT

    UserApprovalSupport support = conf.oauthProvider.approval.auto

    if(support == EXPLICIT) {
        springConfig.addAlias 'userApprovalHandler', 'defaultUserApprovalHandler'
    }
    else if(support == TOKEN_STORE) {
        springConfig.addAlias 'userApprovalHandler', 'tokenStoreUserApprovalHandler'
    }
    else if(support == APPROVAL_STORE) {
        springConfig.addAlias 'userApprovalHandler', 'approvalStoreUserApprovalHandler'
    }

The only thing that help was adding into application.yml this code:

grails:
    plugin:
        springsecurity:
          oauthProvider:
            approval:
              auto: APPROVAL_STORE

I don't know what's the difference between these 2 approaches. Do you have any ideas?

bobby-vandiver commented 7 years ago

Looks like you found an error in the documentation.

grails.plugin.springsecurity.oauthprovider.approval.auto = UserApproval.APPROVAL_STORE

Should be:

grails.plugin.springsecurity.oauthProvider.approval.auto = UserApproval.APPROVAL_STORE

Note the capital P in oauthProvider. This is why your application.yml worked.