OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layeryes.commail@danielfett.deYubicove7jtb@ve7jtb.comPing Identitybcampbell@pingidentity.comyes.comtorsten@lodderstedt.netMicrosoftmbj@microsoft.com
SecurityWeb Authorization Protocolsecurityoauth2This document defines a sender-constraint mechanism for
OAuth 2.0 access tokens and refresh tokens
utilizing an application-level proof-of-possession mechanism
based on public/private key pairs. describes methods to bind (sender-constrain) access tokens
using mutual Transport Layer Security (TLS) authentication with X.509
certificates. provides mechanisms to
sender-constrain access tokens using HTTP token binding.Due to a sub-par user experience of TLS client authentication in user
agents and a lack of support for HTTP token binding, neither mechanism
can be used if an OAuth client is a Single Page Application (SPA)
running in a web browser.This document defines an application-level sender-constraint mechanism for
OAuth 2.0 access tokens and refresh tokens that can be applied when neither mTLS nor
OAuth Token Binding are utilized. It achieves proof-of-possession using
a public/private key pair.The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
"MAY", and "OPTIONAL" in this document are to be interpreted as
described in BCP 14 when, and only when, they
appear in all capitals, as shown here.This specification uses the terms "access token", "refresh token",
"authorization server", "resource server", "authorization endpoint",
"authorization request", "authorization response", "token endpoint",
"grant type", "access token request", "access token response", and
"client" defined by The OAuth 2.0 Authorization Framework .Under the attacker model defined in ,
the mechanism defined by this specification tries to ensure token
replay at a different endpoint is prevented.More precisely, if an adversary is able to get hold of an access token
because it set up a counterfeit authorization server or resource
server, the adversary is not able to replay the respective access
token at another authorization or resource server.Secondary objectives are discussed in .Figure 1: Basic DPoP FlowThe new elements introduced by this specification are shown in Figure 1:In the Token Request (C), the client proves the possession of a
private key belonging to some public key by using the private key
to sign the authorization code. The matching public key is sent in
the same request.The AS binds (sender-constrains) the access token to the public
key claimed by the client; that is, the access token cannot be
used without proving possession of the respective private key.
This is signaled to the client by using the token_type value
bearer+dpop. If a refresh token is issued to
the client, it is sender-constrained in the same way if the client
is a public client and thus is not able to authenticate requests
to the token endpoint.If the client wants to use the access token (E) or the (public)
client wants to use a refresh token, the client has to prove
possession of the private key by signing a message containing the
respective token, the endpoint URL, and the request method. This
signature is provided as a signed JWT.In the case of the refresh token, the AS can immediately check
that the JWT was signed using the matching private key claimed in
request (C).In the case of the access token, the resource server needs to
receive information about which public key to check against. This
information is either encoded directly into the access token, for
JWT structured access tokens, or provided at the token
introspection endpoint of the authorization server (request not
shown).The mechanism presented herein is not a client authentication method.
In fact, a primary use case are public clients (single page
applications) that do not use client authentication. Nonetheless, DPoP
is designed such that it is compatible with private_key_jwt and all
other client authentication methods.To bind an tokens to a public key in the token request, the client
MUST provide a public key and prove the possession of the
corresponding private key. The following HTTPS request illustrates the
protocol for this (with extra line breaks for display purposes only):Figure 2: Token Request for a DPoP bound token.The parameter dpop_binding MUST contain a JWT signed using the
asymmetric key chosen by the client. The header of the JWT contains
the following fields:typ: with value dpop_binding+jwt (REQUIRED).jwk: The public key chosen by the client, in JWK format
(REQUIRED).The body of the JWT contains the following fields:http_method: The HTTP method used for the request (REQUIRED).http_uri: The HTTP URI used for the request, without query and
fragment parts (REQUIRED).exp: Expiration time of the JWT (REQUIRED). See Security Considerations.jti: Unique, freshly chosen identifier for this JWT (REQUIRED).
SHOULD be used by the AS for replay detection and prevention. See
Security Considerations.An example JWT is shown in Figure 3.Figure 3: Example JWT for dpop_binding parameter.If the authorization server receives a dpop_binding parameter in a
token request, the authorization server MUST check that:the parameter value is a well-formed JWT,all required claims are contained in the JWT,the algorithm in the header of the JWT is supported by the
application and deemed secure,the JWT is signed using the public key contained in the header of the
JWT,the typ field in the header has the correct value,the http_method and http_uri claims match the respective values
for the HTTP request in which the parameter was received,the token has not expired, andif replay protection is desired, that a JWT with the same jti
value has not been received previously.If these checks are successful, the authorization server MUST
associate the access token with the public key. It then sets
token_type to bearer+dpop in the token response.To make use of an access token that is token bound to a public key
using DPoP, a client MUST prove the possession of the corresponding
private key. More precisely, the client MUST create a JWT and sign it
using the previously chosen private key.The JWT has the same format as above, except:The header MUST contain a typ claim with the value
dpop_proof+jwt.The header SHOULD not contain a jwk field.The signed JWT MUST then be sent in the dpop_proof request parameter.If a resource server detects that an access token that is to be used
for resource access is bound to a public key using DPoP (via the
methods described in ) it MUST check that:a parameter dpop_proof was received in the HTTP request,the parameter's value is a well-formed JWT,all required claims are contained in the JWT,the algorithm in the header of the JWT is supported by the
application and deemed secure,the JWT is signed using the public key to which the access token
was bound,the typ field in the header has the correct value,the http_method and http_uri claims match the respective values
for the HTTP request in which the parameter was received,the token has not expired, andif replay protection is desired, that a JWT with the same jti
value has not been received previously.If any of these checks fails, the resource server MUST NOT grant
access to the resource.At the token endpoint, public clients MUST provide a proof of
possession in the same way as for access tokens.It MUST be ensured that resource servers can reliably identify whether
a token is bound using DPoP and learn the public key to which the
token is bound.Access tokens that are represented as JSON Web Tokens (JWT)
MUST contain information about the DPoP public key (in JWK format) in
the member dpop+jwk of the cnf claim, as shown in Figure 4.Figure 4: Example access token with cnf claim.When access token introspection is used, the same cnf claim as above
MUST be contained in the introspection response.This document resulted from discussions at the 4th OAuth Security
Workshop in Stuttgart, Germany. We thank the organizers of this
workshop (Ralf Küsters, Guido Schmitz).This specification requests registration of the following value in
the IANA "JWT Confirmation Methods" registry [IANA.JWT.Claims] for
JWT "cnf" member values established by .Confirmation Method Value: "dpop+jwk"Confirmation Method Description: JWK encoded public key for dpop proof tokenChange Controller: IESGSpecification Document(s): [[ this specification ]]This specification registers the following parameters in the IANA
"OAuth Parameters" registry defined in OAuth 2.0 .Parameter name: dpop_bindingParameter usage location: token requestChange controller: IESGSpecification document(s): [[ this specification ]]Parameter name: dpop_proofParameter usage location: token requestChange controller: IESGSpecification document(s): [[ this specification ]]This specification registers the "dpop+jwt" type value in the IANA
JSON Web Signature and Encryption Type Values registry :"typ" Header Parameter Value: "dpop_proof+jwt"Abbreviation for MIME Type: NoneChange Controller: IETFSpecification Document(s): [[ this specification ]]"typ" Header Parameter Value: "dpop_binding+jwt"Abbreviation for MIME Type: NoneChange Controller: IETFSpecification Document(s): [[ this specification ]]The Prevention of Token Replay at a Different
Endpoint is achieved through
the binding of the DPoP JWT to a certain URI and HTTP method.If an adversary is able to get hold of an DPoP-Binding JWT, it might
replay it at the authorization server's token endpoint with the same
or different payload. The issued access token is useless as long as
the adversary does not get hold of a valid DPoP-Binding JWT for the
corresponding resource server.If an adversary is able to get hold of a DPoP-Proof JWT, the adversary
could replay that token later at the same endpoint (the HTTP endpoint
and method are enforced via the respective claims in the JWTs). To
prevent this, clients MUST limit the lifetime of the JWTs, preferably
to a brief period. Furthermore, the jti claim in each JWT MUST
contain a unique (incrementing or randomly chosen) value, as proposed
in . Resource servers SHOULD store values at least for the
lifetime of the respective JWT and decline HTTP requests by clients if
a jti value has been seen before.Servers accepting signed DPoP JWTs MUST check the typ field in the
headers of the JWTs to ensure that adversaries cannot use JWTs created
for other purposes in the DPoP headers.mTLS stronger against intercepted connections[[ To be removed from the final specification ]]-00first draft