Skip to content

[2.0] fix(saml): accept repeated attribute names, so Keycloak users with roles can sign in (backport #38080) - #38447

Merged
manerow merged 3 commits into
2.0from
backport/2.0/saml-repeated-attribute-names
Nov 23, 2026
Merged

manerow merged 3 commits into
2.0from
backport/2.0/saml-repeated-attribute-names

Conversation

@manerow

@manerow manerow commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #38080 to the 2.0 branch.

On 2.0, a SAML sign-in fails when the identity provider sends the same attribute name more than once. Keycloak's default role mapper does this: it sends one Role attribute per role, and every Keycloak user has default roles. java-saml rejects the response with "Found an Attribute element with duplicated Name", so the user cannot sign in. I hit this on 2.0 while testing the SAML fixes for #37056 end to end against Keycloak (the login ended in a 500 at the ACS).

The fix is the one from #38080: SamlSettingsHolder.buildSettings turns on java-saml's allow_duplicated_attribute_name, so repeated attributes are merged into one attribute with several values.

The only adaptation for 2.0 is in the test: it uses 2.0's samlConfig(String) helper, and the import list follows 2.0's version of SamlSettingsHolderTest.

Release note (2.0.10): SAML sign-in no longer fails when the identity provider sends the same attribute more than once, as Keycloak does for users with roles. The values are merged into one attribute.

Type of change:

  • Bug fix

High-level design:

Cherry-pick of #38080. One setting plus a unit test.

Tests:

Unit tests

  • SamlSettingsHolderTest.buildSettingsMergesRepeatedAttributeNames: a response with two Role attributes is read as one attribute with both values.
  • Ran SamlSettingsHolderTest on this branch: 10 tests pass. With the setting removed, the new test fails, so it covers the bug.

Integration, ingestion and Playwright tests: not applicable. Manual: the failure was reproduced on 2.0 against Keycloak 26.3 with a user that has roles. The fixed login was not re-run against Keycloak on 2.0; the unit test above covers it, and main has had the same setting since #38080.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have added a test that covers the exact scenario we are fixing.

RetriggerView in GreptileConfidence Score: 4/5

The remaining shared-string requirement in SamlSettingsHolderTest.java should be satisfied before merging.

Findings

  1. P2 Test addresses repeat ▶

Summary

Allows SAML responses to repeat an attribute name, so Keycloak role attributes can be read together.

  • SAML sign-in now combines repeated attribute names into one attribute.

Reviews (3) · Last reviewed commit: "Use a text block and named URLs in the r..." · Reviewed by Greptile

@manerow
manerow requested a review from a team as a code owner November 23, 2026 08:52
@manerow
manerow requested review from mohityadav766 and removed request for a team November 23, 2026 08:52
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

Comment on lines +219 to +220
SamlSettingsHolder.buildSettings(samlConfig("https://idp.example.com/sso")),
"https://sp.example.com/api/v1/saml/acs",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test addresses repeat

The new test repeats the SSO and ACS URLs already used in this file. The repository guide requires a named constant when a string appears more than once. Extract shared constants before merging so these addresses stay consistent when changed.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: the URLs are now the IDP_SSO_URL and SP_ACS_URL constants, used by this test and the helper. Two older tests keep the literal because PR #38441 rewrites them, and changing them here would conflict.

@gitar-bot

gitar-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Enabling duplicate SAML attribute merging changes sign-in claim handling; unexpected repeated role values could affect which users authenticate or receive roles.

Backport of the SAML fix that enables java-saml's allow_duplicated_attribute_name in SamlSettingsHolder.buildSettings, so repeated attribute names such as Keycloak Role attributes are merged into one attribute and users with roles can sign in. Adds a unit test covering the repeated-attribute case. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow merged commit b3662a3 into 2.0 Nov 23, 2026
73 of 76 checks passed
@manerow
manerow deleted the backport/2.0/saml-repeated-attribute-names branch November 23, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants