Keycloak step-up authentication with ACR and levels of authentication

Step-up authentication asks for a stronger login only when a user reaches a sensitive action. This page covers how Keycloak maps ACR values to levels, how flows enforce them and how applications request and check them.

On this page

Keycloak step-up authentication: when a sensitive action needs a stronger login

Step-up authentication asks for a stronger login only when a user reaches a sensitive action, such as a payment, an administrator change or a bulk data export, instead of forcing every session through the same second factor. Most sessions in such an application can stay on a normal login, while the few actions that carry risk trigger a higher assurance check. In Keycloak, this is expressed through authentication context class reference (ACR) values, which the server maps to levels of authentication (LoA). An application requests the level it needs, and Keycloak runs the flow required to reach it. The step-up is then recorded in the token, so the resource server can check it before acting.

In Keycloak, an ACR is a short identifier for a level, such as 1 for a password login and 2 for a login with a second factor, and the realm maps each value to an LoA number through the realm's ACR to LoA mapping setting. The authentication flow then uses the Conditional - Level Of Authentication sub-flow, which runs its child steps only when the requested level is above the level already reached. Applications ask for a level by sending the acr_values parameter in the authorization request. Resource servers should then check the acr claim in the access or ID token, rather than trusting that the request was honored. Confirm the exact flow names and mapping behavior in the Keycloak version you run, because the server administration guide is the reference for these settings.

A blanket MFA rule is simpler to operate and is often the right answer when every session carries similar risk. Step-up earns its extra design work when the application has a clear split between routine and sensitive actions, and when users would otherwise be prompted too often. Before you choose, list the actions, the levels each one needs, which clients call them, and how the resource servers will enforce the acr claim. Then confirm in your environment how sessions, token lifetimes and re-authentication interact, because a recent login can satisfy a step-up request without a new prompt. Plan the test cases for each path, including ones where a user has no second factor enrolled.

Step-up configuration options and when each fits

This table compares the main ways to structure step-up authentication in Keycloak, from one level for all sensitive actions to tiered levels, per-client mappings and fresh re-authentication versus accepting a recent MFA event. Read each row for the fit, the user impact and the upkeep it creates, then match the option to how many sensitive action types your applications really have. The main takeaway is that more levels give finer control but add flow, mapping and testing work that grows with every application.

OptionBest fitTrade-off for usersOperational cost
One level for all sensitive actionsA small number of sensitive actions across few applications, where one strong login is enoughUsers repeat the same strong login for every sensitive action, which can feel heavy if actions vary widely in riskLow: one flow, one ACR value and one check per application. Confirm that every application handles the same fallback
Several levels for tiered actionsOrganizations with clearly different risk tiers, such as viewing records versus changing payment detailsUsers see stronger prompts only for the highest tier, but must understand why different actions ask for different stepsMedium to high: each level needs a mapping, a flow branch and tests in every client that requests it. Ask who owns the level definitions
Per-client level mappingsSeveral applications with different assurance needs that share one realmUsers may see different requirements when they move between applications, so messaging should be consistentMedium: each client needs its own acr_values and expected claim checks. Changes to one client must be reviewed against the others
Forced re-authenticationActions where the user must prove presence at that moment, such as signing a transaction or changing credentialsHighest friction: the user signs in again even if they just completed MFA, so use it for the smallest set of actionsMedium: needs reliable max_age or prompt handling in each application and clear error paths when the user declines
Accepting a recent MFA eventSensitive actions that follow a recent strong login within a short window, where repeated prompts add little safetySmoother for users, but the window must be short enough that a session left open does not carry an old strong login into a risky actionMedium: depends on the age check in the token and on tuning the window per level. Test expiry behavior in every client
Session and token lifetimes as a supporting controlAny design that relies on recent authentication time, so applications can judge freshnessShorter lifetimes add sign-in prompts, longer lifetimes weaken the freshness checkOngoing: lifetimes must be reviewed when levels change. Confirm current defaults in the Keycloak server administration guide for your version

Setting up step-up in a Keycloak realm

This sequence turns step-up from an idea into a tested realm configuration: named authentication levels, a browser flow that enforces them, clients that request them, and tokens that prove which level was reached. Each step ends with a check so the team can confirm the behavior before any sensitive action depends on it.

  1. Define levels and the actions that need them

    Before touching the admin console, the security owner and application owners agree on a short list of authentication levels, for example a baseline password plus one factor and a stronger level that requires a phishing-resistant second factor. For each level, list the sensitive actions it protects, such as changing payout details or viewing regulated records, and the applications that perform them. Write the mapping down with the ACR value each level will use, because every later step depends on it. The step is done when each sensitive action maps to exactly one level and the owners have signed off on the table.

  2. Map ACR values to authentication levels

    In the realm, set the realm's Browser flow and define the ACR to LoA mapping so each ACR string resolves to a numeric level. Keep the values identical to the table from the previous step, since applications will send the same strings. Confirm in the realm settings that the mapping saves and that the levels are ordered so that a higher number means a stronger requirement. The check is a read-back of the mapping in the admin console or the realm export, compared line by line with the agreed table.

  3. Add Conditional Level of Authentication to the browser flow

    Copy the built-in browser flow so the default remains untouched, then add a conditional sub-flow after the username and password step. Inside it, add the Condition - Level Of Authentication execution and set it to require the stronger level, then add the authenticator for the required factor under the same sub-flow. Set the conditions so that the factor is only requested when the requested level is higher than the one already reached. Make the sub-flow required or conditional as your design says, and bind the flow to the realm. The check is a flow diagram review with the realm administrator, confirming no step can be skipped by reordering.

  4. Bind the required factor to each level

    Decide which authenticator satisfies each level and make sure the users who will need it can actually enroll. For a stronger level, this is often a WebAuthn or passkey credential, which requires the WebAuthn policy to allow it, or an OTP credential with a set OTP policy. Confirm that required actions for enrollment exist for users who lack the factor, and document the fallback for users without an eligible device. The check is a test user with no enrolled factor who is prompted to enroll at the stronger level and cannot reach the sensitive action without doing so.

  5. Configure clients to request acr_values

    For each application that performs a sensitive action, configure the client or the application's authentication library to send the acr_values parameter in the authorization request with the ACR string for the required level. Keep the normal sign-in request on the baseline level so ordinary users are not prompted for more than they need. The application should also handle the case where the returned token does not meet the level and send the user back through login rather than proceeding. The check is a browser trace of the authorization request showing the expected acr_values on the sensitive path and not on the baseline path.

  6. Test a login at each level

    Sign in as a test user at the baseline level and confirm that the sensitive action is refused or redirected to step-up. Then trigger the sensitive action, complete the stronger factor, and confirm the action succeeds only after the second factor is presented. Repeat with a user who has the factor enrolled and with one who does not, and record which login path each takes. The check is a written test log covering each level, each user state and the expected redirect, reviewed by the application owner before release.

  7. Verify the acr claim in issued tokens

    Decode the ID token and access token from the stronger login and confirm the acr claim carries the expected value, and that the baseline token carries the lower value. Check that the application's resource server reads acr and rejects tokens below the required level, not only the client UI. Confirm the token lifetime and any session reuse behavior your design depends on, because a reused session can carry an earlier acr. The check is a decoded token sample for each level, stored with the test log, showing the acr value that the resource server enforces.

Security risks in acr-based step-up

Step-up only protects a sensitive action if the application checks the authentication level it actually received and Keycloak enforces that level on every path. The cards below cover the failure modes that break that chain, each with the control that addresses it and the test that proves it works.

Unverified acr values in applications

An application that reads the acr claim from an ID token or access token without checking its signature, issuer, audience and expiry can be handed a level the user never reached. Validate the token with a standard OIDC library first, then compare acr against the level the action requires. Test by replaying a token issued at a lower level against the sensitive endpoint and confirming it is refused.

Keycloak docs

Flow paths that skip the level check

A browser flow can contain more than one route to a successful login, and a branch added later for a password reset or a fallback method may never reach the level condition. Review every execution in the authentication flow and every client-specific override, then confirm each path ends at a step that enforces the required level. Test each route to the sensitive action with a fresh session.

Stale sessions at a lower level

An SSO session created at a low level stays valid until it expires, so a user who signed in earlier can reach a sensitive action without a new prompt if the application accepts the existing session. Decide the maximum session age for each sensitive client and force reauthentication with max_age or a prompt when the level is not fresh. Test by holding a session at the lower level past the window and checking that the step-up appears.

Weak factors mapped to high levels

Mapping a level to a factor that is easy to phish or to reuse, such as an SMS code or a shared TOTP secret, gives the application a high acr value that does not reflect the real assurance. Map levels only to factors that meet the requirement, and keep phishing-resistant factors such as WebAuthn for the highest level. Test by completing a login with each factor and checking the acr value that reaches the token.

Client requests that Keycloak ignores

If an application sends acr_values but the realm has no matching level mapping, the request may succeed at a lower level or fail in a way the application does not handle. Confirm which level Keycloak returns for each requested value and make the application treat a missing or lower acr as a failed step-up. Test with unknown values, missing values and multiple values in the request.

Step-up design by application type

A server-rendered web app is the simplest case because the backend already owns the session and performs the redirect to Keycloak. When a user opens a sensitive page, the application starts a new authorization request with acr_values set to the level that page requires. Keycloak then runs the browser flow again to collect the missing factor, and the application receives a new code and new tokens. The check runs on the server when the callback arrives, so the decision never depends on what the browser reports.

  • Request on demand: Send acr_values only on the step-up request, so routine pages keep the normal login flow.
  • Check on the callback: Read the acr claim in the ID token and reject the sensitive action if the value is below the required level.
  • Record the level in the session: Store the achieved level and the time it was reached in the server-side session, so later requests can tell whether the step-up is still recent enough.
  • Preserve the return path: Keep the target URL and the state parameter across the redirect so the user returns to the action they started.

Before release, test one sensitive action with a session that holds only the basic level and confirm the application refuses it.

Step-up authentication questions buyers ask

What drives the cost of step-up authentication in Keycloak?

The cost follows the amount of work that has to be defined, built and tested, and the main drivers are the number of sensitive actions, the number of applications that request stronger logins, the factor types in use and the testing scope. Each sensitive action needs an agreed level of assurance, a matching authentication flow path and a test case that confirms the step-up prompt appears and that lower-assurance sessions are refused. Applications multiply that work because each one has its own client configuration and its own way of requesting acr_values. Factor types matter because password plus OTP, passkeys and security keys each need different policy settings and enrollment handling. Ask any quote to list each cost component separately, to state which items are one-time and which recur, and to name the applications and actions in scope. DeployOpen does not publish a price list, so a quote follows from the written scope.

Can an internal team build Keycloak step-up authentication alone?

Yes, a team with Keycloak administration experience and access to a test environment can build it, provided it has time to learn how authentication flows, the Conditional - Level Of Authentication execution and the acr claim interact. The difficult part is rarely the first configuration. It is confirming that every route to a sensitive action passes through the step-up check, that applications send the right acr_values, and that tokens carry the claim your resource server expects. Teams without that verification experience often find gaps only after a release. An internal team should plan for application owners to make code or client changes, for an identity owner to sign off on the level mapping, and for someone to write negative tests. A partner can take on the design, build and test work as a fixed scope, while your team keeps ownership of the decisions.

How long does validation take for step-up authentication?

Validation time depends on how many flows, clients and sensitive actions must be tested, and no duration should be assumed before the scope is written. A small pilot with one application and one sensitive action is far quicker to validate than a rollout that covers several applications, several realms and several factor types. Validation should include positive tests where the user completes the stronger login, negative tests where a session without the required level is sent back to authentication, and bypass tests that try to reach the protected action through alternate clients, direct grant paths or stale sessions. Ask for the test matrix in the quote, the number of test rounds included, and how retesting after a Keycloak minor upgrade is handled. Keycloak plans four minor releases a year, so the retest plan matters for ongoing operations.

What does the work need from our team before it starts?

The work needs three groups of input: application owners, identity policy decisions and test accounts. Application owners must list the sensitive actions in their application, confirm which API or resource server checks the acr claim, and agree how the application will request acr_values and handle a step-up redirect. Identity and security leads must decide which level of assurance each action requires, which factors count for each level, how long a stronger session should remain valid, and what happens when a user has no enrolled factor for the required level. Test accounts are needed at each assurance level, including users with only a password, users with OTP, users with a passkey and users with no second factor, so that every path can be checked. Agree these inputs in the written scope so the quote and timeline reflect real decisions rather than assumptions.

Which Keycloak version should step-up authentication be built on?

Build on the version your organization has approved for production, and confirm the current release and its upgrade notes with the Keycloak project before you start. The current Keycloak release supplied for this page is 26.8.1, published October 13, 2026, and the 26.8 upgrade notes cover items such as login failure persistence and SMTP StartTLS enforcement that can affect operations around the flow. Since Keycloak 26.0, minor releases can carry breaking changes only as opt-in settings, which lowers upgrade risk but does not remove the need for a retest. Ask for the target version in the written scope, and ask how the authentication flow and client configuration will be exported so they can be reviewed and reapplied after an upgrade.

Can DeployOpen take over step-up authentication after go-live?

DeployOpen can support the platform after go-live through a retainer, and ongoing support, upgrades and continuous testing are available that way. Ongoing support typically covers reviewing changes to flows and client scopes, retesting after Keycloak upgrades, adding new sensitive actions as applications change and maintaining the documentation your operations team uses. Ask the quote to state what is covered, how change requests are scoped, how retesting is triggered and who approves changes to the level mapping. Ownership can also be transferred in stages: your team can take over routine changes after a handover while DeployOpen remains available for upgrades or new applications. Confirm the handover terms in writing before the engagement begins.

What goes wrong most often with acr values and token checks?

The most common failure is trusting an acr claim that the resource server never verified, so a session that only met a lower level can still reach a sensitive action. Other frequent problems include a client that omits acr_values, so the user never sees a step-up prompt, a mapping that accepts a level higher than the factor the user actually used, and a flow that works in the browser but is bypassed by a direct token request. Stale sessions can also keep an old assurance level after a user has changed their factors. Engineers should check the token for the expected acr value and the auth_time claim, confirm the resource server rejects tokens below the required level, and test each client path separately. Treat the level mapping as a security control that needs review whenever a flow or factor changes.

Does step-up authentication satisfy a specific compliance requirement?

Step-up authentication can help your organization meet access control and authentication requirements, but it does not by itself satisfy any framework, and DeployOpen does not issue audit reports or certifications. Auditors look for evidence that stronger authentication is required for defined sensitive actions, that the requirement is enforced in the system rather than only in documentation, and that changes are tested and approved. DeployOpen can prepare the configuration, test results and change records that your compliance team and independent auditors review. Ask your compliance lead which controls apply to your sensitive actions before the scope is written, so the evidence plan matches what assessors will request.

Limits to confirm before you commit

Step-up designs depend on five things that vary by environment: the Keycloak release, how factors map to levels, what the application library sends, whether the client checks the result, and what upstream providers report. Confirm each one in a test realm before you write the flow into production.

Keycloak release in use

Confirm the exact Keycloak version you run, then read the upgrade notes for that line before relying on level-of-authentication behavior. The project publishes four minor releases a year, and breaking changes in a minor release are opt-in, so a flow that works today can behave differently after an upgrade. Record the version in your design document so the test evidence matches what runs in production.

Current release
26.8.1
Upgrading guide

Factor to level mapping

Decide which authentication methods satisfy each level, such as a password alone for a low level and a second factor or passkey for a higher one. Test every method your users can actually enroll, because a method that is available but mapped to the wrong level silently grants access it should not. Confirm how the level condition is evaluated in the flow you build, and rerun the test paths after any change to the flow.

Application library support for acr_values

Check that the OIDC library your application uses can send the acr_values parameter on the authorization request and expose the acr claim after login. Some libraries pass extra parameters only through custom configuration, and others discard unknown claims. Ask the library maintainer or read its documentation, then confirm with a request capture that the parameter reaches Keycloak unchanged.

Client-side enforcement of the claim

Confirm that the application or API rejects a token whose acr value is lower than required, instead of only requesting a higher level at login. A client that accepts any valid token will let a session from a weaker login perform a sensitive action. Also check how long a stepped-up session stays valid, since a token issued before the step-up may still be reused.

Upstream identity provider context

If users sign in through a brokered identity provider, find out whether that provider reports its own authentication context and how Keycloak maps it. A provider may not report a level at all, or may report a level that does not match your policy. Test a sensitive action with a brokered user and record which level Keycloak assigns, so the step-up rule does not rely on an assumption about the upstream login.

How a step-up request moves through Keycloak and the application

The flow starts when a user selects a sensitive action in the application, which sends an authorization request carrying acr_values. Keycloak runs the browser flow, and its Conditional Level of Authentication step decides whether the session already meets the requested level or needs an extra factor. Keycloak then issues tokens with the acr claim, and the application checks that claim before it completes the action. Check that the claim value matches your level mapping, not just that a token exists.

Sequence of a step-up login from a sensitive action to a checked acr claim.

Testing step-up and keeping it correct after upgrades

The core point of this section is that step-up is only as good as the tests that prove every sensitive path asks for the required level. Build a test matrix with one row per sensitive action (for example, changing the email address, adding a payment destination, or exporting records) and one column per level the realm defines. For each cell, run a fresh login, a login where the session already holds a lower level, and a login where the session already holds the required level. Confirm that the sensitive action succeeds only in the last case, or after the user completes the extra factor. Add cases for an expired SSO session, a refresh token used to call the protected endpoint, and a client that requests no acr_values at all. Those last paths are where step-up most often fails open, because the application trusts a token it never checked for the acr claim. Also test the reverse: a user who already holds a higher level should not be prompted again.

Once the tests pass, treat the authentication flow as code that changes when Keycloak changes. Export the flow and the ACR-to-level mapping after every change and store them in version control, so a diff shows exactly which condition or level moved. During a Keycloak upgrade, read the upgrade notes for the target release before rolling it out, rerun the full matrix against a staging realm restored from a recent backup, and compare the exported flow with the pre-upgrade copy. Confirm that the Conditional - Level Of Authentication execution and the level mapping survived, because a flow that silently changed can skip the step-up check without any error. The same version-controlled export lets your security team review changes in the same way they review application code.

Operations is where step-up quietly degrades. Log authentication events and review them for each step-up attempt, including failures, timeouts and cancelled second factors, so a spike in failed attempts against one sensitive action is visible. Set alerts on those events rather than relying on someone to read logs. Ask your partner or internal team to confirm which event types your Keycloak version records for authentication and admin changes, and where those events are sent. Keep the test matrix as a standing regression suite that runs after each flow edit, client change or Keycloak upgrade, and record the results as evidence of ongoing control operation for internal and external reviewers.

How DeployOpen scopes and delivers step-up authentication

Step-up work starts with a written scope, not a flow diagram. DeployOpen agrees the scope, deliverables and timelines in writing before any configuration begins. The first working session maps the sensitive actions with your team: changing a payout account, approving a transfer, viewing patient records, rotating API keys, or reaching an admin console. For each action, you decide which level of authentication it needs, which applications trigger it, and which users are affected. That map becomes the acceptance baseline, so the quote reflects the number of actions, applications and user groups rather than a generic Keycloak installation.

Implementation then follows that map. DeployOpen configures the authentication flow that uses Conditional - Level Of Authentication, sets the ACR-to-level mapping in the realm, and adds the application-side checks that request acr_values and reject tokens whose acr claim is too weak. Each sensitive path is tested with a negative case, such as a session that signed in with a password alone attempting the protected action, so the team can see that no route skips the step-up. Testing also covers the less obvious paths: refresh tokens, sessions that already meet a level, and fallback login screens. The configuration, flow names, mappings and test results are documented so your engineers can review and rerun them.

After handover, the flows still need care. Keycloak changes across releases, so an upgrade can alter how authentication flows or ACR handling behave, and your application libraries have their own version lifecycles. DeployOpen offers retainers for ongoing support, upgrade testing and periodic retesting of the step-up paths. Ask any provider to confirm in the written scope which deliverables, environments and retest cycles are included, and how changes requested after go-live are priced. DeployOpen prepares configuration and evidence for your compliance and audit teams, but it does not issue audit reports, attestations or certifications, which independent auditors and certification bodies provide.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.