Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sabeer02
Copy link

Root Cause

Users with valid credentials were being locked out when hitting session limits because the system treated session denials as authentication failures, incrementing the brute force counter.

Solution

Changed DENY_NEW_SESSION handling from context.failure() to context.forceChallenge()
Updated error event from GENERIC_AUTHENTICATION_ERROR to ACCESS_DENIED
Updated tests to match new error behavior

Impact

Session limit denials no longer increment brute force counters, preventing legitimate users from being locked out due to session limits.

Fixes: #44474

- Changed from context.failure() to context.forceChallenge() in DENY_NEW_SESSION case
- Updated event error from GENERIC_AUTHENTICATION_ERROR to ACCESS_DENIED
- Updated test to match new ACCESS_DENIED error for session limit denial
- Prevents users with valid credentials from being locked out due to session limits
- Session limit denial is now treated as a policy challenge, not authentication failure

Fixes: keycloak#44474
Signed-off-by: Sabeer Muhaiadeen N <[email protected]>
Copy link

@keycloak-github-bot keycloak-github-bot bot left a comment

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

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.account.WebAuthnSigningInTest#multipleSecurityKeys

Keycloak CI - WebAuthn IT

java.lang.AssertionError: 

Expected: is <4>
     but: was <0>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
...

Report flaky test

@sabeer02
Copy link
Author

Flaky test reported: #45546

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.

Keycloak Maximum Concurrent Session Limit is incorrectly registered as a login failure, triggering Keycloak's Brute Force protection

1 participant