When mutual TLS is used by the client on the connection to the token endpoint, the authorization server is able to bind the issued access token to the client certificate. Such a binding is accomplished by associating the certificate with the token in a way that can be accessed by the protected resource, such as embedding the certificate hash in the issued access token directly, using the syntax described in
Section 3.1, or through token introspection as described in
Section 3.2. Binding the access token to the client certificate in that fashion has the benefit of decoupling that binding from the client's authentication with the authorization server, which enables mutual TLS during protected resource access to serve purely as a proof-of-possession mechanism. Other methods of associating a certificate with an access token are possible, per agreement by the authorization server and the protected resource, but are beyond the scope of this specification.
In order for a resource server to use certificate-bound access tokens, it must have advance knowledge that mutual TLS is to be used for some or all resource accesses. In particular, the access token itself cannot be used as input to the decision of whether or not to request mutual TLS because (from the TLS perspective) it is "Application Data", only exchanged after the TLS handshake has been completed, and the initial CertificateRequest occurs during the handshake, before the Application Data is available. Although subsequent opportunities for a TLS client to present a certificate may be available, e.g., via TLS 1.2 renegotiation [
RFC 5246] or TLS 1.3 post-handshake authentication [
RFC 8446], this document makes no provision for their usage. It is expected to be common that a mutual-TLS-using resource server will require mutual TLS for all resources hosted thereupon or will serve mutual-TLS-protected and regular resources on separate hostname and port combinations, though other workflows are possible. How resource server policy is synchronized with the authorization server (AS) is out of scope for this document.
Within the scope of a mutual-TLS-protected resource-access flow, the client makes protected resource requests, as described in [
RFC 6750], however, those requests
MUST be made over a mutually authenticated TLS connection using the same certificate that was used for mutual TLS at the token endpoint.
The protected resource
MUST obtain, from its TLS implementation layer, the client certificate used for mutual TLS and
MUST verify that the certificate matches the certificate associated with the access token. If they do not match, the resource access attempt
MUST be rejected with an error, per [
RFC 6750], using an HTTP 401 status code and the
invalid_token error code.
Metadata to convey server and client capabilities for mutual-TLS client certificate-bound access tokens is defined in Sections [
3.3] and [
3.4], respectively.
When access tokens are represented as JSON Web Tokens (JWT) [
RFC 7519], the certificate hash information
SHOULD be represented using the
x5t#S256 confirmation method member defined herein.
To represent the hash of a certificate in a JWT, this specification defines the new JWT Confirmation Method [
RFC 7800] member
x5t#S256 for the X.509 Certificate SHA-256 Thumbprint. The value of the
x5t#S256 member is a base64url-encoded [
RFC 4648] SHA-256 [
SHS] hash (a.k.a., thumbprint, fingerprint, or digest) of the DER encoding [
X690] of the X.509 certificate [
RFC 5280]. The base64url-encoded value
MUST omit all trailing pad '=' characters and
MUST NOT include any line breaks, whitespace, or other additional characters.
The following is an example of a JWT payload containing an
x5t#S256 certificate thumbprint confirmation method. The new JWT content introduced by this specification is the
cnf confirmation method claim at the bottom of the example that has the
x5t#S256 confirmation method member containing the value that is the hash of the client certificate to which the access token is bound.
{
"iss": "https://server.example.com",
"sub": "ty.webb@example.com",
"exp": 1493726400,
"nbf": 1493722800,
"cnf":{
"x5t#S256": "bwcK0esc3ACC3DB2Y5_lESsXE8o9ltc05O89jdN-dg2"
}
}
OAuth 2.0 Token Introspection [
RFC 7662] defines a method for a protected resource to query an authorization server about the active state of an access token as well as to determine metainformation about the token.
For a mutual-TLS client certificate-bound access token, the hash of the certificate to which the token is bound is conveyed to the protected resource as metainformation in a token introspection response. The hash is conveyed using the same
cnf with
x5t#S256 member structure as the certificate SHA-256 thumbprint confirmation method, described in
Section 3.1, as a top-level member of the introspection response JSON. The protected resource compares that certificate hash to a hash of the client certificate used for mutual-TLS authentication and rejects the request if they do not match.
The following is an example of an introspection response for an active token with an
x5t#S256 certificate thumbprint confirmation method. The new introspection response content introduced by this specification is the
cnf confirmation method at the bottom of the example that has the
x5t#S256 confirmation method member containing the value that is the hash of the client certificate to which the access token is bound.
HTTP/1.1 200 OK
Content-Type: application/json
{
"active": true,
"iss": "https://server.example.com",
"sub": "ty.webb@example.com",
"exp": 1493726400,
"nbf": 1493722800,
"cnf":{
"x5t#S256": "bwcK0esc3ACC3DB2Y5_lESsXE8o9ltc05O89jdN-dg2"
}
}
This document introduces the following new authorization server metadata [
RFC 8414] parameter to signal the server's capability to issue certificate-bound access tokens:
-
tls_client_certificate_bound_access_tokens
-
OPTIONAL. Boolean value indicating server support for mutual-TLS client certificate-bound access tokens. If omitted, the default value is false.
The following new client metadata parameter is introduced to convey the client's intention to use certificate-bound access tokens:
-
tls_client_certificate_bound_access_tokens
-
OPTIONAL. Boolean value used to indicate the client's intention to use mutual-TLS client certificate-bound access tokens. If omitted, the default value is false.
Note that if a client that has indicated the intention to use mutual-TLS client certificate-bound tokens makes a request to the token endpoint over a non-mutual-TLS connection, it is at the authorization server's discretion as to whether to return an error or issue an unbound token.