-
Notifications
You must be signed in to change notification settings - Fork 24
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
Plugin not allowing for me to grab user information. The user is always shown as an anonymous user #77
Comments
Another thing I noticed was I will get a log that says I am authenticated even when I am not. I tested using an incognito tab. You can see "Authenticated: true;" towards the end of the line. |
I don't really see a opensaml related error, you can turn that package off (org.opensaml.saml2) in the logback settings. Your problem is very strange. It looks like the SAML login worked successfully but you are still not logged in. This either means the error is not being shown in the logs (are you sure you enabled the package 'org.grails.plugin.springsecurity.saml' and set it to debug level in your logback settings?) or there is some strange redirection happening or wrong URL that prevents you from logging in via the /saml/SSO Filter which should execute the SpringSamlUserDetailsService. Here is what I expect to see:
|
Thank for the response. Is there anything else we should be creating on our end? We have a secure controller as well which I will link down below.
` Here is my logback.groovy
` and my application.groovy `
` Secure controller:
` Our index.gsp is the default index.gsp that gets generated when you run
Which triggers our startSAML function inside of our secure controller. We have tried logging in using both that link and the link to the login controller. Neither seem to give us any success. I did add in the SamlSecurityServices.groovy and SpringSamlUserDetails.groovy into our services folder to add in some extra print statements, but I have not been able to decipher what is going on. I definitely do not see anything close to the logs you mentioned. If you have any other possible pointers please reach out and thanks a ton for taking the time to respond. We have been trying everything to get this to work. |
The SAMLEntryPoint Filter uses springsecurity.auth.loginFormUrl=/login/auth. If you go to that path it should initiate SSO Login. resources.groovy
Add this to your logback.groovy
If you don't see any logs and never enter SpringSamlUserDetails then I don't know. You would have to use a debugger (in Eclipse or IntelliJ) and step through SamlEntryPoint/SAMLProcessingFilter (set a breakpoint in doFilter) until you find your problem. Also, it shouldn't make a huge difference but try out version 4.0.3. It has a minor fix if you want to configure autoCreate.active=false. |
We were able to get past many of our issues thanks to your help. One last question - currently we have our user attribute mappings set to grab an email but it seems to not be added to our SamlUserDetails. I am under the impression that setting the grails.plugin.springsecurity.samluserAttributeMappings should allow us to grab an email from the response that we get from our idp. Is there anything else we have to do to get this added to our userDetails? Please let me know, thanks @valentingoebel
Here is what our saml response looks like
` |
You have to add the SAML attributes to your User.groovy class (specified in grails.plugin.springsecurity.userLookup.userDomainClassName = 'saml_grails_4.User).
The plugin will fill those attributes automatically. You can then access it in any controller via principal.emailAddress. |
we have tried defining that @valentingoebel but it seems to always break on insert. One thing we noticed is the samlAttributes always come back as null. Could it be that our samluserAttributeMapping is configured incorrectly? `
` |
also our user.groovy @valentingoebel
} ` |
It took me a long time to notice but did you misspell the configuration setting?
Your saml response looks fine so the IDP is doing everything correctly. The User class is also correct. |
Hello. I am trying to get the user information to print but I am not sure if the users are just being logged in as an anonymous user. In the logs we see that authentication is successful, but cannot get the user information to print. Here is my secureController:
| Grails Version: 4.0.3
| JVM Version: 1.8.0_292
`
`
And here are some logs:
`
`
I cannot figure out if the user is actually being authenticated or if I am just getting an anonymous login
The text was updated successfully, but these errors were encountered: