# Confirm an action and reauthenticate

Assess existing primitives and the proposed independent intent and authentication requirements.

Status: generic action confirmation remains a reviewed proposal. Version
**0.15.0** supplies the dedicated OIDC reauthentication and fresh
factor step-up primitives described below, not generic business enforcement.

## Current source boundaries

Foundation contains `ConfirmationMode.Simple`, `ConfirmationMode.Password` and
`RequireAuthConfirmationError` in `Fabricators.Kernel.Common`, plus its error
serialization/status mapping. These are wire contracts, not enforcement.
There is no generic action challenge issuer/store, endpoint requirement or
confirmation interceptor shipped with them. StrongAuthentication supplies
freshness/assurance checks and purpose-bound authentication proofs separately.

### OIDC-only users: dedicated reauthentication

Supplied in **0.15.0**; version 0.14.0 still has Login/Link only.
`OidcLoginPurpose.Reauthenticate` uses a server-owned context binding the current
subject/session, session-binding hash, already linked issuer/subject and operation
hash. It never matches by email, registers an account or links a provider.
`IOidcReauthenticationAuthority` must recheck live admission before redirect,
at callback and atomically with its product completion/audit. A product must not
register an allow-all adapter or accept these context records from browser JSON.

`OidcProvider.SupportsReauthentication` defaults to false. Opt in only after
validating the configured issuer's freshness capability. Missing capability or
authority fails with `Authentication.ReauthenticationUnavailable` before redirect;
callback rejection uses a no-store 403 `Authentication.ReauthenticationRejected`.
Cancellation/failure never clears the existing product session. No local password
is required, and unavailable methods must not produce a password/retry loop.

The bridge requests `prompt=login`, `max_age=0` and essential signed `auth_time`,
as specified by
[OpenID Connect Core](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest).
It requires actual provider authentication within the requested age and no earlier
than the intent minus a 30-second clock tolerance. It allows at most 30 seconds of
future skew and clamps that timestamp to the current instant. Comparisons use
DateTimeOffset instants; persisted/transmitted proof times normalize to UTC.
New callback/token issuance or account selection alone is insufficient. Provider
`amr`/`acr` does not automatically establish local MFA or phishing resistance.

After validated primary identity, a trusted host can call
`CompletePrimaryStepUpAsync` with credential/session epochs captured before the
ceremony. The host supplies the validated primary actor, exact current session
binding and provider authentication time. This mints an audited one-use StepUp
proof, not a login proof, and cannot satisfy a stronger MFA policy. Redemption
rechecks current freshness, assurance, methods and epochs. The host's atomic
completion must still bind the operation hash and fence concurrent revocation;
generic Foundation proofs alone do not authorize arbitrary business operations.

An enrolled passkey/TOTP can also renew proof freshness from an older admitted
session when `AuthenticationPolicy.AllowStepUpFromExistingSession` is explicitly
enabled. The host still validates the live session on every request; account
epochs, actual factor verification and proof freshness remain mandatory. This
opt-in does not relax enrollment, login or management freshness requirements.
Recovery is not an automatic sensitive-operation fallback. No path invalidates
all existing sessions implicitly. Live IdP and physical-device acceptance remain
separate from controlled protocol/software-authenticator tests.

## Two independent requirements

1. **Intent confirmation:** display the actual action/resource and optionally
   require its current name, identifier or another exact server-defined phrase.
   This reduces unintended actions; the phrase is not an authentication factor.
2. **Recent authentication:** require adequate fresh proof through the account's
   actual methods: password when present, passkey, MFA or an admitted IdP flow.
   Do not force a nonexistent local password on SSO/passkey-only users.

Represent these as combinable requirements, not an exclusive Simple/Password
switch. A destructive action may require both a typed resource name and fresh
phishing-resistant authentication; another operation may require only one.
Products own the requirement policy, resource admission and business effects.

GitHub's [sudo mode](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/sudo-mode)
uses recent authentication for sensitive operations and supports methods beyond
passwords. OWASP's [transaction authorization guidance](https://cheatsheetseries.owasp.org/cheatsheets/Transaction_Authorization_Cheat_Sheet.html)
calls for the user to acknowledge significant transaction data and for the
server to protect that data throughout authorization. Neither source defines
an interoperable resource-name-confirmation HTTP header standard.

## Recommended Foundation contract

Use an explicit endpoint/action requirement and a generic host error handler.
After normal session, authorization and CSRF checks, an unmet requirement should
return a no-store 403 challenge with a stable code and structured JSON. The BFF
handles it as an interactive continuation, not a generic network retry. No
business effect occurs before the challenge is satisfied.

The challenge identifies the action and its admitted resource, expiry and a
list of requirements/available verification methods. Resolve display names and
expected phrases on the server after authorization; do not accept a client-
selected expected phrase or expose inaccessible resource names through errors.

Submit credentials/typed input to a dedicated protected verification endpoint
using a JSON body. Reuse Foundation's authentication proofs instead of adding
a second password-verification path inside arbitrary business middleware. Do
not carry plaintext passwords in custom headers, URLs, logs or retry ledgers.
An action ticket is still sensitive even when opaque.

Return a short-lived one-use action ticket. The BFF may attach that ticket in
a dedicated header when resuming the original action. Keep passwords and other
one-time inputs transient; never automatically replay a write after a generic
401/403/timeout or keep prompting indefinitely on validation failure.

Bind the ticket to the trusted authority/user/session and admitted tenant/
company, action/resource ID and version, semantic payload and all significant
query inputs. Include the stable operation/idempotency key where relevant.
The product supplies this canonical binding; raw method/path alone is not
sufficient. Revalidate current permission and resource state at consumption.

Use an atomic durable consume with bounded expiry/attempts and rate/cooldown
limits spanning replacement challenges. Coordinate with the owning transaction
and idempotency receipt: one-use authentication is not exactly-once business
execution, and consuming a ticket must not make a lost response unrecoverable.
Changed input/resource state requires a fresh challenge; reuse of the same
operation key must not create a second effect.

## Acceptance before implementation/release

Test typed-text mismatch, rename/version change, foreign actor/session/tenant,
changed body/query/operation, expiry and concurrent/replayed consumption.
Verify wrong/cancelled/expired authentication, SSO/passkey-only users, CSRF,
cross-challenge attempt limits, revocation and authorization changes. Exercise
lost response/transaction rollback/idempotent recovery through the real BFF.
No global session invalidation is implied by confirming an action; revocation
remains an explicit product policy.
