idnits 2.17.1 draft-jones-oauth-jwt-bearer-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (Oct 31, 2011) is 4554 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'JWT' ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) == Outdated reference: A later version (-23) exists of draft-ietf-oauth-saml2-bearer-09 Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group M. Jones 3 Internet-Draft Microsoft 4 Intended status: Standards Track B. Campbell 5 Expires: May 3, 2012 Ping Identity Corp. 6 C. Mortimore 7 Salesforce.com 8 Oct 31, 2011 10 JSON Web Token (JWT) Bearer Token Profiles for OAuth 2.0 11 draft-jones-oauth-jwt-bearer-01 13 Abstract 15 This specification defines the use of a JSON Web Token (JWT) Bearer 16 Token as means for requesting an OAuth 2.0 access token as well as 17 for use as a means of client authentication. 19 Status of this Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on May 3, 2012. 36 Copyright Notice 38 Copyright (c) 2011 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 54 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 4 55 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 56 2. HTTP Parameter Bindings for Transporting Assertions . . . . . 4 57 2.1. Using JWTs as Authorization Grants . . . . . . . . . . . . 4 58 2.2. Using JWTs for Client Authentication . . . . . . . . . . . 4 59 3. JWT Format and Processing Requirements . . . . . . . . . . . . 5 60 3.1. Authorization Grant Processing . . . . . . . . . . . . . . 6 61 3.2. Client Authentication Processing . . . . . . . . . . . . . 6 62 4. Authorization Grant Example . . . . . . . . . . . . . . . . . 7 63 5. Security Considerations . . . . . . . . . . . . . . . . . . . 7 64 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 65 6.1. Sub-Namespace Registration of 66 urn:ietf:params:oauth:grant-type:jwt-bearer . . . . . . . 7 67 6.2. Sub-Namespace Registration of 68 urn:ietf:params:oauth:client-assertion-type:jwt-bearer . . 8 69 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 8 70 7.1. Normative References . . . . . . . . . . . . . . . . . . . 8 71 7.2. Informative References . . . . . . . . . . . . . . . . . . 9 72 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 9 73 Appendix B. Document History . . . . . . . . . . . . . . . . . . 9 74 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 10 76 1. Introduction 78 JSON Web Token (JWT) [JWT] is a JSON-based security token encoding 79 that enables identity and security information to be shared across 80 security domains. JWTs utilize JSON data structures, as defined in 81 RFC 4627 [RFC4627]. A security token is generally issued by an 82 identity provider and consumed by a relying party that relies on its 83 content to identify the token's subject for security related 84 purposes. 86 The OAuth 2.0 Authorization Protocol [I-D.ietf.oauth-v2] provides a 87 method for making authenticated HTTP requests to a resource using an 88 access token. Access tokens are issued to third-party clients by an 89 authorization server (AS) with the (sometimes implicit) approval of 90 the resource owner. In OAuth, an authorization grant is an abstract 91 term used to describe intermediate credentials that represent the 92 resource owner authorization. An authorization grant is used by the 93 client to obtain an access token. Several authorization grant types 94 are defined to support a wide range of client types and user 95 experiences. OAuth also allows for the definition of new extension 96 grant types to support additional clients or to provide a bridge 97 between OAuth and other trust frameworks. Finally, OAuth allows the 98 definition of additional authentication mechanisms to be used by 99 clients when interacting with the authorization server. 101 The OAuth 2.0 Assertion Profile [I-D.ietf.oauth-assertions] is an 102 abstract extension to OAuth 2.0 that provides a general framework for 103 the use of Assertions (a.k.a. Security Tokens) as client credentials 104 and/or authorization grants with OAuth 2.0. This specification 105 profiles the OAuth 2.0 Assertion Profile [I-D.ietf.oauth-assertions] 106 to define an extension grant type that uses a JSON Web Token (JWT) 107 Bearer Token to request an OAuth 2.0 access token as well as for use 108 as client credentials. The format and processing rules for the JWT 109 defined in this specification are intentionally similar, though not 110 identical, to those in the closely related SAML 2.0 Bearer Assertion 111 Profiles for OAuth 2.0 [I-D.ietf-oauth-saml2-bearer]. 113 This document defines how a JSON Web Token (JWT) Bearer Token can be 114 used to request an access token when a client wishes to utilize an 115 existing trust relationship, expressed through the semantics of (and 116 digital signature calculated over) the JWT, without a direct user 117 approval step at the authorization server. It also defines how a JWT 118 can be used as a client authentication mechanism. The use of a 119 security token for client authentication is orthogonal and separable 120 from using a security token as an authorization grant and the two can 121 be used either in combination or in isolation. 123 The process by which the client obtains the JWT, prior to exchanging 124 it with the authorization server or using it for client 125 authentication, is out of scope. 127 1.1. Notational Conventions 129 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 130 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 131 document are to be interpreted as described in RFC 2119 [RFC2119]. 133 Unless otherwise noted, all the protocol parameter names and values 134 are case sensitive. 136 1.2. Terminology 138 All terms are as defined in [I-D.ietf.oauth-v2], 139 [I-D.ietf.oauth-assertions], and [JWT]. 141 2. HTTP Parameter Bindings for Transporting Assertions 143 The OAuth 2.0 Assertion Profile [I-D.ietf.oauth-assertions] defines 144 generic HTTP parameters for transporting Assertions (a.k.a. Security 145 Tokens) during interactions with a token endpoint. This section 146 defines the values of those parameters for use with JWT Bearer 147 Tokens. 149 2.1. Using JWTs as Authorization Grants 151 To use a JWT Bearer Token as an authorization grant, use the 152 following parameter values and encodings. 154 The value of "grant_type" parameter MUST be 155 "urn:ietf:params:oauth:grant-type:jwt-bearer" 157 The value of the "assertion" parameter MUST contain a single JWT. 158 The SAML Assertion XML data MUST be encoded using base64url, where 159 the encoding adheres to the definition in Section 5 of RFC4648 160 [RFC4648] and where the padding bits are set to zero. To avoid the 161 need for subsequent encoding steps (by "application/ 162 x-www-form-urlencoded" [W3C.REC-html401-19991224], for example), the 163 base64url encoded data SHOULD NOT be line wrapped and pad characters 164 ("=") SHOULD NOT be included. 166 2.2. Using JWTs for Client Authentication 168 To use a JWT Bearer Token for client authentication grant, use the 169 following parameter values and encodings. 171 The value of "client_assertion_type" parameter MUST be 172 "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" 174 The value of the "client_assertion" parameter MUST contain a single 175 JWT. The SAML Assertion XML data MUST be encoded using base64url, 176 where the encoding adheres to the definition in Section 5 of RFC4648 177 [RFC4648] and where the padding bits are set to zero. To avoid the 178 need for subsequent encoding steps (by "application/ 179 x-www-form-urlencoded" [W3C.REC-html401-19991224], for example), the 180 base64url encoded data SHOULD NOT be line wrapped and pad characters 181 ("=") SHOULD NOT be included. 183 3. JWT Format and Processing Requirements 185 In order to issue an access token response as described in The OAuth 186 2.0 Authorization Protocol [I-D.ietf.oauth-v2] or to rely on a JWT 187 for client authentication, the authorization server MUST validate the 188 JWT according to the criteria below. Application of additional 189 restrictions and policy are at the discretion of the authorization 190 server. 192 o The JWT MUST contain an "iss" (issuer) claim that contains a 193 unique identifier for the entity that issued the JWT. 195 o The JWT MUST contain a "prn" (principal) claim identifying the 196 subject of the transaction. The principal MAY identify the 197 resource owner for whom the access token is being requested. For 198 client authentication, the principal MUST be the client_id of the 199 OAuth client. When using JWTs as an authorization grant, the 200 principal SHOULD identify an authorized accessor for whom the 201 access token is being requested (typically the resource owner, or 202 an authorized delegate). 204 o The JWT MUST contain an "aud" (audience) claim containing a URI 205 reference that identifies the authorization server, or the service 206 provider principal entity of its controlling domain, as an 207 intended audience. The token endpoint URL of the authorization 208 server MAY be used as an acceptable value for an "aud" element. 209 The authorization server MUST verify that it is an intended 210 audience for the JWT. 212 o The JWT MUST contain an "exp" (expiration) claim that limits the 213 time window during which the JWT can be used. The authorization 214 server MUST verify that the expiration time has not passed, 215 subject to allowable clock skew between systems. The 216 authorization server MAY reject JWTs with an "exp" claim value 217 that is unreasonably far in the future. 219 o The JWT MAY contain an "nbf" (not before) claim that identifies 220 the time before which the token MUST NOT be accepted for 221 processing. 223 o The JWT MAY contain other claims. 225 o The JWT MUST be digitally signed by the issuer and the 226 authorization server MUST verify the signature. 228 o The authorization server MUST verify that the JWT is valid in all 229 other respects per [JWT]. 231 3.1. Authorization Grant Processing 233 If present, the authorization server MUST also validate the client 234 credentials. 236 Authorization servers SHOULD issue access tokens with a limited 237 lifetime and require clients to refresh them by requesting a new 238 access token using the same JWT, if it is still valid, or with a new 239 JWT. The authorization server SHOULD NOT issue a refresh token. 241 If the JWT is not valid, or the current time is not within the 242 token's valid time window for use, the authorization server MUST 243 construct an error response as defined in [I-D.ietf.oauth-v2]. The 244 value of the error parameter MUST be the "invalid_grant" error code. 245 The authorization server MAY include additional information regarding 246 the reasons the JWT was considered invalid using the 247 error_description or error_uri parameters. 249 For example: 250 HTTP/1.1 400 Bad Request 251 Content-Type: application/json 252 Cache-Control: no-store 254 { 255 "error":"invalid_grant", 256 "error_description":"Audience validation failed" 257 } 259 3.2. Client Authentication Processing 261 If the client JWT is not valid, or its subject confirmation 262 requirements cannot be met, the authorization server MUST construct 263 an error response as defined in [I-D.ietf.oauth-v2]. The value of 264 the error parameter MUST be the "invalid_client" error code. The 265 authorization server MAY include additional information regarding the 266 reasons the JWT was considered invalid using the error_description or 267 error_uri parameters. 269 4. Authorization Grant Example 271 Though non-normative, the following examples illustrate what a 272 conforming JWT and access token request would look like. 274 Below is an example JSON object that could be encoded to produce the 275 JWT Claims Object for a JWT: 276 {"iss":"https://jwt-idp.example.com", 277 "prn":"mailto:mike@example.com", 278 "aud":"https://jwt-rp.example.net", 279 "nbf":1300815780, 280 "exp":1300819380, 281 "http://claims.example.com/member":true} 283 The following example JSON object, used as the header of a JWT, 284 declares that the JWT is signed with the ECDSA P-256 SHA-256 285 algorithm. 286 {"alg":"ES256"} 288 To present the JWT with the claims and header shown in the previous 289 example as part of an access token request, for example, the client 290 might make the following HTTPS request (line breaks are for display 291 purposes only): 292 POST /token.oauth2 HTTP/1.1 293 Host: authz.example.net 294 Content-Type: application/x-www-form-urlencoded 296 grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt- 297 bearer&assertion=eyJhbGciOiJFUzI1NiJ9. 298 eyJpc3Mi[...omitted for brevity...]. 299 J9l-ZhwP_2n[...omitted for brevity...] 301 5. Security Considerations 303 No additional security considerations apply beyond those described 304 within [I-D.ietf.oauth-v2], [I-D.ietf.oauth-assertions], and [JWT]. 306 6. IANA Considerations 308 6.1. Sub-Namespace Registration of 309 urn:ietf:params:oauth:grant-type:jwt-bearer 311 This is a request to IANA to please register the value grant- 312 type:jwt-bearer in the registry urn:ietf:params:oauth established in 313 [I-D.ietf.oauth-urn-sub-ns]. 315 o URN: urn:ietf:params:oauth:grant-type:jwt-bearer 317 o Common Name: JWT Bearer Token Grant Type Profile for OAuth 2.0 319 o Change controller: IETF 321 o Description: [[this document]] 323 6.2. Sub-Namespace Registration of 324 urn:ietf:params:oauth:client-assertion-type:jwt-bearer 326 This is a request to IANA to please register the value client- 327 assertion-type:jwt-bearer in the registry urn:ietf:params:oauth 328 established in [I-D.ietf.oauth-urn-sub-ns]. 330 o URN: urn:ietf:params:oauth:client-assertion-type:jwt-bearer 332 o Common Name: JWT Bearer Token Profile for OAuth 2.0 Client 333 Authentication 335 o Change controller: IETF 337 o Description: [[this document]] 339 7. References 341 7.1. Normative References 343 [I-D.ietf.oauth-assertions] 344 Mortimore, C., Ed., Campbell, B., Jones, M., and Y. 345 Goland, "OAuth 2.0 Assertion Profile", 346 ID draft-ietf-oauth-assertions-01 (work in progress), 347 October 2011. 349 [I-D.ietf.oauth-urn-sub-ns] 350 Campbell, B., Ed. and H. Tschofenig, "An IETF URN Sub- 351 Namespace for OAuth", ID draft-ietf-oauth-urn-sub-ns-00 352 (work in progress), Aug 2011. 354 [I-D.ietf.oauth-v2] 355 Hammer-Lahav, E., Ed., Recordon, D., and D. Hardt, "The 356 OAuth 2.0 Authorization Protocol", 357 ID draft-ietf-oauth-v2-22 (work in progress), 358 September 2011. 360 [JWT] Jones, M., Balfanz, D., Bradley, J., Goland, Y., Panzer, 361 J., Sakimura, N., and P. Tarjan, "JSON Web Token (JWT)", 362 October 2011. 364 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 365 Requirement Levels", BCP 14, RFC 2119, March 1997. 367 [RFC4627] Crockford, D., "The application/json Media Type for 368 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 370 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 371 Encodings", RFC 4648, October 2006. 373 7.2. Informative References 375 [I-D.ietf-oauth-saml2-bearer] 376 Mortimore, C., "SAML 2.0 Bearer Assertion Profiles for 377 OAuth 2.0", draft-ietf-oauth-saml2-bearer-09 (work in 378 progress), October 2011. 380 [W3C.REC-html401-19991224] 381 Raggett, D., Jacobs, I., and A. Hors, "HTML 4.01 382 Specification", World Wide Web Consortium 383 Recommendation REC-html401-19991224, December 1999, 384 . 386 Appendix A. Acknowledgements 388 This profile was derived from the SAML 2.0 Bearer Assertion Profiles 389 for OAuth 2.0 [I-D.ietf-oauth-saml2-bearer] by Brian Campbell and 390 Chuck Mortimore. 392 Appendix B. Document History 394 [[ to be removed by RFC editor before publication as an RFC ]] 396 -01 398 o Merged in changes from draft-ietf-oauth-saml2-bearer-09. In 399 particular, this draft now uses draft-ietf-oauth-assertions, 400 rather than being standalone. It also now defines how to use JWT 401 bearer tokens both for Authorization Grants and for Client 402 Authentication. 404 -00 405 o Initial draft. 407 Authors' Addresses 409 Michael B. Jones 410 Microsoft 412 Email: mbj@microsoft.com 413 URI: http://self-issued.info/ 415 Brian Campbell 416 Ping Identity Corp. 418 Email: brian.d.campbell@gmail.com 420 Chuck Mortimore 421 Salesforce.com 423 Email: cmortimore@salesforce.com