Skip to content

Pass and use rememberMe option in passkeys authenticators#47940

Merged
pedroigor merged 3 commits into
keycloak:mainfrom
rmartinc:issue-45104
Apr 15, 2026
Merged

Pass and use rememberMe option in passkeys authenticators#47940
pedroigor merged 3 commits into
keycloak:mainfrom
rmartinc:issue-45104

Conversation

@rmartinc

@rmartinc rmartinc commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Closes #45104

The PR adds the rememberMe for passkeys in the forms that already show the remember me checkbox (username&password and username alone). With this the only one that maybe is missing is the standalone webauthn authenticator when used for passwordless. But this one never showed the checkbox so I would go initially with this. It adds the rememberMe to the webauthn form if it was present in the original form.

The PR also upgrades the two tests that were modified. They are very different so I decided to send 3 commits (fix, tests mv, tests modifications). You can review the changes for the tests in the last commit. If we want to maintain the history for the tests file, please do not squash it when merging.

Don't know if we should add some doc changes. Let me know what you think.

Closes keycloak#45104

Signed-off-by: rmartinc <rmartinc@redhat.com>
Closes keycloak#45104

Signed-off-by: rmartinc <rmartinc@redhat.com>
@rmartinc

Copy link
Copy Markdown
Contributor Author

Rebased and conflicts resolved. There seems to be a lot of changes in the TS... 😄

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR propagates the rememberMe option through passkeys/WebAuthn authentication so “Remember me” behaves consistently when users authenticate via passkeys from forms that display the checkbox.

Changes:

  • Add client-side forwarding of rememberMe from the visible checkbox to the WebAuthn (webauth) form submission.
  • Centralize server-side remember-me handling in AuthenticatorUtils and apply it to the WebAuthn passwordless authenticator.
  • Migrate/update passkeys tests to the newer tests/webauthn module and extend coverage for remember-me with passkeys.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
themes/src/main/resources/theme/base/login/resources/js/webauthnAuthenticate.js Adds forwarding of rememberMe via a hidden input on WebAuthn submit.
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/webauthn/passwordless/PasskeysUsernamePasswordFormTest.java Removes old Arquillian-based test (migrated to new suite).
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/webauthn/passwordless/PasskeysUsernameFormTest.java Removes old Arquillian-based test (migrated to new suite).
tests/webauthn/src/test/java/org/keycloak/tests/webauthn/passwordless/PasskeysUsernamePasswordFormTest.java New/updated tests including remember-me assertions for passkeys.
tests/webauthn/src/test/java/org/keycloak/tests/webauthn/passwordless/PasskeysUsernameFormTest.java New/updated tests including remember-me at username/password steps.
tests/webauthn/src/test/java/org/keycloak/tests/webauthn/AbstractWebAuthnVirtualTest.java Refactors realm setup for new tests, adds flows/users, adjusts required actions.
test-framework/ui/src/main/java/org/keycloak/testframework/ui/page/LoginUsernamePage.java Adds username error/autocomplete accessors and remember-me helpers for username-only page.
test-framework/ui/src/main/java/org/keycloak/testframework/ui/page/LoginPage.java Adds password-only fill helper and exposes password-field error separately.
test-framework/ui/src/main/java/org/keycloak/testframework/ui/page/AbstractLoginPage.java Adds accessors for shared info/error message banners.
test-framework/core/src/main/java/org/keycloak/testframework/realm/RealmConfigBuilder.java Adds builder method for passwordless passkeys-enabled policy.
test-framework/core/src/main/java/org/keycloak/testframework/events/EventAssertion.java Exposes asserted event via getEvent() for follow-up operations in tests.
services/src/main/java/org/keycloak/authentication/authenticators/util/AuthenticatorUtils.java Centralizes remember-me form processing logic.
services/src/main/java/org/keycloak/authentication/authenticators/browser/WebAuthnPasswordlessAuthenticator.java Processes rememberMe when present in WebAuthn passwordless submissions.
services/src/main/java/org/keycloak/authentication/authenticators/browser/AbstractUsernameFormAuthenticator.java Switches to the shared remember-me processor and adjusts brute-force helper reference.

mabartos
mabartos previously approved these changes Apr 15, 2026

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc LGTM, nice work!

I've just added some nitpick + consideration.

loginPage.submit();
loginPage.assertCurrent();
MatcherAssert.assertThat(loginPage.getUsernameAutocomplete(), Matchers.is("username webauthn"));
MatcherAssert.assertThat(loginPage.getUsernameInputError(), Matchers.is("Invalid username or email."));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out-of-scope: Does it mean that we can do the username enumeration with the UsernameForm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if you set up the username (alone) authenticator you are allowing user enumeration instead of the username/password. The same that happens in google and other sites that uses the separated username form.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc It's quite unfortunate, but not sure if we could provide a better approach here and propagate the invalid user to credential authenticators/validators... it might be quite difficult and fragile... Do we know if we at least inform the administrators about the possible enumeration?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but in general if you use the separate username form it is more or less expected that user enumeration is present. If you avoid that (for example allowing any username at that page and giving the error later in the password), the user experience is bad (because a user that types the username wrong becomes crazy to detect that the error was in the previous page). But this is unrelated to the present issue.

Comment thread test-framework/ui/src/main/java/org/keycloak/testframework/ui/page/LoginPage.java Outdated
Closes keycloak#45104

Signed-off-by: rmartinc <rmartinc@redhat.com>

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@rmartinc

Copy link
Copy Markdown
Contributor Author

@keycloak/core-clients-maintainers @keycloak/core-iam-maintainers Do you want to review this one?

@pedroigor

Copy link
Copy Markdown
Contributor

It should not break orgs because we recently added a test for remember me when using org flow.

@pedroigor pedroigor merged commit 95cdee9 into keycloak:main Apr 15, 2026
92 of 94 checks passed
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.

Add native "Remember Me" support to WebAuthn/Passkey Authentication Flows

4 participants