Skip to content

Allow duplicates in the TokenManager map as before#51029

Merged
ahus1 merged 1 commit into
keycloak:mainfrom
rmartinc:issue-50882
Jul 20, 2026
Merged

Allow duplicates in the TokenManager map as before#51029
ahus1 merged 1 commit into
keycloak:mainfrom
rmartinc:issue-50882

Conversation

@rmartinc

Copy link
Copy Markdown
Contributor

Closes #50882

When changing the set of the client scope names to a map I didn't consider there could be duplicated scopes. Organization is special and can be returned twice. Test added.

Closes keycloak#50882

Signed-off-by: rmartinc <rmartinc@redhat.com>
@rmartinc
rmartinc requested a review from a team as a code owner July 20, 2026 10:12
Copilot AI review requested due to automatic review settings July 20, 2026 10:12

Copilot AI left a comment

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.

Pull request overview

Prevents a 500 error when the default organization scope is also explicitly requested.

Changes:

  • Retains the first client scope when duplicate names occur.
  • Adds regression coverage for default and explicitly requested organization scopes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
services/.../TokenManager.java Handles duplicate scope names during map collection.
tests/.../OrganizationAuthenticationTest.java Verifies successful login with duplicate organization scope sources.

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.BrowserFlowTest#testUserWithOneAdditionalFactorOtpSuccess

Keycloak CI - Base IT (5)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.forms.MultipleTabsLoginTest#multipleTabsParallelLoginTestWithAuthSessionExpiredAndRegisterClick

Keycloak CI - Forms IT (firefox)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rmartinc LGTM, thanks!

@ahus1
ahus1 merged commit 5730efb into keycloak:main Jul 20, 2026
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

500 when client requests organization scope with it already set to Default

4 participants