Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 on token refresh when using LDAP #396

Closed
davew945 opened this issue Apr 2, 2019 · 3 comments
Closed

403 on token refresh when using LDAP #396

davew945 opened this issue Apr 2, 2019 · 3 comments

Comments

@davew945
Copy link

davew945 commented Apr 2, 2019

I am getting 403 when I try to refresh a token when I am using LDAP.

using:
compile 'org.grails.plugins:spring-security-core:3.1.2'
compile 'org.grails.plugins:spring-security-rest:2.0.0.M2'
compile 'org.grails.plugins:spring-security-ldap:3.0.2'

grails.plugin.springsecurity.rest.RestOauthController.line.127

            def user = tokenStorageService.loadUserByToken(refreshToken)
            User principal = user ? user as User : null

the cast throws
org.codehaus.groovy.runtime.typehandling.GroovyCastException : Cannot cast object
with class 'org.springframework.security.ldap.userdetails.Person'
to class 'org.springframework.security.core.userdetails.User'

Thank you.

@davew945
Copy link
Author

davew945 commented Apr 2, 2019

Here's a quick hack that might fix it.
Now to figure out how to get this fix installed so I can test and update for my users.

            User principal
            if (user && user.username && user.authorities) {
                principal = new User(user.username, '', user.authorities)
            } else {
                principal = user ? user as User : null
            }

@dbaylerg
Copy link

dbaylerg commented May 17, 2019

I have same issue.

using:
compile "org.grails.plugins:spring-security-rest:2.0.0.RC1"
compile 'org.grails.plugins:spring-security-ldap:3.0.2'

@dbaylerg
Copy link

I actually think this is an issue with the Grails ldap plugin. I've opened up this issue.
grails-plugins/grails-spring-security-ldap#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants