# Require MFA proof from a federated identity provider

**Last updated:** 2026-11-21T10:44:38-03:00 (UTC-3)

Use an explicit assurance policy to require stronger authentication on a configured OIDC or SAML console login. The gateway verifies signed proof from the identity provider before granting a session; a successful SSO redirect, a requested authentication context or a configured feature flag is not proof of MFA.

This feature covers federated login only. Local named-user credentials and the bootstrap recovery login remain separate paths. Native TOTP, passkeys and recovery codes are delivered separately: see [native MFA](/docs/features/native-mfa/). Preserve an authorized recovery administrator before changing federation.

**Qualification:** the real Keycloak26.7.5 profile passed on two native gateway replicas with PostgreSQL and Chrome: password-only signed OIDC/SAML proof was denied, actual password + OTP admitted the linked viewer, and policy/flag changes revoked matching sessions without reviving saved cookies. Named and legacy OIDC plus SAML were exercised; an unprotected password-only neighbor retained its existing behavior. The Settings editor also passed real API write/readback and stable desktop1440/mobile390 inspection without hidden fields or horizontal overflow. This is focused T086.001 qualification, separate from final complete-branch release qualification. Microsoft Entra MFA-specific certification is pending a licensed/configured Conditional Access tenant. Earlier Google/Microsoft sign-in qualification does not certify MFA.

## Defaults and policy semantics

| Parameter | Default | Meaning |
| --- | --- | --- |
| `features.federated_mfa` | `false` | Operator switch for enforcing configured requirements |
| `admin.federated_mfa` | `[]` | No provider requirements configured |
| `admin.federated_mfa[].provider_id` | Required | Existing named OIDC ID, `oidc` for the legacy singleton, or `saml` |
| `admin.federated_mfa[].oidc.context_claim` | `acr` | Inspect the signed scalar `acr` or explicit signed array `acrs` |
| `admin.federated_mfa[].oidc.allowed_acr` | `[]` | At least one exact listed context must match when configured |
| `admin.federated_mfa[].oidc.required_amr` | `[]` | Every listed method must appear in signed `amr` when configured |
| `admin.federated_mfa[].saml.allowed_authn_contexts` | Required | At least one exact allowed class reference |
| `admin.federated_mfa[].oidc.max_auth_age_seconds`, `admin.federated_mfa[].saml.max_auth_age_seconds` | `null` | Optional freshness at callback; `null` omits the age condition |

A policy has exactly one `oidc` or `saml` object. OIDC requires at least one context or method requirement: freshness alone is not MFA. Configured context and method dimensions combine with **AND**; context alternatives use **ANY**, required methods use **ALL**. Values are case-sensitive, bounded, unique and matched exactly. There is no inferred ordering between assurance strings, no role assignment from claims and no automatic interpretation of arbitrary method names as two factors.

The operator must configure the IdP so an admitted context or method combination actually requires the intended factors. For example, an AMR mapper must report authenticators the user completed, rather than attach a constant `mfa` claim to every login. Accepting `pwd` alone does not establish a strong-authentication policy.

A provider without a requirement retains its existing authentication behavior. A provider with a configured requirement **denies login and its affected sessions when `federated_mfa` is off**. Turning the flag off is not a way to bypass a required factor. Authorized administrators can still inspect, stage or revert policies while the runtime switch is off.

The catalog exposes limits: at most 10 policies, 16 contexts or methods per list, 256 UTF-8 bytes per nonempty value, and authentication age from 0 to 86,400 seconds. A provider can appear only once and must already exist in the trusted configuration. This feature never creates an IdP, cloud application, user or provider trust.

## Declare a requirement

After configuring an existing named OIDC provider `work` and its explicit user links, add:

```yaml
features:
  federated_mfa: true
admin:
  federated_mfa:
    - provider_id: work
      oidc:
        context_claim: acr
        allowed_acr: []
        required_amr: [pwd, otp]
        max_auth_age_seconds: 300
```

This example requires both actual password and OTP authenticator references from the trusted IdP. It is not portable merely because another IdP uses the same words. For Keycloak, configure the authentication executions' reference values and the built-in AMR protocol mapper for ID tokens. Do not use a static user attribute as proof that an OTP challenge occurred.

To use context instead, configure an IdP flow that binds a reviewed context to strong authentication and set `allowed_acr` to its exact returned value. Both dimensions can be configured if the IdP emits both. Missing, wrongly typed or insufficient signed proof denies the login.

For an existing SAML provider whose authentication flow genuinely requires the configured assurance context:

```yaml
admin:
  federated_mfa:
    - provider_id: saml
      saml:
        allowed_authn_contexts: [https://refeds.org/profile/mfa]
        max_auth_age_seconds: 300
```

Combine policies in the same list. The URI must be supported and correctly bound by your IdP; this example does not add that mapping. The gateway requests exact context comparison and verifies the returned class inside the selected signed assertion. Ambiguous statements or contexts are rejected; no favorable statement is selected from several alternatives.

## Configure an IdP that reports completed factors

For the Keycloak profile used in qualification, the browser flow has a level-one subflow that executes the username/password authenticator and a level-two subflow that executes the OTP authenticator. Both levels use the conditional level-of-authentication execution. Map the OIDC client contexts `silver` to level1 and `gold` to level2; configure the strong request to require `gold`. Users must enroll their own OTP credential through the IdP's protected enrollment procedure before using that strong flow.

Set the completed password authenticator's reference value to `pwd`, the completed OTP authenticator's reference value to `otp`, and add Keycloak's built-in AMR mapper to the **ID token**. Add its ACR mapper for the achieved context. Configure the gateway with `allowed_acr: [gold]` and `required_amr: [pwd, otp]`. This requires both the achieved level and the executed methods, rather than a constant user attribute. Keycloak's administrative API may mask authenticator reference settings; a masked read is not evidence of completed authentication.

For SAML, bind PasswordProtectedTransport to the password level and `https://refeds.org/profile/mfa` to the OTP level in the client's context-to-level mapping, enable the achieved-context mapper and sign both the response and assertion as required by the [SAML profile](/docs/features/saml/). The gateway policy accepts only the strong URI. An unsigned change to the outbound request must never make the gateway accept a weaker signed response.

These mappings are operator choices for an IdP flow whose authenticators were reviewed. They do not establish equivalent strength on another product or version. Validate actual password-only denial, real OTP success and the resulting current local-user session before enabling the policy for production users. Keep a separate authorized recovery path available.

## Authentication freshness and session lifetime

OIDC freshness uses signed `auth_time`; SAML uses the signed authentication statement's `AuthnInstant`. Token issue time (`iat`), local browser time, userinfo and unsigned attributes are not substitutes. The requirement is checked at callback with the documented 30-second clock-skew allowance, independently of signature, audience, nonce/state, current user and provider-generation checks.

`max_auth_age_seconds: 0` requests fresh authentication; it does not disable the condition. OIDC sends `max_age=0`; SAML requests `ForceAuthn` when an age requirement is present, since SAML has no identical `max_age` request parameter. The gateway still verifies the returned signed proof. An IdP that ignores a request hint cannot thereby bypass admission.

This is a **login-time freshness** condition. It does not shorten the existing local session lifetime or silently implement periodic step-up on every console action. Policy, account, role and revocation changes continue to apply to live authority.

## Console and API management

In **Settings & sources**, use the dedicated federated MFA policy editor beside the existing federation controls. Only a built-in global administrator with `federated_mfa:manage` can access this private catalog. A feature flag never grants that permission. The editor presents only already configured providers and their supported protocol, plus effective policies, YAML/console source, runtime-switch state and write authority.

The separate catalog preserves the existing OIDC and SAML policy DTOs:

| Method | Versioned route | Action |
| --- | --- | --- |
| GET | `/api/v1/admin/security/federated-mfa` | Read declared/effective/override policies, limits, defaults, source, epochs and access |
| PUT | `/api/v1/admin/security/federated-mfa` | Replace the complete policy list |
| DELETE | `/api/v1/admin/security/federated-mfa` | Remove an existing console override and restore the YAML base |
| POST | `/api/v1/admin/security/federated-mfa/adopt-base` | Explicitly acknowledge the reviewed declared base |

Mutation bodies use strict JSON with a 256 KiB limit (`413` when exceeded). Mutations require the current global control `version`, `expected_base_fingerprint`, same-origin session/CSRF and current write authority. GET the catalog immediately before preparing a mutation. PUT uses `{version, expected_base_fingerprint, federated_mfa}`; revert/adoption use the two guard fields only. The **API access** page provides runnable examples that read the current guards instead of embedding a fictitious version.

A version/base conflict is `409`: reload and review before resubmitting. Malformed or noncanonical input, duplicate policies and structural/bounds violations are `400`; otherwise canonical policies incompatible with current provider references/configuration are `422`; unauthorized access is `403`; missing current authority/storage is `503`. If a mutation committed but synchronization is pending, read the current catalog before deciding whether to retry. A successful write returns `204` and is audited with request/trace correlation. There is no raw token, OTP, assurance-claim payload or provider credential in the catalog.

## Revocation and upgrades

MFA authority uses a durable per-provider epoch. Newly issued federated session markers bind provider, epoch and the existing inner identity. Each federated session read and RP logout consults current database authority, including a process whose captured configuration has no requirement; another replica cannot silently bypass a newly added policy.

Policy changes and relevant flag transitions revoke affected flows/sessions. Removing a policy or restoring a flag does not revive older cookies. Before a provider has ever acquired MFA policy, pre-upgrade unwrapped sessions can retain the prior compatibility path; after its epoch advances, those older markers remain denied. Other providers and the local recovery path retain their own authority checks.

Upgrade every gateway replica while quiesced before activating this policy. Older binaries neither enforce these requirements nor understand the new federated marker. Back up the database and preserve session/encryption trust as described in the [operations guide](/docs/operate/operations/). A rollback must follow the documented migration/authority procedure; do not run older writers against the changed schema or present a mixed-version rollout as MFA protection.

## Microsoft Entra-specific boundary

The native Microsoft sign-in profile uses a tenant-specific public-cloud v2 issuer. That alone does not establish MFA. Microsoft documents authentication contexts through the signed optional `acrs` claim; a context may be satisfied without an attached Conditional Access policy, so its mere presence is insufficient.

For `context_claim: acrs`, the tenant administrator must bind each permitted context to an **enforced** Conditional Access MFA or authentication-strength policy, assign the intended application/account and configure the relevant ID-token claims. Tenant/account licensing, administrator rights, consent and registered factors are operator prerequisites. No Graph lookup or role promotion supplies missing proof.

The available test tenant had no subscribed SKUs for this validation. The owner accepted real Keycloak qualification and left Entra MFA vendor certification pending. This does not remove the already tested Microsoft login, and it does not claim that an untested tenant policy works.

Use [Microsoft's authentication-context guide](https://learn.microsoft.com/en-us/entra/identity-platform/developer-guide-conditional-access-authentication-context) and [optional-claims reference](https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims-reference). The standard claim semantics are in [OpenID Connect Core](https://openid.net/specs/openid-connect-core-1_0.html). Configure [named OIDC trust](/docs/features/oidc-providers/), [Google/Microsoft login](/docs/features/oidc-vendors/) and [SAML trust](/docs/features/saml/) separately from these assurance requirements.
