Repository navigation
Enforce client minimum ACR for logins not started at the authorization endpoint - #55461
gaoyikeshuer wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Shared ACR/LoA resolution changes require end-to-end validation across reset, action-token, and SSO flows, since integration tests were not run and regression coverage is limited.
No open issues 🎉
What changed in this PR
Addresses #55382 by applying client-configured authentication levels when a login session has no recorded requirement, preventing second-factor checks from being skipped when login starts from the forgot-password page.
Changes:
- Fall back to the client’s minimum and default ACR settings when the requested authentication level is absent.
- Add a regression test confirming that returning to login from a direct password-reset link requires OTP for a client with minimum ACR 2.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/forms/LevelOfAssuranceEssentialAcrTest.java |
Adds an OTP user, minimum-ACR client, and regression test for the password-reset entry point. |
services/src/main/java/org/keycloak/authentication/authenticators/util/AcrStore.java |
Derives the requested authentication level from client configuration when the session note is missing. |
Review effort: Balanced
… page. Closes keycloak#55382 Signed-off-by: Yike Gao <yikegao8@gmail.com>
1b43647 to
3d6ad14
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The shared ACR security fix requires browser/runtime validation across reset-credentials, action-token continuations, and SSO, but the added regression covers only the reset-link-to-login path.
No open issues 🎉
Review effort: Balanced
rmartinc
left a comment
There was a problem hiding this comment.
Thanks @gaoyikeshuer! LGTM! Just a nit-pick in the test to finish the login and assert the acr is 2.
| driver.driver().navigate().to(realm.getBaseUrl() + "/login-actions/reset-credentials?client_id=" + minimumAcrOauth.getClientId() | ||
| + "&redirect_uri=" + minimumAcrOauth.getRedirectUri()); | ||
| resetPasswordPage.assertCurrent(); | ||
| resetPasswordPage.backToLogin(); | ||
| loginUsernamePage.fillLoginWithUsernameOnly(otpUser.getUsername()); | ||
| loginUsernamePage.submit(); | ||
| passwordPage.fillPassword(otpUser.getPassword()); | ||
| passwordPage.submit(); | ||
|
|
||
| loginTotpPage.assertCurrent(); |
There was a problem hiding this comment.
I prefer to complete the login and assert the ACR too. Something like the following:
driver.open(realm.getBaseUrl() + "/login-actions/reset-credentials?client_id=" + minimumAcrOauth.getClientId()
+ "&redirect_uri=" + minimumAcrOauth.getRedirectUri());
resetPasswordPage.assertCurrent();
resetPasswordPage.backToLogin();
loginUsernamePage.assertCurrent();
loginUsernamePage.fillLoginWithUsernameOnly(otpUser.getUsername());
loginUsernamePage.submit();
passwordPage.assertCurrent();
passwordPage.fillPassword(otpUser.getPassword());
passwordPage.submit();
loginTotpPage.assertCurrent();
loginTotpPage.login(new TimeBasedOTP().generateTOTP("totpsecret"));
driver.waiting().waitForOAuthCallback();
EventAssertion.expectLoginSuccess(events.poll());
AccessTokenResponse tokenResponse = minimumAcrOauth.doAccessTokenRequest(minimumAcrOauth.parseLoginResponse().getCode());
assertEquals("2", minimumAcrOauth.parseToken(tokenResponse.getAccessToken(), AccessToken.class).getAcr());Imports are missing.
after fix:
Screen.Recording.2026-11-23.at.14.30.59.mov
The client's minimum ACR was only checked when login started from the normal login page, so starting from the forgot password link skipped the second factor. now it is read from the client settings whenever it was not recorded.
Closes #55382