Skip to content

feat(message-otp): opt-in auto-create of message-otp credential at login (v10) - #2918

Open
edulix wants to merge 2 commits into
release/10.0from
feat/meta-12616/release/10.0
Open

feat(message-otp): opt-in auto-create of message-otp credential at login (v10)#2918
edulix wants to merge 2 commits into
release/10.0from
feat/meta-12616/release/10.0

Conversation

@edulix

@edulix edulix commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Parent issue: https://github.com/sequentech/meta/issues/12616

Summary

Backports the opt-in Auto-create OTP credential option from main PR #2896 to release/10.0, together with its documentation.

Voters imported or edited through the admin portal get their email and mobile attributes set but never a stored message-otp credential, so configuredFor() returned false and the conditional OTP sub-flow was silently skipped. Where the OTP was the only remaining alternative, the flow instead failed with a generic invalid_user_credentials.

  • Adds the autoCreateCredentialAttribute config key in Utils.
  • Adds the boolean ProviderConfigProperty "Auto-create OTP credential" (default false) in MessageOTPAuthenticatorFactory.
  • Reworks MessageOTPAuthenticator.configuredFor(): for a non-deferred user without the stored credential, when the option is enabled and the user has a mobile number or an email address, the message-otp credential is created on the fly and the user reports as configured.
  • Deferred mode keeps reading the address from the authentication session and never requires nor stores a credential.
  • Adds the Docusaurus tutorial "Email OTP for Imported Voters" with screenshots.

Behaviour is unchanged while the property stays disabled, which is the default.

Stable Backport

Cherry-picks the two commits from #2896 onto release/10.0. Both applied without conflicts.

Validation on this branch

  • Keycloak: full 12-module Maven clean verify passed, including the 10 MessageOTPAuthenticatorTest cases; Spotless clean.
  • Docusaurus: production build generated static files successfully, the tutorial page and all five screenshots are emitted. The build reports only the pre-existing system_introduction link to the 9.4 release-notes page, which does not exist on this branch.

Verification on a dev election event

Exercised against an election event realm configured with a conditional message-otp-subflow (Condition - user configured + OTP - Message via Email/SMS, both Required) and an email-only voter, messageCourierAttribute=EMAIL:

  • Option off: isConfiguredFor() returns false, the OTP sub-flow is skipped and the voter signs in with the password alone. Credentials remain [password].
  • Option on: Auto-creating MessageOTPCredential for user with configured mobile/email, the OTP email is delivered, the code completes the login, and the stored credentials become [password, message-otp].
  • Deleting the credential and repeating the login reproduces the auto-creation, confirming it is not a one-off.

Further Comments

Main PR: #2896

Neither the conditional OTP sub-flow nor this option is part of the default election-event realm template, so both remain a per-realm opt-in. Whether they should be defaults is tracked as an open item on the parent issue.

edulix added 2 commits July 29, 2026 18:15
Add a new boolean authenticator config property "Auto-create OTP
credential" (autoCreateCredentialAttribute, disabled by default). When
enabled, configuredFor() auto-creates the message-otp credential for
non-deferred users that have a mobile number or email configured, so
imported/edited voters can use the OTP alternative without an
enrollment required action and without changing voter import/edit.

Deferred-user mode keeps relying on auth notes and never requires nor
creates a stored credential, fixing the silent filtering of the OTP
alternative that ended in a generic invalid_user_credentials error.

Includes unit tests (MessageOTPAuthenticatorTest, 10 tests) and junit
jupiter + mockito test dependencies for the module.

Related: sequentech/meta#12616
(cherry picked from commit 1b43757)
Document the opt-in Auto-create OTP credential option: why imported
voters were silently skipping the OTP sub-flow, how to wire the
conditional OTP sub-flow into the browser flow, how to enable the
option, what the voter sees, and how to confirm the message-otp
credential was created.

Screenshots were captured against a dev election event configured
end to end with an email-only voter.

Related: sequentech/meta#12616
(cherry picked from commit 735e275)
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://docs.sequentech.io/docusaurus/pr-preview/pr-2918/

Built to branch doc-previews at 2026-07-29 18:21 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant