org.springframework.security.saml2.provider.service.authentication.DefaultSaml2AuthenticatedPrincipal fails to return more than one "attribute" #11042
Labels
in: saml2
An issue in SAML2 modules
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Describe the bug
**Affects: 5.5.2 \spring-security-saml2-service-provider
I have been testing a SAML SSO integration using Spring framework.
I attach a saml token produced by Keycloak IDP in that testing.
The code to setup the "authorities" transmitted in the token use the getAttribute method with a str parm of "Role".
While there are several attributes with that attribute name, the method consistently produces only a single one of these in the return List object. It always is the last one physically in the list. I've tested this carefully, and the behavior is consistent.
Same behavior with the getAttributes method (no parameter) although the returned object is a Map in this case.
All these attributes should be returned from both methods.
To Reproduce
Requires an SSO login with authorizations delivered with the token
Expected behavior
All attributes, or attributes of the request name, should be returned in the List object
Sample
The attached file shows the multiple attributes the token carries. The two methods mentioned above both return ONLY the physically last on in the array.
A link to a GitHub repository with a minimal, reproducible sample.
Reports that include a sample will take priority over reports that do not.
At times, we may require a sample, so it is good to try and include a sample up front.
SAMLTOKEN.xml.txt
The text was updated successfully, but these errors were encountered: