Skip to content

Fall back to the default IdP for an unknown kc_idp_hint - #55208

Open
srivathsav01 wants to merge 1 commit into
keycloak:mainfrom
srivathsav01:idp-redirector-fallback
Open

srivathsav01 wants to merge 1 commit into
keycloak:mainfrom
srivathsav01:idp-redirector-fallback

Conversation

@srivathsav01

@srivathsav01 srivathsav01 commented Nov 15, 2026 •

Copy link
Copy Markdown

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_hint skips the redirector and shows the login form.

The fallback is resolved in IdentityProviderAuthenticator.authenticate() rather than in redirect(), as the issue notes suggest. OrganizationAuthenticator extends this class and calls redirect(context, alias, loginHint) directly, so a fallback there would change organization login. OrganizationAuthenticatorFactory overrides getConfigProperties(), 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 a ProviderConfigProperty, 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.

@srivathsav01
srivathsav01 requested a review from a team as a code owner November 15, 2026 07:31
Copilot AI balanced review requested due to automatic review settings November 15, 2026 07:31

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.

🟡 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
srivathsav01 force-pushed the idp-redirector-fallback branch from d943188 to 9cc7434 Compare November 15, 2026 07:50
Copilot AI balanced review requested due to automatic review settings November 15, 2026 07:50

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.

🟢 Approval recommended

There are no active review issues blocking the opt-in identity-provider hint fallback change.

1 open issue

Review effort: Balanced

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.

Identity Provider Redirector: fall back to the default provider when kc_idp_hint names an unknown IdP

2 participants