Repository navigation
Fall back to the default IdP for an unknown kc_idp_hint - #55208
Open
srivathsav01 wants to merge 1 commit into
Open
srivathsav01 wants to merge 1 commit into
srivathsav01 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests omit an enabled hint that differs from the default when fallback is enabled, leaving provider-selection behavior vulnerable to an undetected regression.
1 open issue
What changed in this PR
Adds an opt-in Identity Provider Redirector fallback for unknown or disabled kc_idp_hint values, addressing #53119 while preserving existing behavior by default.
Changes:
- Resolves fallback in the browser authenticator without changing organization redirects.
- Exposes a disabled-by-default configuration option and documents its behavior.
- Adds integration tests for unknown, disabled, and empty hints.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/broker/oidc/KcOidcBrokerIdpHintFallbackTest.java |
Tests fallback and redirect-skipping behavior. |
services/src/main/java/org/keycloak/authentication/authenticators/browser/IdentityProviderAuthenticatorFactory.java |
Exposes the opt-in fallback setting. |
services/src/main/java/org/keycloak/authentication/authenticators/browser/IdentityProviderAuthenticator.java |
Selects the default provider when fallback applies. |
docs/documentation/server_admin/topics/identity-broker/suggested.adoc |
Links client hint documentation to fallback guidance. |
docs/documentation/server_admin/topics/identity-broker/default-provider.adoc |
Explains how to enable fallback. |
Review effort: Balanced
Closes keycloak#53119 Signed-off-by: Srivathsav01 <srivathsav.m.2001@gmail.com>
srivathsav01
force-pushed
the
idp-redirector-fallback
branch
from
November 15, 2026 07:50
d943188 to
9cc7434
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53119
The fallback is opt-in and off by default, so existing realms keep today's behavior where an unknown or disabled
kc_idp_hintskips the redirector and shows the login form.The fallback is resolved in
IdentityProviderAuthenticator.authenticate()rather than inredirect(), as the issue notes suggest.OrganizationAuthenticatorextends this class and callsredirect(context, alias, loginHint)directly, so a fallback there would change organization login.OrganizationAuthenticatorFactoryoverridesgetConfigProperties(), so the new option does not show up on the Organization step either.The fallback applies only when the hinted provider is missing or disabled and a default provider is configured that differs from the hint. An empty
kc_idp_hint=still skips the redirector, a valid hint still wins, and a missing default provider still falls through to the login form. The option is aProviderConfigProperty, so the Admin Console renders it without frontend changes, and no migration is needed because an absent value means disabled.Tests are in the new test framework (
KcOidcBrokerIdpHintFallbackTest), since the legacy testsuite does not accept new files. They cover an unknown hint and a disabled hinted provider with the fallback on, an enabled hint winning over a different default with the fallback on, an unknown hint with it off, and an empty hint. The fallback tests fail without the change.