Support custom required actions in add-required-action workflow step - #51556
Open
abhi763153 wants to merge 1 commit into
Open
Support custom required actions in add-required-action workflow step#51556abhi763153 wants to merge 1 commit into
abhi763153 wants to merge 1 commit into
Conversation
Look up required actions using the provider alias instead of the UserModel.RequiredAction enum. This allows workflows to add custom required actions while preserving support for built-in required actions. Closes keycloak#51415 Signed-off-by: Abhishek Kamti <abhishekkamti723@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Extends workflow required-action resolution to support custom provider aliases.
Changes:
- Resolves configured actions through realm providers.
- Rejects missing or disabled providers.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } catch (IllegalArgumentException e) { | ||
| log.warnv("Invalid required action {0} configured in {1}", stepModel.getConfig().getFirst(REQUIRED_ACTION_KEY), | ||
| AddRequiredActionStepProviderFactory.ID); | ||
| RequiredActionProviderModel provider = realm.getRequiredActionProviderByAlias(configuredAction); |
Comment on lines
+35
to
+48
| RequiredActionProviderModel provider = realm.getRequiredActionProviderByAlias(configuredAction); | ||
|
|
||
| if (provider == null) { | ||
| log.warnv("Required action {0} is not configured in realm {1}", | ||
| configuredAction, realm.getName()); | ||
| return; | ||
| } | ||
|
|
||
| if (!provider.isEnabled()) { | ||
| log.warnv("Required action {0} is not enabled in realm {1}", | ||
| configuredAction, realm.getName()); | ||
| return; | ||
| } | ||
| user.addRequiredAction(configuredAction); |
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.
Summary
The
add-required-actionworkflow step currently resolves required actions using theUserModel.RequiredActionenum. This prevents custom required actions from being configured because they are not part of the enum.This change resolves the configured required action by looking up the corresponding
RequiredActionProviderModelusing its alias. If the provider exists and is enabled, its alias is added to the user.This preserves support for built-in required actions while also allowing custom required actions.
Testing
webauthn-register-passwordless) and configured it in a workflow.VERIFY_EMAILcontinue to work.Closes #51415