Repository navigation
Add missing 2FA executions to built-in flows of upgraded realms - #55433
Open
jwklijnsma wants to merge 1 commit into
Open
jwklijnsma wants to merge 1 commit into
jwklijnsma wants to merge 1 commit into
Conversation
Realms created before 26.3 have a conditional 2FA sub-flow in the built-in browser and first broker login flows without the conditional credential, WebAuthn and recovery codes executions. As built-in flows are read-only, administrators could not add them. The 27.0.0 migration now adds the missing executions as DISABLED so the authentication behavior does not change but administrators can enable them. Closes keycloak#45351 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZrFpkHAAfJC4ohrYgzQGm Signed-off-by: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The filter removes all executions returned by deepFindAuthenticationExecutions, preventing both built-in flows from receiving the missing 2FA executions during upgrade or import.
1 open issue
What changed in this PR
This PR addresses #45351 by extending the 27.0.0 realm migration to add missing two-factor authentication executions to older built-in browser and first broker login flows, intended to preserve existing authentication behavior.
Changes:
- Adds migration logic for missing credential-condition, WebAuthn, and recovery-code executions as disabled.
- Adds assertions for execution presence, disabled status, and unchanged OTP requirements.
- Documents the migration and how administrators can enable the new options.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/migration/AbstractMigrationTest.java |
Adds migration assertions for both built-in flows. |
server-spi-private/src/main/java/org/keycloak/models/utils/DefaultAuthenticationFlows.java |
Adds a helper to populate missing disabled 2FA executions. |
model/storage-private/src/main/java/org/keycloak/migration/migrators/MigrateTo27_0_0.java |
Calls the helper during realm upgrades and imports. |
docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc |
Explains the flow updates and enablement steps. |
Review effort: Balanced
Comment on lines
+774
to
+775
| .filter(AuthenticationExecutionModel::isAuthenticatorFlow) | ||
| .map(e -> realm.getAuthenticationFlowById(e.getFlowId())) |
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.
Realms created before 26.3 have a conditional 2FA sub-flow in the built-in browser and first broker login flows without the conditional credential, WebAuthn and recovery codes executions. As built-in flows are read-only, administrators could not add them. The 27.0.0 migration now adds the missing executions as DISABLED so the authentication behavior does not change but administrators can enable them.
Closes #45351