Repository navigation
feat: session auth-method recording with amr/acr claims + step-up - #3233
Conversation
Plan 049 stage 1 + the /token otp gate (roadmap wave 3.1): - auth_user_authenticators: polymorphic device rows (kind totp/recovery; email/webauthn reserved); TOTP seeds AES-256-GCM-encrypted at rest (new SymmetricCipher in @authup/server-kit) under MFA_ENCRYPTION_KEY (fail-closed), recovery codes bcrypt-hashed, single-use, regenerated as a set; secret/codes select:false and stripped from every read. - two-step enrollment (create unconfirmed -> confirm with code) on /users/:id/authenticators (+ @me), admin management via new USER_AUTHENTICATOR_* permissions (realm_admin own-scoped CUD). - session-bound proof: auth_sessions.mfa_at (+ auth_method column for plan 050, coordinated into one migration pair) stamped by POST /authenticators/challenge or the password grant otp param; the OAuth2Authorization backstop throws a dedicated mfa_required error when a confirmed-device user authorizes without it; the password grant rejects password-only logins for enrolled users (otp accepts a totp or recovery code, classified by shape). - per-account exponential backoff (cache-keyed, 429 mfa_attempt_throttled), mfaEnrolled/mfaRemoved/mfaVerified/ mfaChallengeFailed events, mfa_required authorize metric outcome, typed client.userAuthenticator.*, config mfaEnabled/mfaRequired/ mfaEncryptionKey (boot-validated), i18n error catalog x4 locales, migrations verified via run/revert/re-run on mysql + postgres.
Plan 050 stages 1-3 (roadmap wave 3.1, second half): - every session-creation site stamps auth_method (pwd/ext/client/robot; ldap reserved for the deferred stage 1b) — the federated IdP callback threads it through the authorization-code blob so the /token fallback-create inherits it, and the interactive /authorize threads the bearer session's method the same way. - amr/acr derive at the /token exchange from the RESOLVED session (deriveAmrAcr): pwd/ldap -> ['pwd'], ext -> ['ext'], + 'otp' when the session carries a second-factor proof (mfa_at); acr urn:authup:mfa vs urn:authup:pwd (urn-style, never the reserved "0"). Emitted on every token kind (intentional — resource servers read the method without parsing an id_token); NULL auth_method (pre-column session) emits none. - acr_values accepted on /authorize (case-sensitive mount, persisted on the code blob) and advertised via discovery acr_values_supported; urn:authup:mfa acts as a step-up trigger enforced only while the user holds a confirmed factor (voluntary per OIDC Core 5.5.1.1 otherwise): session.mfa_at must be within mfaFreshnessMaxAge (default 60s, NOT the plan's 0 — a 0-window could never absorb the challenge round-trip and would loop the hosted ladder). - session list read surface exposes mfa_at/auth_method.
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds session authentication-method stamping, OIDC ChangesAuthentication context flow
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant AuthorizeController
participant OAuth2Authorization
participant Session
participant OAuth2AuthorizeGrant
participant TokenIssuers
Client->>AuthorizeController: Request authorization with acr_values
AuthorizeController->>OAuth2Authorization: Forward MFA freshness configuration
OAuth2Authorization->>Session: Check mfa_at freshness
OAuth2Authorization-->>Client: Return step-up error or authorization code
Client->>OAuth2AuthorizeGrant: Exchange authorization code
OAuth2AuthorizeGrant->>Session: Resolve authenticated session
OAuth2AuthorizeGrant->>TokenIssuers: Issue tokens with derived amr and acr
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
authup
@authup/client-web
@authup/server-core
@authup/access
@authup/client-web-kit
@authup/client-web-kit-theme
@authup/client-web-nuxt
@authup/client-web-theme
@authup/core-http-kit
@authup/core-kit
@authup/core-realtime-kit
@authup/errors
@authup/i18n
@authup/kit
@authup/server-adapter-kit
@authup/server-adapter-node
@authup/server-adapter-socket-io
@authup/server-adapter-web
@authup/server-kit
@authup/server-test-kit
@authup/specs
commit: |
…ery atomicity - validate mfaEncryptionKey decodes to exactly 32 bytes at config time (normalize) instead of only truthiness — a wrong-length/whitespace key now fails loud at boot, not asynchronously at first encrypt/decrypt. - SymmetricCipher validates the key length synchronously in the constructor, so a bad key throws at construction (DI mount) rather than leaving an unobserved promise rejection. - resolveUserId throws BadRequestError when a non-user identity uses @me/@self, instead of letting the literal token match zero rows. - enrollRecovery reuses the existing recovery row via a single atomic save instead of delete-then-insert, so a mid-op failure can never leave the user with no codes. - verify-path concurrency/replay hardening (TOTP step reuse, recovery race, attempt-counter atomicity, session-stamp atomicity) tracked in #3237. Refs #3232
Folds the schema-dependent hardening from #3237 into the still-unreleased auth_user_authenticators migration so no future migration is needed: - add a @VersionColumn (`version`) to the authenticator row (folded into 1783856507391-Default.ts, both dialects; run/revert/re-run verified on mysql + postgres). The verify path now consumes a factor exactly once under concurrency — a racing second save fails the version check, which the repository adapter translates to EntityConflictError and the service treats as a failed attempt (fixes recovery-code race, CR #602). - persist the last accepted TOTP step and reject any step <= it, closing the in-window replay window (RFC 6238 §5.2, CR #604). Tracked only on the login-verify path (not confirm), so a first login in the confirmation window still works. The two schema-FREE items from #3237 (attempt-counter atomicity via an ICache atomic-increment; cross-aggregate session-stamp) stay open there — deferring them needs no migration. Refs #3232 #3237
Replace the @VersionColumn optimistic-lock guard on the MFA verify path with a per-user cache lock so a single factor (TOTP step / recovery code) is consumed exactly once under concurrency, without a schema column. Add ICache.add — atomic set-if-absent (Redis `SET … NX`, memory single-tick check-set) — as the lock primitive. Acquisition fails open so a cache outage cannot break MFA login; the TOTP step-counter and recovery `used_at` flags remain the correctness backstop. A held lock means another verify is mid-flight, so the request bails without penalty rather than risk a double-consume. Drop the version column from the entity, the core-kit domain type, and the still-unreleased 1783856507391 migration (both dialects).
…d-claims # Conflicts: # .agents/architecture.md # apps/server-core/src/adapters/http/controllers/workflows/authorize/module.ts # apps/server-core/src/app/modules/config/constants.ts # apps/server-core/src/app/modules/config/normalize.ts # apps/server-core/src/app/modules/config/read/env.ts # apps/server-core/src/app/modules/config/types.ts # apps/server-core/src/app/modules/config/validator.ts # apps/server-core/src/core/oauth2/authorization/module.ts # apps/server-core/src/core/oauth2/authorization/types.ts # apps/server-core/src/core/oauth2/grant-types/password.ts # docs/src/guide/deployment/configuration-server-core.md # packages/specs/src/oauth2/constants.ts # packages/specs/src/oauth2/error/mfa-required.ts
|
@dependabot full review |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
apps/server-core/test/unit/core/oauth2/grant-types/authorize.spec.ts (1)
308-328: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd access-token assertion to the MFA test for parity with the password test.
Test 2 (line 305) deliberately asserts
accessTokenIssuer.issueCallscontains the claims, but this MFA test only checksopenIdTokenIssuer.issueCalls. Since the architecture explicitly emitsamr/acron every token kind, the MFA path should be guarded against regressions on the access token too.♻️ Proposed addition
expect(openIdTokenIssuer.issueCalls).toContainEqual( expect.objectContaining({ amr: ['pwd', 'otp'], acr: 'urn:authup:mfa' }), ); + + // deliberately on the access token too + expect(accessTokenIssuer.issueCalls).toContainEqual( + expect.objectContaining({ amr: ['pwd', 'otp'], acr: 'urn:authup:mfa' }), + ); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server-core/test/unit/core/oauth2/grant-types/authorize.spec.ts` around lines 308 - 328, Add an assertion in the MFA test case around grant.runWith and the existing openIdTokenIssuer assertion to verify accessTokenIssuer.issueCalls also contains amr ['pwd', 'otp'] and acr 'urn:authup:mfa', matching the password test’s coverage.apps/server-core/test/unit/http/controllers/workflows/token/id-token-claims.spec.ts (1)
122-160: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd access-token claim assertion to the MFA step-up test.
Test 1 (lines 117-119) decodes and asserts
amr/acron the access token, but this MFA test only checks the id_token. Since the design deliberately emits claims on every token kind, the MFA step-up path should also be verified on the access token.♻️ Proposed addition
const idToken = decodeJwtPayload(tokenResponse.id_token!); expect(idToken.amr).toEqual(['pwd', 'otp']); expect(idToken.acr).toEqual('urn:authup:mfa'); + + // deliberately on the access token too + const accessToken = decodeJwtPayload(tokenResponse.access_token); + expect(accessToken.amr).toEqual(['pwd', 'otp']); + expect(accessToken.acr).toEqual('urn:authup:mfa'); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server-core/test/unit/http/controllers/workflows/token/id-token-claims.spec.ts` around lines 122 - 160, Add assertions for the access token in the MFA step-up test around authorizeAndExchange: decode tokenResponse.access_token and verify its amr is ['pwd', 'otp'] and acr is 'urn:authup:mfa', alongside the existing ID token assertions.apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts (1)
344-345: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the specific MFA-required outcome.
These cases only verify the shared error code, so regressions that interchange challenge, enrollment, and step-up responses would still pass. Assert each constructor’s distinguishing message or response detail.
Also applies to: 367-368, 384-388
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts` around lines 344 - 345, Strengthen the assertions in the authorization MFA-related cases around authorize, including the additional cases at the referenced assertions, by matching each expected error’s constructor-specific message or response detail in addition to ErrorCode.OAUTH_MFA_REQUIRED. Use the distinguishing values for challenge, enrollment, and step-up outcomes so the tests detect swapped MFA response types.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server-core/src/core/oauth2/authorization/code/issuer/types.ts`:
- Around line 29-33: Update the authMethod property in the authorization code
type to use the SessionAuthMethod type instead of string, while preserving its
optional and nullable behavior. Reuse the existing SessionAuthMethod definition
or import it from its established module so persisted values are constrained to
supported authentication methods.
In `@apps/server-core/src/core/oauth2/grant-types/password.ts`:
- Line 17: The password grant flow must include derived amr and acr claims in
its issued access and refresh tokens. Update the token construction in
password.ts to call deriveAmrAcr(session), matching authorize.ts, and propagate
both claims alongside the existing auth_method and mfa_at values.
---
Nitpick comments:
In `@apps/server-core/test/unit/core/oauth2/authorization/module.spec.ts`:
- Around line 344-345: Strengthen the assertions in the authorization
MFA-related cases around authorize, including the additional cases at the
referenced assertions, by matching each expected error’s constructor-specific
message or response detail in addition to ErrorCode.OAUTH_MFA_REQUIRED. Use the
distinguishing values for challenge, enrollment, and step-up outcomes so the
tests detect swapped MFA response types.
In `@apps/server-core/test/unit/core/oauth2/grant-types/authorize.spec.ts`:
- Around line 308-328: Add an assertion in the MFA test case around
grant.runWith and the existing openIdTokenIssuer assertion to verify
accessTokenIssuer.issueCalls also contains amr ['pwd', 'otp'] and acr
'urn:authup:mfa', matching the password test’s coverage.
In
`@apps/server-core/test/unit/http/controllers/workflows/token/id-token-claims.spec.ts`:
- Around line 122-160: Add assertions for the access token in the MFA step-up
test around authorizeAndExchange: decode tokenResponse.access_token and verify
its amr is ['pwd', 'otp'] and acr is 'urn:authup:mfa', alongside the existing ID
token assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ebf3456c-115b-4fb6-a6e3-0045052720f3
📒 Files selected for processing (36)
.agents/architecture.mdapps/server-core/src/adapters/http/controllers/entities/identity-provider/module.tsapps/server-core/src/adapters/http/controllers/entities/realm/module.tsapps/server-core/src/adapters/http/controllers/workflows/authorize/module.tsapps/server-core/src/adapters/http/controllers/workflows/authorize/types.tsapps/server-core/src/app/modules/config/constants.tsapps/server-core/src/app/modules/config/normalize.tsapps/server-core/src/app/modules/config/read/env.tsapps/server-core/src/app/modules/config/types.tsapps/server-core/src/app/modules/config/validator.tsapps/server-core/src/app/modules/http/modules/controller.tsapps/server-core/src/core/oauth2/authorization/code-request/validator.tsapps/server-core/src/core/oauth2/authorization/code/issuer/module.tsapps/server-core/src/core/oauth2/authorization/code/issuer/types.tsapps/server-core/src/core/oauth2/authorization/helpers.tsapps/server-core/src/core/oauth2/authorization/module.tsapps/server-core/src/core/oauth2/authorization/types.tsapps/server-core/src/core/oauth2/grant-types/authorize.tsapps/server-core/src/core/oauth2/grant-types/client-credentials.tsapps/server-core/src/core/oauth2/grant-types/identity.tsapps/server-core/src/core/oauth2/grant-types/password.tsapps/server-core/src/core/oauth2/grant-types/robot-credentials.tsapps/server-core/test/unit/core/oauth2/authorization/helpers.spec.tsapps/server-core/test/unit/core/oauth2/authorization/module.spec.tsapps/server-core/test/unit/core/oauth2/grant-types/authorize.spec.tsapps/server-core/test/unit/core/oauth2/grant-types/client-credentials.spec.tsapps/server-core/test/unit/core/oauth2/grant-types/identity.spec.tsapps/server-core/test/unit/core/oauth2/grant-types/robot-credentials.spec.tsapps/server-core/test/unit/http/controllers/entities/realm-openid.spec.tsapps/server-core/test/unit/http/controllers/workflows/token/id-token-claims.spec.tsdocs/src/guide/deployment/configuration-server-core.mdpackages/core-kit/src/domains/authorization-code/entity.tspackages/specs/src/oauth2/constants.tspackages/specs/src/oauth2/error/mfa-required.tspackages/specs/src/oauth2/types.tspackages/specs/src/openid/type.ts
…3233) The direct password (ROPC) and identity grants stamped `auth_method` on the session but issued tokens without the derived `amr`/`acr` claims, so a resource server receiving a direct-grant token could not read how the subject authenticated — unlike the authorization_code exchange, which already spreads `deriveAmrAcr(session)` onto its payload. Both grants now derive and spread the claims from the same session fields, mirroring authorize.ts. M2M grants (client/robot) are unaffected — `deriveAmrAcr` returns nothing for their methods.
…lue-union (#3233) `Session.auth_method`, `OAuth2AuthorizationCode.auth_method`, the session TypeORM entity column, and the authorization-code issuer option were typed `string | null`, permitting invalid persisted values while downstream claim derivation only recognizes defined methods. Narrow all four to `` `${SessionAuthMethod}` | null `` (matching the existing `UserAuthenticator.kind` convention) so the type mirrors the actual value set. Pure type narrowing — every write site already passes a `SessionAuthMethod` member or null.
…dmin tabs (#3234) * feat: mfa authenticator devices with totp + recovery codes Plan 049 stage 1 + the /token otp gate (roadmap wave 3.1): - auth_user_authenticators: polymorphic device rows (kind totp/recovery; email/webauthn reserved); TOTP seeds AES-256-GCM-encrypted at rest (new SymmetricCipher in @authup/server-kit) under MFA_ENCRYPTION_KEY (fail-closed), recovery codes bcrypt-hashed, single-use, regenerated as a set; secret/codes select:false and stripped from every read. - two-step enrollment (create unconfirmed -> confirm with code) on /users/:id/authenticators (+ @me), admin management via new USER_AUTHENTICATOR_* permissions (realm_admin own-scoped CUD). - session-bound proof: auth_sessions.mfa_at (+ auth_method column for plan 050, coordinated into one migration pair) stamped by POST /authenticators/challenge or the password grant otp param; the OAuth2Authorization backstop throws a dedicated mfa_required error when a confirmed-device user authorizes without it; the password grant rejects password-only logins for enrolled users (otp accepts a totp or recovery code, classified by shape). - per-account exponential backoff (cache-keyed, 429 mfa_attempt_throttled), mfaEnrolled/mfaRemoved/mfaVerified/ mfaChallengeFailed events, mfa_required authorize metric outcome, typed client.userAuthenticator.*, config mfaEnabled/mfaRequired/ mfaEncryptionKey (boot-validated), i18n error catalog x4 locales, migrations verified via run/revert/re-run on mysql + postgres. * feat: session auth-method recording with amr/acr claims and acr step-up Plan 050 stages 1-3 (roadmap wave 3.1, second half): - every session-creation site stamps auth_method (pwd/ext/client/robot; ldap reserved for the deferred stage 1b) — the federated IdP callback threads it through the authorization-code blob so the /token fallback-create inherits it, and the interactive /authorize threads the bearer session's method the same way. - amr/acr derive at the /token exchange from the RESOLVED session (deriveAmrAcr): pwd/ldap -> ['pwd'], ext -> ['ext'], + 'otp' when the session carries a second-factor proof (mfa_at); acr urn:authup:mfa vs urn:authup:pwd (urn-style, never the reserved "0"). Emitted on every token kind (intentional — resource servers read the method without parsing an id_token); NULL auth_method (pre-column session) emits none. - acr_values accepted on /authorize (case-sensitive mount, persisted on the code blob) and advertised via discovery acr_values_supported; urn:authup:mfa acts as a step-up trigger enforced only while the user holds a confirmed factor (voluntary per OIDC Core 5.5.1.1 otherwise): session.mfa_at must be within mfaFreshnessMaxAge (default 60s, NOT the plan's 0 — a 0-window could never absorb the challenge round-trip and would loop the hosted ladder). - session list read surface exposes mfa_at/auth_method. * feat(client-web-kit): mfa challenge step, enrollment ui, settings + admin tabs Plan 049 UI (roadmap wave 3.1): - AMfaChallengeForm (workflows/mfa) — code input posting to client.userAuthenticator.verifyChallenge, recovery-code fallback toggle, extractErrorContext failures. - Authorize.vue ladder: after login a watch(loggedIn) fetches GET /authenticators/challenge; consent blocks until it resolves (built_in auto-consent must not fire first); required -> the challenge form before consent (its done = mfa_at stamped, so the consent POST passes the server backstop); enrollmentRequired -> inline AUserAuthenticatorEnroll (configure-inline). Interactive only; silent flows let the auto-consent hit the backstop -> interaction_required. - AUserAuthenticatorEnroll (QR data-uri + confirm code / recovery codes with download) + AUserAuthenticators (list + delete + embedded enroll); hosted on settings security tab (@me) and an admin authenticators tab gated on USER_AUTHENTICATOR_READ. - MFA_* (authupClient) + AUTHENTICATOR/MFA_SECURITY_* (authupApp) keys across all four locales (parity test green); kit component test. * fix(mfa): address review — key validation, cipher construction, recovery atomicity - validate mfaEncryptionKey decodes to exactly 32 bytes at config time (normalize) instead of only truthiness — a wrong-length/whitespace key now fails loud at boot, not asynchronously at first encrypt/decrypt. - SymmetricCipher validates the key length synchronously in the constructor, so a bad key throws at construction (DI mount) rather than leaving an unobserved promise rejection. - resolveUserId throws BadRequestError when a non-user identity uses @me/@self, instead of letting the literal token match zero rows. - enrollRecovery reuses the existing recovery row via a single atomic save instead of delete-then-insert, so a mid-op failure can never leave the user with no codes. - verify-path concurrency/replay hardening (TOTP step reuse, recovery race, attempt-counter atomicity, session-stamp atomicity) tracked in #3237. Refs #3232 * fix(mfa): optimistic-lock + totp replay protection (#3237, schema half) Folds the schema-dependent hardening from #3237 into the still-unreleased auth_user_authenticators migration so no future migration is needed: - add a @VersionColumn (`version`) to the authenticator row (folded into 1783856507391-Default.ts, both dialects; run/revert/re-run verified on mysql + postgres). The verify path now consumes a factor exactly once under concurrency — a racing second save fails the version check, which the repository adapter translates to EntityConflictError and the service treats as a failed attempt (fixes recovery-code race, CR #602). - persist the last accepted TOTP step and reject any step <= it, closing the in-window replay window (RFC 6238 §5.2, CR #604). Tracked only on the login-verify path (not confirm), so a first login in the confirmation window still works. The two schema-FREE items from #3237 (attempt-counter atomicity via an ICache atomic-increment; cross-aggregate session-stamp) stay open there — deferring them needs no migration. Refs #3232 #3237 * test(mfa): use distinct totp steps for sequential verifies (#3237) The anti-replay step tracking rejects reusing one TOTP code for two successful verifications; the e2e now generates the password-grant otp from the previous ±1-window step so it stays behind the later challenge code. Refs #3232 #3237 * refactor(mfa): serialize verify with a per-user cache lock (#3237) Replace the @VersionColumn optimistic-lock guard on the MFA verify path with a per-user cache lock so a single factor (TOTP step / recovery code) is consumed exactly once under concurrency, without a schema column. Add ICache.add — atomic set-if-absent (Redis `SET … NX`, memory single-tick check-set) — as the lock primitive. Acquisition fails open so a cache outage cannot break MFA login; the TOTP step-counter and recovery `used_at` flags remain the correctness backstop. A held lock means another verify is mid-flight, so the request bails without penalty rather than risk a double-consume. Drop the version column from the entity, the core-kit domain type, and the still-unreleased 1783856507391 migration (both dialects). * fix(oauth2): emit amr/acr on the direct password and identity grants (#3233) The direct password (ROPC) and identity grants stamped `auth_method` on the session but issued tokens without the derived `amr`/`acr` claims, so a resource server receiving a direct-grant token could not read how the subject authenticated — unlike the authorization_code exchange, which already spreads `deriveAmrAcr(session)` onto its payload. Both grants now derive and spread the claims from the same session fields, mirroring authorize.ts. M2M grants (client/robot) are unaffected — `deriveAmrAcr` returns nothing for their methods. * refactor(core-kit): constrain auth_method to the SessionAuthMethod value-union (#3233) `Session.auth_method`, `OAuth2AuthorizationCode.auth_method`, the session TypeORM entity column, and the authorization-code issuer option were typed `string | null`, permitting invalid persisted values while downstream claim derivation only recognizes defined methods. Narrow all four to `` `${SessionAuthMethod}` | null `` (matching the existing `UserAuthenticator.kind` convention) so the type mirrors the actual value set. Pure type narrowing — every write site already passes a `SessionAuthMethod` member or null. * fix(client-web-kit): address MFA UI review feedback (#3234) - AUserAuthenticatorEnroll: add a Close action to the recovery-codes view so the user can return to the kind picker after generating codes (it previously stuck there — recovery enroll never reset the view, unlike the TOTP path). - AUserAuthenticators: confirm before deleting an authenticator via useAlertDialog — removing a factor is irreversible and weakens the account's security posture (matches the other destructive kit actions). - Authorize: retry the MFA challenge lookup once before failing open, so a transient blip does not permanently disable the client-side gate for the render lifecycle (the server /authorize backstop stays authoritative). - i18n(de): AUTHENTICATOR -> 'Authentifikatoren' (plural device noun, matching en/fr/es) instead of 'Authentifizierung' (the process).
* feat: mfa authenticator devices with totp + recovery codes Plan 049 stage 1 + the /token otp gate (roadmap wave 3.1): - auth_user_authenticators: polymorphic device rows (kind totp/recovery; email/webauthn reserved); TOTP seeds AES-256-GCM-encrypted at rest (new SymmetricCipher in @authup/server-kit) under MFA_ENCRYPTION_KEY (fail-closed), recovery codes bcrypt-hashed, single-use, regenerated as a set; secret/codes select:false and stripped from every read. - two-step enrollment (create unconfirmed -> confirm with code) on /users/:id/authenticators (+ @me), admin management via new USER_AUTHENTICATOR_* permissions (realm_admin own-scoped CUD). - session-bound proof: auth_sessions.mfa_at (+ auth_method column for plan 050, coordinated into one migration pair) stamped by POST /authenticators/challenge or the password grant otp param; the OAuth2Authorization backstop throws a dedicated mfa_required error when a confirmed-device user authorizes without it; the password grant rejects password-only logins for enrolled users (otp accepts a totp or recovery code, classified by shape). - per-account exponential backoff (cache-keyed, 429 mfa_attempt_throttled), mfaEnrolled/mfaRemoved/mfaVerified/ mfaChallengeFailed events, mfa_required authorize metric outcome, typed client.userAuthenticator.*, config mfaEnabled/mfaRequired/ mfaEncryptionKey (boot-validated), i18n error catalog x4 locales, migrations verified via run/revert/re-run on mysql + postgres. * feat: session auth-method recording with amr/acr claims and acr step-up Plan 050 stages 1-3 (roadmap wave 3.1, second half): - every session-creation site stamps auth_method (pwd/ext/client/robot; ldap reserved for the deferred stage 1b) — the federated IdP callback threads it through the authorization-code blob so the /token fallback-create inherits it, and the interactive /authorize threads the bearer session's method the same way. - amr/acr derive at the /token exchange from the RESOLVED session (deriveAmrAcr): pwd/ldap -> ['pwd'], ext -> ['ext'], + 'otp' when the session carries a second-factor proof (mfa_at); acr urn:authup:mfa vs urn:authup:pwd (urn-style, never the reserved "0"). Emitted on every token kind (intentional — resource servers read the method without parsing an id_token); NULL auth_method (pre-column session) emits none. - acr_values accepted on /authorize (case-sensitive mount, persisted on the code blob) and advertised via discovery acr_values_supported; urn:authup:mfa acts as a step-up trigger enforced only while the user holds a confirmed factor (voluntary per OIDC Core 5.5.1.1 otherwise): session.mfa_at must be within mfaFreshnessMaxAge (default 60s, NOT the plan's 0 — a 0-window could never absorb the challenge round-trip and would loop the hosted ladder). - session list read surface exposes mfa_at/auth_method. * feat(client-web-kit): mfa challenge step, enrollment ui, settings + admin tabs Plan 049 UI (roadmap wave 3.1): - AMfaChallengeForm (workflows/mfa) — code input posting to client.userAuthenticator.verifyChallenge, recovery-code fallback toggle, extractErrorContext failures. - Authorize.vue ladder: after login a watch(loggedIn) fetches GET /authenticators/challenge; consent blocks until it resolves (built_in auto-consent must not fire first); required -> the challenge form before consent (its done = mfa_at stamped, so the consent POST passes the server backstop); enrollmentRequired -> inline AUserAuthenticatorEnroll (configure-inline). Interactive only; silent flows let the auto-consent hit the backstop -> interaction_required. - AUserAuthenticatorEnroll (QR data-uri + confirm code / recovery codes with download) + AUserAuthenticators (list + delete + embedded enroll); hosted on settings security tab (@me) and an admin authenticators tab gated on USER_AUTHENTICATOR_READ. - MFA_* (authupClient) + AUTHENTICATOR/MFA_SECURITY_* (authupApp) keys across all four locales (parity test green); kit component test. * feat: email otp as a second-factor kind (plan 049 stage 1.5) - kind:'email' rows mark a verified mailbox as an enrolled factor (confirmed on create; enrollment force-loads the select:false email via findOneByWithEmail). The code is transient: sendChallenge generates a 6-digit numeric code, bcrypt-hashes it into the cache (mfaEmailCode:<user_id>, 10-min TTL) and mails it via a new MailTemplateName.MFA_EMAIL_OTP template (authupMail i18n x4); verify compares the cached hash + expiry and single-uses it. - POST /authenticators/challenge/send { kind } issues the challenge (uniform 200 — no enrollment/status oracle; only a confirmed email factor triggers a mail); client.userAuthenticator.sendChallenge. - MailModule.setup honors a pre-registered MailInjectionKey (test fake wins, mirroring UIHttpClient) so tests can capture mailed codes. - kit: AMfaChallengeForm gains an email branch (send-code button -> code input) + kind switcher; enroll picker gains an email option. - tests: service (enroll/send/verify/single-use/fail-closed), mail renderer + smoke matrix, kit challenge email flow, HTTP e2e. * fix(mfa): address review — key validation, cipher construction, recovery atomicity - validate mfaEncryptionKey decodes to exactly 32 bytes at config time (normalize) instead of only truthiness — a wrong-length/whitespace key now fails loud at boot, not asynchronously at first encrypt/decrypt. - SymmetricCipher validates the key length synchronously in the constructor, so a bad key throws at construction (DI mount) rather than leaving an unobserved promise rejection. - resolveUserId throws BadRequestError when a non-user identity uses @me/@self, instead of letting the literal token match zero rows. - enrollRecovery reuses the existing recovery row via a single atomic save instead of delete-then-insert, so a mid-op failure can never leave the user with no codes. - verify-path concurrency/replay hardening (TOTP step reuse, recovery race, attempt-counter atomicity, session-stamp atomicity) tracked in #3237. Refs #3232 * fix(mfa): optimistic-lock + totp replay protection (#3237, schema half) Folds the schema-dependent hardening from #3237 into the still-unreleased auth_user_authenticators migration so no future migration is needed: - add a @VersionColumn (`version`) to the authenticator row (folded into 1783856507391-Default.ts, both dialects; run/revert/re-run verified on mysql + postgres). The verify path now consumes a factor exactly once under concurrency — a racing second save fails the version check, which the repository adapter translates to EntityConflictError and the service treats as a failed attempt (fixes recovery-code race, CR #602). - persist the last accepted TOTP step and reject any step <= it, closing the in-window replay window (RFC 6238 §5.2, CR #604). Tracked only on the login-verify path (not confirm), so a first login in the confirmation window still works. The two schema-FREE items from #3237 (attempt-counter atomicity via an ICache atomic-increment; cross-aggregate session-stamp) stay open there — deferring them needs no migration. Refs #3232 #3237 * test(mfa): use distinct totp steps for sequential verifies (#3237) The anti-replay step tracking rejects reusing one TOTP code for two successful verifications; the e2e now generates the password-grant otp from the previous ±1-window step so it stays behind the later challenge code. Refs #3232 #3237 * refactor(mfa): serialize verify with a per-user cache lock (#3237) Replace the @VersionColumn optimistic-lock guard on the MFA verify path with a per-user cache lock so a single factor (TOTP step / recovery code) is consumed exactly once under concurrency, without a schema column. Add ICache.add — atomic set-if-absent (Redis `SET … NX`, memory single-tick check-set) — as the lock primitive. Acquisition fails open so a cache outage cannot break MFA login; the TOTP step-counter and recovery `used_at` flags remain the correctness backstop. A held lock means another verify is mid-flight, so the request bails without penalty rather than risk a double-consume. Drop the version column from the entity, the core-kit domain type, and the still-unreleased 1783856507391 migration (both dialects). * fix(oauth2): emit amr/acr on the direct password and identity grants (#3233) The direct password (ROPC) and identity grants stamped `auth_method` on the session but issued tokens without the derived `amr`/`acr` claims, so a resource server receiving a direct-grant token could not read how the subject authenticated — unlike the authorization_code exchange, which already spreads `deriveAmrAcr(session)` onto its payload. Both grants now derive and spread the claims from the same session fields, mirroring authorize.ts. M2M grants (client/robot) are unaffected — `deriveAmrAcr` returns nothing for their methods. * refactor(core-kit): constrain auth_method to the SessionAuthMethod value-union (#3233) `Session.auth_method`, `OAuth2AuthorizationCode.auth_method`, the session TypeORM entity column, and the authorization-code issuer option were typed `string | null`, permitting invalid persisted values while downstream claim derivation only recognizes defined methods. Narrow all four to `` `${SessionAuthMethod}` | null `` (matching the existing `UserAuthenticator.kind` convention) so the type mirrors the actual value set. Pure type narrowing — every write site already passes a `SessionAuthMethod` member or null. * fix(client-web-kit): address MFA UI review feedback (#3234) - AUserAuthenticatorEnroll: add a Close action to the recovery-codes view so the user can return to the kind picker after generating codes (it previously stuck there — recovery enroll never reset the view, unlike the TOTP path). - AUserAuthenticators: confirm before deleting an authenticator via useAlertDialog — removing a factor is irreversible and weakens the account's security posture (matches the other destructive kit actions). - Authorize: retry the MFA challenge lookup once before failing open, so a transient blip does not permanently disable the client-side gate for the render lifecycle (the server /authorize backstop stays authoritative). - i18n(de): AUTHENTICATOR -> 'Authentifikatoren' (plural device noun, matching en/fr/es) instead of 'Authentifizierung' (the process). * fix(mfa): harden email-OTP factor per review feedback (#3235) - enrollEmail: update the existing email marker row in place instead of remove-then-create, so a failed save can never leave the user with no email factor (the row carries no secret/codes — an in-place update is equivalent). - verify: EMAIL has no persisted anti-replay backstop (its single-use rides on the verify lock + cache drop), so it must NOT ride the lock's fail-open path. acquireVerifyLock now reports acquired | busy | unavailable; EMAIL fails closed when the lock is unavailable (cache down), while TOTP/recovery keep proceeding on their persisted backstops. Only release a lock we actually hold. - sendChallenge: add a per-user send cooldown (atomic set-if-absent, fails open on cache error) so an authenticated caller cannot spray unlimited OTP mails; a resend within the window throws MfaThrottledError (429). - AMfaChallengeForm: emit the original exception through `failed` (was a string) so consumers can inspect status/context, matching AUserAuthenticatorEnroll; add a resend action to the email verification form (a delayed/expired code otherwise dead-ends the flow — the server cooldown backs it).
* feat: mfa authenticator devices with totp + recovery codes Plan 049 stage 1 + the /token otp gate (roadmap wave 3.1): - auth_user_authenticators: polymorphic device rows (kind totp/recovery; email/webauthn reserved); TOTP seeds AES-256-GCM-encrypted at rest (new SymmetricCipher in @authup/server-kit) under MFA_ENCRYPTION_KEY (fail-closed), recovery codes bcrypt-hashed, single-use, regenerated as a set; secret/codes select:false and stripped from every read. - two-step enrollment (create unconfirmed -> confirm with code) on /users/:id/authenticators (+ @me), admin management via new USER_AUTHENTICATOR_* permissions (realm_admin own-scoped CUD). - session-bound proof: auth_sessions.mfa_at (+ auth_method column for plan 050, coordinated into one migration pair) stamped by POST /authenticators/challenge or the password grant otp param; the OAuth2Authorization backstop throws a dedicated mfa_required error when a confirmed-device user authorizes without it; the password grant rejects password-only logins for enrolled users (otp accepts a totp or recovery code, classified by shape). - per-account exponential backoff (cache-keyed, 429 mfa_attempt_throttled), mfaEnrolled/mfaRemoved/mfaVerified/ mfaChallengeFailed events, mfa_required authorize metric outcome, typed client.userAuthenticator.*, config mfaEnabled/mfaRequired/ mfaEncryptionKey (boot-validated), i18n error catalog x4 locales, migrations verified via run/revert/re-run on mysql + postgres. * feat: session auth-method recording with amr/acr claims and acr step-up Plan 050 stages 1-3 (roadmap wave 3.1, second half): - every session-creation site stamps auth_method (pwd/ext/client/robot; ldap reserved for the deferred stage 1b) — the federated IdP callback threads it through the authorization-code blob so the /token fallback-create inherits it, and the interactive /authorize threads the bearer session's method the same way. - amr/acr derive at the /token exchange from the RESOLVED session (deriveAmrAcr): pwd/ldap -> ['pwd'], ext -> ['ext'], + 'otp' when the session carries a second-factor proof (mfa_at); acr urn:authup:mfa vs urn:authup:pwd (urn-style, never the reserved "0"). Emitted on every token kind (intentional — resource servers read the method without parsing an id_token); NULL auth_method (pre-column session) emits none. - acr_values accepted on /authorize (case-sensitive mount, persisted on the code blob) and advertised via discovery acr_values_supported; urn:authup:mfa acts as a step-up trigger enforced only while the user holds a confirmed factor (voluntary per OIDC Core 5.5.1.1 otherwise): session.mfa_at must be within mfaFreshnessMaxAge (default 60s, NOT the plan's 0 — a 0-window could never absorb the challenge round-trip and would loop the hosted ladder). - session list read surface exposes mfa_at/auth_method. * feat(client-web-kit): mfa challenge step, enrollment ui, settings + admin tabs Plan 049 UI (roadmap wave 3.1): - AMfaChallengeForm (workflows/mfa) — code input posting to client.userAuthenticator.verifyChallenge, recovery-code fallback toggle, extractErrorContext failures. - Authorize.vue ladder: after login a watch(loggedIn) fetches GET /authenticators/challenge; consent blocks until it resolves (built_in auto-consent must not fire first); required -> the challenge form before consent (its done = mfa_at stamped, so the consent POST passes the server backstop); enrollmentRequired -> inline AUserAuthenticatorEnroll (configure-inline). Interactive only; silent flows let the auto-consent hit the backstop -> interaction_required. - AUserAuthenticatorEnroll (QR data-uri + confirm code / recovery codes with download) + AUserAuthenticators (list + delete + embedded enroll); hosted on settings security tab (@me) and an admin authenticators tab gated on USER_AUTHENTICATOR_READ. - MFA_* (authupClient) + AUTHENTICATOR/MFA_SECURITY_* (authupApp) keys across all four locales (parity test green); kit component test. * feat: email otp as a second-factor kind (plan 049 stage 1.5) - kind:'email' rows mark a verified mailbox as an enrolled factor (confirmed on create; enrollment force-loads the select:false email via findOneByWithEmail). The code is transient: sendChallenge generates a 6-digit numeric code, bcrypt-hashes it into the cache (mfaEmailCode:<user_id>, 10-min TTL) and mails it via a new MailTemplateName.MFA_EMAIL_OTP template (authupMail i18n x4); verify compares the cached hash + expiry and single-uses it. - POST /authenticators/challenge/send { kind } issues the challenge (uniform 200 — no enrollment/status oracle; only a confirmed email factor triggers a mail); client.userAuthenticator.sendChallenge. - MailModule.setup honors a pre-registered MailInjectionKey (test fake wins, mirroring UIHttpClient) so tests can capture mailed codes. - kit: AMfaChallengeForm gains an email branch (send-code button -> code input) + kind switcher; enroll picker gains an email option. - tests: service (enroll/send/verify/single-use/fail-closed), mail renderer + smoke matrix, kit challenge email flow, HTTP e2e. * feat: webauthn/passkeys as a second factor (plan 049 stage 2) - kind:'webauthn' rows store the registered credential (base64url id + public key, signature counter, transports) in parameters JSON. The ceremony rides @simplewebauthn/server (webauthn.ts); the relying-party context (rpId/rpName/origin) derives from publicUrl — the hosted /authorize origin (plan 041), so no per-RP plumbing (absent publicUrl -> refused). - registration: enroll returns creation options + a cached challenge (mfaWebauthnReg, 5-min) and an unconfirmed row; confirm verifies the attestation and stores the credential. authentication is kind-generic: challenge() surfaces request options under status.challenge.webauthn (caching the nonce), verify matches the assertion to its credential row, verifies against the cached challenge, and bumps the stored counter (replay defense). second-factor only. - kit: AMfaChallengeForm gains a passkey button (@simplewebauthn/browser startAuthentication, webauthn preferred first); enroll picker gains a passkey option (startRegistration -> confirm). - deps: @simplewebauthn/{server,browser} as stateless-leaf dependencies. - tests: service (enroll options + cached challenge, auth-options in challenge, fail-closed without rp, malformed attestation) + kit ceremony (mocked browser lib). * fix(mfa): address review — key validation, cipher construction, recovery atomicity - validate mfaEncryptionKey decodes to exactly 32 bytes at config time (normalize) instead of only truthiness — a wrong-length/whitespace key now fails loud at boot, not asynchronously at first encrypt/decrypt. - SymmetricCipher validates the key length synchronously in the constructor, so a bad key throws at construction (DI mount) rather than leaving an unobserved promise rejection. - resolveUserId throws BadRequestError when a non-user identity uses @me/@self, instead of letting the literal token match zero rows. - enrollRecovery reuses the existing recovery row via a single atomic save instead of delete-then-insert, so a mid-op failure can never leave the user with no codes. - verify-path concurrency/replay hardening (TOTP step reuse, recovery race, attempt-counter atomicity, session-stamp atomicity) tracked in #3237. Refs #3232 * fix(mfa): optimistic-lock + totp replay protection (#3237, schema half) Folds the schema-dependent hardening from #3237 into the still-unreleased auth_user_authenticators migration so no future migration is needed: - add a @VersionColumn (`version`) to the authenticator row (folded into 1783856507391-Default.ts, both dialects; run/revert/re-run verified on mysql + postgres). The verify path now consumes a factor exactly once under concurrency — a racing second save fails the version check, which the repository adapter translates to EntityConflictError and the service treats as a failed attempt (fixes recovery-code race, CR #602). - persist the last accepted TOTP step and reject any step <= it, closing the in-window replay window (RFC 6238 §5.2, CR #604). Tracked only on the login-verify path (not confirm), so a first login in the confirmation window still works. The two schema-FREE items from #3237 (attempt-counter atomicity via an ICache atomic-increment; cross-aggregate session-stamp) stay open there — deferring them needs no migration. Refs #3232 #3237 * test(mfa): use distinct totp steps for sequential verifies (#3237) The anti-replay step tracking rejects reusing one TOTP code for two successful verifications; the e2e now generates the password-grant otp from the previous ±1-window step so it stays behind the later challenge code. Refs #3232 #3237 * refactor(mfa): serialize verify with a per-user cache lock (#3237) Replace the @VersionColumn optimistic-lock guard on the MFA verify path with a per-user cache lock so a single factor (TOTP step / recovery code) is consumed exactly once under concurrency, without a schema column. Add ICache.add — atomic set-if-absent (Redis `SET … NX`, memory single-tick check-set) — as the lock primitive. Acquisition fails open so a cache outage cannot break MFA login; the TOTP step-counter and recovery `used_at` flags remain the correctness backstop. A held lock means another verify is mid-flight, so the request bails without penalty rather than risk a double-consume. Drop the version column from the entity, the core-kit domain type, and the still-unreleased 1783856507391 migration (both dialects). * fix(oauth2): emit amr/acr on the direct password and identity grants (#3233) The direct password (ROPC) and identity grants stamped `auth_method` on the session but issued tokens without the derived `amr`/`acr` claims, so a resource server receiving a direct-grant token could not read how the subject authenticated — unlike the authorization_code exchange, which already spreads `deriveAmrAcr(session)` onto its payload. Both grants now derive and spread the claims from the same session fields, mirroring authorize.ts. M2M grants (client/robot) are unaffected — `deriveAmrAcr` returns nothing for their methods. * refactor(core-kit): constrain auth_method to the SessionAuthMethod value-union (#3233) `Session.auth_method`, `OAuth2AuthorizationCode.auth_method`, the session TypeORM entity column, and the authorization-code issuer option were typed `string | null`, permitting invalid persisted values while downstream claim derivation only recognizes defined methods. Narrow all four to `` `${SessionAuthMethod}` | null `` (matching the existing `UserAuthenticator.kind` convention) so the type mirrors the actual value set. Pure type narrowing — every write site already passes a `SessionAuthMethod` member or null. * fix(client-web-kit): address MFA UI review feedback (#3234) - AUserAuthenticatorEnroll: add a Close action to the recovery-codes view so the user can return to the kind picker after generating codes (it previously stuck there — recovery enroll never reset the view, unlike the TOTP path). - AUserAuthenticators: confirm before deleting an authenticator via useAlertDialog — removing a factor is irreversible and weakens the account's security posture (matches the other destructive kit actions). - Authorize: retry the MFA challenge lookup once before failing open, so a transient blip does not permanently disable the client-side gate for the render lifecycle (the server /authorize backstop stays authoritative). - i18n(de): AUTHENTICATOR -> 'Authentifikatoren' (plural device noun, matching en/fr/es) instead of 'Authentifizierung' (the process). * fix(mfa): harden email-OTP factor per review feedback (#3235) - enrollEmail: update the existing email marker row in place instead of remove-then-create, so a failed save can never leave the user with no email factor (the row carries no secret/codes — an in-place update is equivalent). - verify: EMAIL has no persisted anti-replay backstop (its single-use rides on the verify lock + cache drop), so it must NOT ride the lock's fail-open path. acquireVerifyLock now reports acquired | busy | unavailable; EMAIL fails closed when the lock is unavailable (cache down), while TOTP/recovery keep proceeding on their persisted backstops. Only release a lock we actually hold. - sendChallenge: add a per-user send cooldown (atomic set-if-absent, fails open on cache error) so an authenticated caller cannot spray unlimited OTP mails; a resend within the window throws MfaThrottledError (429). - AMfaChallengeForm: emit the original exception through `failed` (was a string) so consumers can inspect status/context, matching AUserAuthenticatorEnroll; add a resend action to the email verification form (a delayed/expired code otherwise dead-ends the flow — the server cooldown backs it). * fix(mfa): harden webauthn factor per review feedback (#3236) - enrollWebauthn/confirmWebauthn: key the registration challenge by the new row id instead of the user id, so overlapping enrollment ceremonies (a second tab, a retry after a cancelled prompt) no longer overwrite each other's challenge and make the first confirmation fail spuriously. The row is created before the challenge is cached. - confirmWebauthn: apply the same brute-force throttle lifecycle as the TOTP confirm branch (assertNotThrottled / bumpAttempts on a credential-invalid / resetAttempts on success) — the attestation verify is a real crypto call and must not be retryable without backoff. - AUserAuthenticatorEnroll: require the server's WebAuthn registration options before startRegistration (clear error instead of an empty-object fallback that fails obscurely in the browser), and replace the `as never` cast with a documented assertion to PublicKeyCredentialCreationOptionsJSON. - AMfaChallengeForm: disable the passkey button when the challenge carries no webauthn options, so it can't present a dead button (the user switches factors instead). Tests: per-enrollment challenge keying + concurrent-ceremony isolation, and the webauthn confirm throttle. Also corrects two pre-existing webauthn cache assertions that passed vacuously (toBeDefined on a null miss / wrong key separator — buildCacheKey uses `#p#`, not `:`).
Part 2/5 of the MFA family (plan 050). Stacked on #3232 — targets
feat/mfa-authenticator-devices.What
Records how a subject authenticated and surfaces it as OIDC
amr/acr, plusacr_valuesstep-up.SessionAuthMethod(pwd|ldap|ext|client|robot) stamped at all five session-creation sites; the federated IdP callback threads it through the authorization-code blob so the/tokenfallback-create inherits it.amr/acronOAuth2TokenPayload, derived at the/tokenmint from the resolved session (deriveAmrAcr) —pwd/ext,+otpandacr=urn:authup:mfaoncesession.mfa_atis set. Emitted on every token kind (resource servers read the method without parsing an id_token); a pre-column session emits none./authorize(persisted on the code blob), advertised via discoveryacr_values_supported. Voluntary per OIDC Core §5.5.1.1 — unknown tokens ignored;urn:authup:mfaacts as a step-up trigger enforced only while the user holds a confirmed factor, requiringsession.mfa_atwithinmfaFreshnessMaxAge.Note on the default
mfaFreshnessMaxAgedefaults to 60s, deliberately not the plan's 0 — a 0-window could never absorb the hosted challenge round-trip and would loop the ladder. Documented + pinned by tests.Tests
deriveAmrAcrtable + step-up matrix, per-grantauth_methodstamping, discoveryacr_values_supported, and an end-to-end id_token/access-token claim-decode spec (pwd → mfa after a second factor).Summary by CodeRabbit
New Features
amrandacrclaims to access and ID tokens.acr_values.Configuration
Documentation