Skip to content

Add workflow event providers for user lockout events by brute force protection - #51466

Open
robson90 wants to merge 1 commit into
keycloak:mainfrom
robson90:is-50452-add-workflow-events-permanent-and-temporary-lockout
Open

Add workflow event providers for user lockout events by brute force protection#51466
robson90 wants to merge 1 commit into
keycloak:mainfrom
robson90:is-50452-add-workflow-events-permanent-and-temporary-lockout

Conversation

@robson90

@robson90 robson90 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Closes: #50452

Ive consolidated the tests into one, as they are almost the same. To that I added the missing RealmBuilder functions.

CC: @ahus1

@robson90
robson90 requested a review from a team as a code owner August 5, 2026 18:11
Copilot AI balanced review requested due to automatic review settings August 5, 2026 18:11

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

Adds workflow triggers for temporary and permanent brute-force user lockouts, addressing issue #50452.

Changes:

  • Adds and registers two lockout workflow event providers.
  • Adds integration coverage for both lockout modes.
  • Extends RealmBuilder with brute-force configuration methods.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/base/.../UserDisabledByLockoutWorkflowTest.java Tests both lockout triggers.
test-framework/.../RealmBuilder.java Adds brute-force builder methods.
model/jpa/.../WorkflowEventProviderFactory Registers both providers.
model/jpa/.../UserDisabledByTemporaryLockoutWorkflowEventProvider.java Matches temporary-lockout events.
model/jpa/.../UserDisabledByTemporaryLockoutWorkflowEventFactory.java Defines the temporary trigger.
model/jpa/.../UserDisabledByPermanentLockoutWorkflowEventProvider.java Matches permanent-lockout events.
model/jpa/.../UserDisabledByPermanentLockoutWorkflowEventFactory.java Defines the permanent trigger.

Comment on lines +10 to +11
org.keycloak.models.workflow.events.UserDisabledByTemporaryLockoutWorkflowEventFactory
org.keycloak.models.workflow.events.UserDisabledByPermanentLockoutWorkflowEventFactory
Copilot AI review requested due to automatic review settings August 5, 2026 19:16
@robson90
robson90 force-pushed the is-50452-add-workflow-events-permanent-and-temporary-lockout branch from 98fe1d3 to b93aa12 Compare August 5, 2026 19:16

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

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

Suppressed comments (1)

docs/documentation/server_admin/topics/workflows/listening-workflow-events.adoc:58

  • The permanent-lockout description contradicts itself by saying the user is also disabled “temporarily.” Remove that word so administrators can distinguish this trigger from the temporary-lockout event above.
| `user-disabled-by-permanent-lockout` | User was permanently disabled temporarily by brute force protection. | None

@ahus1

ahus1 commented Aug 6, 2026

Copy link
Copy Markdown
Member

@robson90 - thanks for pinging me. While this looks good overall, it might need some more justification in the parent issue to add this. I already added a comment, but maybe you can make this stronger.

There is one nitbit that GitHub copilot found in the docs: The "User was permanently disabled temporarily by brute force protection." contains an extra "temporarily" that should be removed.

Maybe someone from the core-iam team like @sguilhen can have a look.

Copilot AI review requested due to automatic review settings August 6, 2026 07:12
@robson90
robson90 force-pushed the is-50452-add-workflow-events-permanent-and-temporary-lockout branch from b93aa12 to cfc7639 Compare August 6, 2026 07: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

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

@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

@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.webauthn.registration.WebAuthnOtherSettingsTest#apiSecurityErrorMessage

Keycloak CI - WebAuthn IT

org.openqa.selenium.WebDriverException: 
unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}
  (Session info: chrome=150.0.7871.128)
Build info: version: '4.28.1', revision: '73f5ad48a2'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.17.0-1020-azure', java.version: '25.0.3'
...

Report flaky test

@sguilhen

sguilhen commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

IMO this is a worthy addition. We do have a mechanism to send emails based on certain events, but Workflows can enable other strategies well beyond that. For example, one could set a required action in response to such an event in addition to sending the email. Or notify the admins in addition to the user. The scenario depends on the requirements of each deployment, but in my mind it does make sense to support these events.

Signed-off-by: Robin Meese <39960884+robson90@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 7, 2026 12:58
@ahus1
ahus1 force-pushed the is-50452-add-workflow-events-permanent-and-temporary-lockout branch from cfc7639 to 72d362b Compare August 7, 2026 12:58
@ahus1

ahus1 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Rebased to re-run the failed flaky build. Might have been caused by #47482

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

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

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.

[Workflow] Add support for "User disabled" events

4 participants