Repository navigation
fix(saml): accept repeated attribute names, so Keycloak users with roles can sign in - #38080
Conversation
…les can sign in Keycloak's default role mapper sends one Attribute element per role, all named "Role", and every Keycloak user has default roles. java-saml rejects a repeated attribute name unless allowRepeatAttributeName is on, so SAML sign-in and Test Login failed with "Found an Attribute element with duplicated Name". Turn it on in the shared settings builder; java-saml then merges the values into one multi-valued attribute. Co-Authored-By: Claude Opus 5.5 <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved 🔴 High riskEnabling repeated SAML attributes changes the authentication boundary; unexpected merged IdP role claims could affect account access. Sets VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
…ith roles can sign in (backport #38080) (#38447) * fix(saml): accept repeated attribute names, so Keycloak users with roles can sign in * Use a text block and named URLs in the repeated SAML attribute test --------- Co-authored-by: Chirag Madlani <[email protected]>
Describe your changes:
Problem (2.1 SSO release testing, Phase 2 → SAML (Keycloak) 1, High): with Keycloak's default realm settings, a normal user can't sign in through SAML.
POST /api/v1/saml/acs→ 400{"error":"SAML response could not be read"}, and the server logs "Found an Attribute element with duplicated Name". Most real Keycloak SAML users are affected.Cause: Keycloak's default role-list mapper sends one
RoleAttribute element per role, and every Keycloak user hasdefault-roles-<realm>(offline_access, uma_authorization…). java-saml rejects a repeated attribute name unlessallowRepeatAttributeNameis enabled, and OpenMetadata never enabled it.CI misses this because the CI realm's imported user has no roles, so Keycloak sends no
Roleattributes.Reproduced on
main: I ran the repo'sdocker/local-sso/keycloak-samland a SAML Test Login.Roleattributes and fails at "Token validated" withFound an Attribute element with duplicated Name.Fix: set
onelogin.saml2.security.allow_duplicated_attribute_name=trueinSamlSettingsHolder.buildSettings, the one builder used by live sign-in, Test Login andSamlValidator. java-saml then adds a repeated attribute's values to the existing list, soRolebecomes one attribute with every role.Type of change:
Tests:
SamlSettingsHolderTest.buildSettingsMergesRepeatedAttributeNamesparses a response with twoRoleattributes through the built settings. It fails onmainwithValidationError: Found an Attribute element with duplicated Nameand passes with the fix (Role=[offline_access, uma_authorization]).SamlAuthServletHandlerTest,SamlSettingsHolderTest,MockSamlIdpTest,SamlAssertionConsumerServletTest,TestLoginSamlHandlerTest,SsoRedirectBoundaryTest,SamlValidatorTest): 123/123 pass.Needs a 2.1 backport.
🤖 Generated with Claude Code


Confidence Score: 5/5
This PR appears safe to merge.Summary
Fixes SAML sign-in for identity providers that send repeated attribute names, including Keycloak users with multiple roles.
No actionable issues found. Tests were not run during this review.
Reviews (1) · Last reviewed commit: "fix(saml): accept repeated attribute nam..." · Reviewed by Greptile