RFC 9470 OAuth 2.0 Step Up Authentication Challenge Protocol
- Home
- RFC 9470 OAuth 2.0 Step Up Authentication Challenge Protocol
Overview
RFC 9470: OAuth 2.0 Step Up Authentication Challenge Protocol “introduces a mechanism for a resource server to signal to a client that the authentication event associated with the access token of the current request doesn’t meet its authentication requirements and specify how to meet them.” (excerpt from “Abstract”) As the first step, a client application (a.k.a. relying party) accesses a protected resource endpoint with an access token.
The implementation of the endpoint extracts the access token from the request.
Next, the implementation of the endpoint extracts information about user authentication (which the authorization server performed during the course of issuing the access token) from the access token.
Then, the implementation of the endpoint checks whether the information about user authentication satisfies authentication requirements that the endpoint imposes.
If the requirements are not satisfied, the implementation of the endpoint returns an error response to the client application with information about the authentication requirements.
The diagram below illustrates the flow from making a request with an access token to returning an error response with authentication requirements.
After receiving an error response with authentication requirements, the client application will make an authorization request again. This time, the client application needs to ask the authorization server to issue an access token that satisfies the authentication requirements.
Authentication Requirements
The OAuth 2.0 Step Up Authentication Challenge Protocol specification presumes two types of authentication requirements. One is authentication context class reference (a.k.a. ACR) of user authentication. The other is maximum authentication age (a.k.a. max age) of user authentication.Authentication Context Class Reference (ACR)
User authentication is performed somewhere during an authorization flow. OAuth 2.0 and OpenID Connect do not define details about how to authenticate users, but client applications can specify criteria of user authentication by including a list of ACRs in an authorization request. The authorization server tries to perform user authentication that satisfies at least one of the specified ACRs. However, no error is reported even if the authorization server cannot perform such user authentication unless theacr claim is requested as “essential” (described later).
The acr_values Request Parameter
There are three ways to specify a list of ACRs. The first way is to use the acr_values request parameter. The parameter is defined in Section 3.1.2.1 of OpenID Connect Core 1.0 as follows.
acr_values: OPTIONAL. Requested Authentication Context Class Reference values. Space-separated string that specifies theacrvalues that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as theacrClaim Value, as specified in Section 2. TheacrClaim is requested as a Voluntary Claim by this parameter. The value of theacr_valuesrequest parameter is a space-separated list of ACRs. It appears in an authorization request like the following. https://as.example.com/authorize?acr_values=acr1+acr2+acr3&…The
The second way to specify a list of ACRs is to use theclaimsRequest Parameterclaimsrequest parameter. The parameter is defined in Section 5.5 of OpenID Connect Core 1.0. The parameter takes a JSON object as a value and the syntax of the JSON is complex. The following JSON is an example value of theclaimsrequest parameter excerpted from OpenID Connect Core 1.0.Theacr_valuesrequest parameter cannot request theacrclaim as essential.The
The last way is to use thedefault_acr_valuesClient Metadatadefault_acr_valuesclient metadata. The metadata is defined in Section 2 of OpenID Connect Dynamic Client Registration 1.0 as follows.default_acr_values: OPTIONAL. Default requested Authentication Context Class Reference values. Array of strings that specifies the defaultacrvalues that the OP is being requested to use for processing requests from this Client, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as theacrClaim Value in the issued ID Token. TheacrClaim is requested as a Voluntary Claim by this parameter. Theacr_values_supporteddiscovery element contains a list of the supportedacrvalues supported by this server. Values specified in theacr_valuesrequest parameter or an individualacrClaim request override these default values. When an authorization request does not specify a list of ACRs explicitly, the value of thedefault_acr_valuesis, if set, used as a list of ACRs. Thedefault_acr_valuesclient metadata cannot request theacrclaim as essential.Unmet Authentication Requirements
If theacrclaim is requested as an essential claim, the authorization server returns an error response when none of specified ACRs can be satisfied. If the authorization server supports “OpenID Connect Core Error Code unmet_authentication_requirements”,unmet_authentication_requirementsis used as the value of theerrorresponse parameter.
The following is the description about the error code in the specification.unmet_authentication_requirements: The Authorization Server is unable to meet the requirements of the Relying Party for the authentication of the End-User. This error code SHALL be used if the Relying Party wants the OP to conform to a certain Authentication Context Class Reference value using an essential claimacrclaim as specified in Section 5.5.1.1. of OpenID Connect Core [OpenID.Core] and the OP is unable to meet this requirement and MAY be used in other cases, if appropriate. If the authorization server does not support the specification, it is up to the authorization server what error code is used.Unmet Authentication Requirements for Step Up Authentication
In the context of OpenID Connect Core 1.0, no error is reported even if the authorization server cannot perform such user authentication unless theacrclaim is requested as essential. However, OAuth 2.0 Step Up Authentication Challenge Protocol recommends that an ACR request by theacr_valuesrequest parameter (which requests theacrclaim as a voluntary claim) be “treated as required” and the authorization server return theunmet_authentication_requirementserror in case none of specified ACRs can be satisfied. The recommendation slightly conflicts with the following paragraph excerpted from OpenID Connect Core 1.0. Note that even if the Claims are not available because the End-User did not authorize their release or they are not present, the Authorization Server MUST NOT generate an error when Claims are not returned, whether they are Essential or Voluntary, unless otherwise specified in the description of the specific claim. However, in practice, the slight conflict won’t be a big issue.Actual ACR Values
OpenID Connect Core 1.0 does not define actual ACR values. Therefore, to utilize ACR, it is necessary to define actual ACR values in a deployment-specific way. The following table shows examples of actual ACR values.Deployment ACR Values UK Open Banking urn:openbanking:psd2:caurn:openbanking:psd2:scaAU CDR urn:cds:au:cdr:2urn:cds:au:cdr:3Open Banking Brasil urn:brasil:openbanking:loa2urn:brasil:openbanking:loa3Authorization servers should advertise information about ACR values they support through their discovery documents. OpenID Connect Discovery 1.0 defines the acr_values_supportedserver metadata for the purpose as follows.acr_values_supported: OPTIONAL. JSON array containing a list of the Authentication Context Class References that this OP supports.
Maximum Authentication Age (Max Age)
The previous section states “User authentication is performed somewhere during an authorization flow.” at the beginning. However, in practice, the authorization server may skip the user authentication process if it detects that a user has already been authenticated (= if a user has already logged in). Therefore, the time at which an authorization request was made is not necessarily equal to the time of user authentication that was performed for the authorization request. The amount of time that has elapsed since the last user authentication is called “authentication age”. A client application may want to ask the authorization server to redo user authentication during an authorization flow in a case where the authentication age exceeds a particular threshold. The threshold is called “maximum authentication age”.The
Section 3.1.2.1 of OpenID Connect Core 1.0 defines the request parametermax_ageRequest Parametermax_ageas follows in order to enable client applications to specify the maximum authentication age.max_age: OPTIONAL. Maximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated by the OP. If the elapsed time is greater than this value, the OP MUST attempt to actively re-authenticate the End-User. (Themax_agerequest parameter corresponds to the OpenID 2.0 PAPE [OpenID.PAPE]max_auth_agerequest parameter.) Whenmax_ageis used, the ID Token returned MUST include anauth_timeClaim Value. The value of themax_ageis an integer that represents the maximum authentication age in seconds. It appears in an authorization request like the following. https://as.example.com/authorize?max_age=600&…The
If an authorization request does not contain thedefault_max_ageClient Metadatamax_agerequest parameter but thedefault_max_ageclient metadata of the client is set, the value of the metadata is used as the maximum authentication age. The metadata is defined in Section 2 of OpenID Connect Dynamic Client Registration 1.0 as follows.default_max_age: OPTIONAL. Default Maximum Authentication Age. Specifies that the End-User MUST be actively authenticated if the End-User was authenticated longer ago than the specified number of seconds. Themax_agerequest parameter overrides this default value. If omitted, no default Maximum Authentication Age is specified.The
When a client application wants to ask the authorization server to perform user authentication unconditionally (regardless of whether the maximum authentication age has been reached or not) during an authorization flow, it can use thepromptRequest Parameterpromptrequest parameter with theloginvalue included. Its use will look like the following. https://as.example.com/authorize?prompt=login&… See Section 3.1.2.1 of OpenID Connect Core 1.0 for details about thepromptparameter.Authentication Requirements Challenge
Protected resource endpoints that utilize the OAuth 2.0 Step Up Authentication Challenge Protocol specification return an error response when the presented access token does not satisfy either or both of the authentication requirements (namely ACR and Max Age). The diagram below illustrates the flow from returning an error response to making an authorization request asking for an access token that satisfies authentication requirements.
Parameters in the error response are explained in the subsequent sections.
The
To indicate that the reason of an error response is that authentication requirements are not satisfied, the specification defines an error codeinsufficient_user_authenticationError Codeinsufficient_user_authenticationas follows.insufficient_user_authentication: The authentication event associated with the access token presented with the request doesn’t meet the authentication requirements of the protected resource. The error code appears in theWWW-AuthenticateHTTP header of an error response as shown below. WWW-Authenticate: Bearer error=“insufficient_user_authentication,…The
To list ACRs one of which an access token must satisfy, the specification defines a parameteracr_valuesParameteracr_valuesas follows.acr_values: A space-separated string listing the authentication context class reference values, in order of preference, one of which the protected resource requires for the authentication event associated with the access token. The parameter is used in conjunction with the error codeinsufficient_user_authenticationlike below (excerpt from the specification): HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer error=“insufficient_user_authentication”, error_description=“A different authentication level is required, acr_values=“myACR” If a client application receives the error response above, the client application needs to make an authorization request that requests theacrclaim as an essential withmyACRincluded invalueslike below. Line-breaks in the example below are for display purposes only. An actual request does not contain line-breaks. https://as.example.com/authorize?claims= `} }&… If the authorization server treats theacr_valuesrequest parameter in the way recommended by the OAuth 2.0 Step Up Authentication Challenge Protocol specification,acr_values=myACRwould be enough.The
To indicate the maximum authentication age which an access token must satisfy, the specification defines a parametermax_ageParametermax_ageas follows.max_age: Indicates the allowable elapsed time in seconds since the last active authentication event associated with the access token. The parameter is used in conjunction with the error codeinsufficient_user_authenticationlike below (excerpt from the specification): HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer error=“insufficient_user_authentication, error_description=“More recent authentication is required”, max_age=“5 If a client application receives the error response above, the client application needs to make an authorization request with thepromptrequest parameter withloginincluded.Authentication Information Bound To Access Token
To enable protected resource endpoints to check whether a presented access token satisfies authentication requirements or not, the access token must hold information about the user authentication that was performed during the course of issuing the access token. The OAuth 2.0 Step Up Authentication Challenge Protocol specification defines the following two attributes of access token that may appear in the payload part of JWT access tokens and the message body of token introspection responses (cf. RFC 7662).Attribute Description (excerpted from the specification) acrAuthentication Context Class Reference. String specifying an Authentication Context Class Reference value that identifies the Authentication Context Class that the user authentication performed satisfied. auth_timeTime when the user authentication occurred. A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the time of date/time of the authentication event. The JSON below is an example excerpted from the specification that shows how the acrandauth_timeattributes appear in the payload part of JWT access tokens.
Authlete’s Implementation
$ in the command line above needs to be registered in advance as one of “Supported Authentication Context Class References” (which corresponds to the acr_values_supported server metadata). Otherwise, the specified ACR would be ignored.
ACR values of an authorization request are listed in the acrs parameter in the response from the /auth/authorization API regardless of where the values come from (acr_values, claims or default_acr_values).
In addition, when the acr claim is requested as essential, the boolean parameter acrEssential in the response from the /auth/authorization API holds true.
(2) Call the /auth/authorization/issue API, which receives a ticket issued by the /auth/authorization API as ticket, generates tokens (an authorization code, an access token, and/or an ID token), prepares an authorization response that conforms to related standard specifications, and returns JSON (cf. AuthorizationIssueResponse).
token_endpoint_auth_method) is client_secret_basic, which is implied by use of the clientId request parameter and the clientSecret parameter of the /auth/token API (cf. TokenRequest).
Unmet Authentication Requirements
Instead of calling the/auth/authorization/issue API, the implementation of the authorization endpoint may call the /auth/authorization/fail API to indicate that the authorization request in question failed.
The /auth/authorization/fail API requires the reason request parameter that indicates the reason of the error (cf. AuthorizationFailRequest). When [ACR_NOT_SATISFIED](https://authlete.github.io/authlete-java-common/com/authlete/common/dto/AuthorizationFailRequest.Reason.html#ACR_NOT_SATISFIED) is specified as the value of the reason request parameter, Authlete 2.3 and newer versions prepare an error response whose error is unmet_authentication_requirements to conform to “OpenID Connect Core Error Code unmet_authentication_requirements”.