JSON Web Token (JWT) Profile For OAuth 2.0 Client Authentication and Authorization Grants
JSON Web Token (JWT) Profile For OAuth 2.0 Client Authentication and Authorization Grants
Jones
Request for Comments: 7523 Microsoft
Category: Standards Track B. Campbell
ISSN: 2070-1721 Ping Identity
C. Mortimore
Salesforce
May 2015
Abstract
This specification defines the use of a JSON Web Token (JWT) Bearer
Token as a means for requesting an OAuth 2.0 access token as well as
for client authentication.
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4
1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4
2. HTTP Parameter Bindings for Transporting Assertions . . . . . 4
2.1. Using JWTs as Authorization Grants . . . . . . . . . . . 4
2.2. Using JWTs for Client Authentication . . . . . . . . . . 5
3. JWT Format and Processing Requirements . . . . . . . . . . . 5
3.1. Authorization Grant Processing . . . . . . . . . . . . . 7
3.2. Client Authentication Processing . . . . . . . . . . . . 8
4. Authorization Grant Example . . . . . . . . . . . . . . . . . 8
5. Interoperability Considerations . . . . . . . . . . . . . . . 9
6. Security Considerations . . . . . . . . . . . . . . . . . . . 9
7. Privacy Considerations . . . . . . . . . . . . . . . . . . . 10
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10
8.1. Sub-Namespace Registration of
urn:ietf:params:oauth:grant-type:jwt-bearer . . . . . . . 10
8.2. Sub-Namespace Registration of
urn:ietf:params:oauth:client-assertion-type:jwt-bearer . 10
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 11
9.1. Normative References . . . . . . . . . . . . . . . . . . 11
9.2. Informative References . . . . . . . . . . . . . . . . . 11
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 12
Authors’ Addresses . . . . . . . . . . . . . . . . . . . . . . . 12
1. Introduction
This document defines how a JWT Bearer Token can be used to request
an access token when a client wishes to utilize an existing trust
relationship, expressed through the semantics of the JWT, without a
direct user-approval step at the authorization server. It also
defines how a JWT can be used as a client authentication mechanism.
The use of a security token for client authentication is orthogonal
to and separable from using a security token as an authorization
grant. They can be used either in combination or separately. Client
authentication using a JWT is nothing more than an alternative way
for a client to authenticate to the token endpoint and must be used
in conjunction with some grant type to form a complete and meaningful
protocol request. JWT authorization grants may be used with or
without client authentication or identification. Whether or not
client authentication is needed in conjunction with a JWT
authorization grant, as well as the supported types of client
authentication, are policy decisions at the discretion of the
authorization server.
The process by which the client obtains the JWT, prior to exchanging
it with the authorization server or using it for client
authentication, is out of scope.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
Unless otherwise noted, all the protocol parameter names and values
are case sensitive.
1.2. Terminology
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer
&assertion=eyJhbGciOiJFUzI1NiIsImtpZCI6IjE2In0.
eyJpc3Mi[...omitted for brevity...].
J9l-ZhwP[...omitted for brevity...]
To use a JWT Bearer Token for client authentication, the client uses
the following parameter values and encodings.
grant_type=authorization_code&
code=n0esc3NRze7LTCu7iYzS6a5acc3f0ogp4&
client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3A
client-assertion-type%3Ajwt-bearer&
client_assertion=eyJhbGciOiJSUzI1NiIsImtpZCI6IjIyIn0.
eyJpc3Mi[...omitted for brevity...].
cC4hiUPo[...omitted for brevity...]
5. The JWT MAY contain an "nbf" (not before) claim that identifies
the time before which the token MUST NOT be accepted for
processing.
6. The JWT MAY contain an "iat" (issued at) claim that identifies
the time at which the JWT was issued. Note that the
authorization server may reject JWTs with an "iat" claim value
that is unreasonably far in the past.
7. The JWT MAY contain a "jti" (JWT ID) claim that provides a
unique identifier for the token. The authorization server MAY
ensure that JWTs are not replayed by maintaining the set of used
"jti" values for the length of time for which the JWT would be
considered valid based on the applicable "exp" instant.
10. The authorization server MUST reject a JWT that is not valid in
all other respects per "JSON Web Token (JWT)" [JWT].
If the JWT is not valid, or the current time is not within the
token’s valid time window for use, the authorization server
constructs an error response as defined in OAuth 2.0 [RFC6749]. The
value of the "error" parameter MUST be the "invalid_grant" error
code. The authorization server MAY include additional information
regarding the reasons the JWT was considered invalid using the
"error_description" or "error_uri" parameters.
For example:
{
"error":"invalid_grant",
"error_description":"Audience validation failed"
}
The example shows a JWT issued and signed by the system entity
identified as "https://jwt-idp.example.com". The subject of the JWT
is identified by email address as "[email protected]". The intended
audience of the JWT is "https://jwt-rp.example.net", which is an
identifier with which the authorization server identifies itself.
The JWT is sent as part of an access token request to the
authorization server’s token endpoint at "https://authz.example.net/
token.oauth2".
{"iss":"https://jwt-idp.example.com",
"sub":"mailto:[email protected]",
"aud":"https://jwt-rp.example.net",
"nbf":1300815780,
"exp":1300819380,
"http://claims.example.com/member":true}
{"alg":"ES256","kid":"16"}
To present the JWT with the claims and header shown in the previous
example as part of an access token request, for example, the client
might make the following HTTPS request (with extra line breaks for
display purposes only):
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer
&assertion=eyJhbGciOiJFUzI1NiIsImtpZCI6IjE2In0.
eyJpc3Mi[...omitted for brevity...].
J9l-ZhwP[...omitted for brevity...]
5. Interoperability Considerations
6. Security Considerations
The specification does not mandate replay protection for the JWT
usage for either the authorization grant or for client
authentication. It is an optional feature, which implementations may
employ at their own discretion.
7. Privacy Considerations
8. IANA Considerations
o URN: urn:ietf:params:oauth:grant-type:jwt-bearer
o Common Name: JWT Bearer Token Grant Type Profile for OAuth 2.0
o Change Controller: IESG
o Specification Document: RFC 7523
o URN: urn:ietf:params:oauth:client-assertion-type:jwt-bearer
o Common Name: JWT Bearer Token Profile for OAuth 2.0 Client
Authentication
o Change Controller: IESG
o Specification Document: RFC 7523
9. References
[JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token
(JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015,
<http://www.rfc-editor.org/info/rfc7519>.
[RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
2014, <http://www.rfc-editor.org/info/rfc7159>.
[OAUTH-DYN-REG]
Richer, J., Jones, M., Bradley, J., Machulak, M., and P.
Hunt, "OAuth 2.0 Dynamic Client Registration Protocol",
Work in Progress, draft-ietf-oauth-dyn-reg-29, May 2015.
[OpenID.Discovery]
Sakimura, N., Bradley, J., Jones, M., and E. Jay, "OpenID
Connect Discovery 1.0 incorporating errata set 1",
November 2014, <http://openid.net/specs/
openid-connect-discovery-1_0.html>.
[OpenID.Registration]
Sakimura, N., Bradley, J., and M. Jones, "OpenID Connect
Dynamic Client Registration 1.0 incorporating errata set
1", November 2014, <http://openid.net/specs/
openid-connect-registration-1_0.html>.
Acknowledgements
Authors’ Addresses
Michael B. Jones
Microsoft
EMail: [email protected]
URI: http://self-issued.info/
Brian Campbell
Ping Identity
EMail: [email protected]
Chuck Mortimore
Salesforce
EMail: [email protected]