-
Notifications
You must be signed in to change notification settings - Fork 6k
SAML attributes not parsed correctly with prefixed XML elements #8864
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
Comments
@JoakimLofgren thanks for the report. Would you be able to add a unit test that fails in the way that you describe? You could use a static response payload, for example. |
Is there any existing tests I could tweak to do that? I'll try and take a stab at it tomorrow. |
You can tweak I haven't played around much with configuring the namespace with OpenSAML, so I don't have specific advice for you along those lines; however, let me know if you run into trouble, and I'm happy to help. |
After debugging it appears that the issue is not that elements are prefixed. The culprit seems to be this: https://github.com/spring-projects/spring-security/blob/master/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/authentication/OpenSamlAuthenticationProvider.java#L428 Doing @jzheaux Do you have any idea what the purpose of that serialize is? |
The serialize is so that applications can customize how to handle Were you able to develop a unit test? Specifically, I'm curious why the registry returned a marshaller instead of |
Not yet. Might take a stab at it today if I have the energy/time. |
@jzheaux Reproduced the issue in a unit test: JoakimLofgren@4f7499b |
I was able to reproduce using the test you created, thank you. I'm thinking that #8010 will be a better vehicle for allowing an application to customize the way that an |
Great. Will it be included in the 5.4 release? |
Yes, it will. It should be in the |
Oh, I missed your message. I verified it in 5.4.0. It works. Thanks. |
Describe the bug
When grabbing the email attribute (
urn:oid:0.9.2342.19200300.100.1.3
) from theSimpleSaml2AuthenticatedPrincipal
/DefaultSaml2AuthenticatedPrincipal
the output is XML and not the expected email.Until #8861 is merged, the following workaround is used to access the attributes:
The value returned is:
This seems to be due to prefixed XML elements, as the issue does not occur when non-prefixed XML elements that specify the
xmlns
attribute are used instead.Google SAML produces XML with prefixed XML elements, e.g.:
And e.g. https://github.com/amdonov/lite-idp produces non-prefixed XML elements:
This was tested with the versions 5.4.0-M2 and 5.4.0-SNAPSHOT (as of today).
To Reproduce
urn:oid:0.9.2342.19200300.100.1.3
) fromSimpleSaml2AuthenticatedPrincipal
/DefaultSaml2AuthenticatedPrincipal
.Expected behavior
The email is returned.
The text was updated successfully, but these errors were encountered: