idnits 2.17.1 draft-ietf-oauth-v2-bearer-15.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 seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: o Stated that bearer tokens MUST not be stored in cookies that can be sent in the clear in the Threat Mitigation section. -- The document date (December 18, 2011) is 4512 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) == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p1-messaging-17 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p7-auth-17 == Outdated reference: A later version (-31) exists of draft-ietf-oauth-v2-22 ** Obsolete normative reference: RFC 2246 (Obsoleted by RFC 4346) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 2617 (Obsoleted by RFC 7235, RFC 7615, RFC 7616, RFC 7617) Summary: 3 errors (**), 0 flaws (~~), 6 warnings (==), 3 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 D. Hardt 5 Expires: June 20, 2012 independent 6 D. Recordon 7 Facebook 8 December 18, 2011 10 The OAuth 2.0 Authorization Protocol: Bearer Tokens 11 draft-ietf-oauth-v2-bearer-15 13 Abstract 15 This specification describes how to use bearer tokens in HTTP 16 requests to access OAuth 2.0 protected resources. Any party in 17 possession of a bearer token (a "bearer") can use it to get access to 18 the associated resources (without demonstrating possession of a 19 cryptographic key). To prevent misuse, bearer tokens need to be 20 protected from disclosure in storage and in transport. 22 Status of this Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on June 20, 2012. 39 Copyright Notice 41 Copyright (c) 2011 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 57 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 3 58 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 4 60 2. Authenticated Requests . . . . . . . . . . . . . . . . . . . . 5 61 2.1. Authorization Request Header Field . . . . . . . . . . . . 5 62 2.2. Form-Encoded Body Parameter . . . . . . . . . . . . . . . 6 63 2.3. URI Query Parameter . . . . . . . . . . . . . . . . . . . 7 64 3. The WWW-Authenticate Response Header Field . . . . . . . . . . 7 65 3.1. Error Codes . . . . . . . . . . . . . . . . . . . . . . . 9 66 4. Security Considerations . . . . . . . . . . . . . . . . . . . 10 67 4.1. Security Threats . . . . . . . . . . . . . . . . . . . . . 10 68 4.2. Threat Mitigation . . . . . . . . . . . . . . . . . . . . 10 69 4.3. Summary of Recommendations . . . . . . . . . . . . . . . . 12 70 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13 71 5.1. OAuth Access Token Type Registration . . . . . . . . . . . 13 72 5.1.1. The "Bearer" OAuth Access Token Type . . . . . . . . . 13 73 5.2. Authentication Scheme Registration . . . . . . . . . . . . 14 74 5.2.1. The "Bearer" Authentication Scheme . . . . . . . . . . 14 75 6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 14 76 6.1. Normative References . . . . . . . . . . . . . . . . . . . 14 77 6.2. Informative References . . . . . . . . . . . . . . . . . . 15 78 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 15 79 Appendix B. Document History . . . . . . . . . . . . . . . . . . 16 80 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 22 82 1. Introduction 84 OAuth enables clients to access protected resources by obtaining an 85 access token, which is defined in OAuth 2.0 Authorization 86 [I-D.ietf-oauth-v2] as "a string representing an access authorization 87 issued to the client", rather than using the resource owner's 88 credentials directly. 90 Tokens are issued to clients by an authorization server with the 91 approval of the resource owner. The client uses the access token to 92 access the protected resources hosted by the resource server. This 93 specification describes how to make protected resource requests when 94 the OAuth access token is a bearer token. 96 This specification defines the use of bearer tokens over HTTP/1.1 97 [I-D.ietf-httpbis-p1-messaging] using TLS [RFC5246] to access 98 protected resources. TLS is mandatory to implement and use with this 99 specification; other specifications may extend this specification for 100 use with other transport protocols. While designed for use with 101 access tokens resulting from OAuth 2.0 Authorization 102 [I-D.ietf-oauth-v2] flows to access OAuth protected resources, this 103 specification actually defines a general HTTP authorization method 104 that can be used with bearer tokens from any source to access any 105 resources protected by those bearer tokens. 107 1.1. Notational Conventions 109 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', 110 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this 111 document are to be interpreted as described in Key words for use in 112 RFCs to Indicate Requirement Levels [RFC2119]. 114 This document uses the Augmented Backus-Naur Form (ABNF) notation of 115 HTTP/1.1, Part 1 [I-D.ietf-httpbis-p1-messaging], which is based upon 116 the Augmented Backus-Naur Form (ABNF) [RFC5234] notation. 117 Additionally, the following rules are included from HTTP/1.1, Part 7 118 [I-D.ietf-httpbis-p7-auth]: b64token, auth-param, and realm; from 119 HTTP/1.1, Part 1 [I-D.ietf-httpbis-p1-messaging]: quoted-string; and 120 from Uniform Resource Identifier (URI) [RFC3986]: URI-Reference. 122 Unless otherwise noted, all the protocol parameter names and values 123 are case sensitive. 125 1.2. Terminology 126 Bearer Token 127 A security token with the property that any party in possession of 128 the token (a "bearer") can use the token in any way that any other 129 party in possession of it can. Using a bearer token does not 130 require a bearer to prove possession of cryptographic key material 131 (proof-of-possession). 133 All other terms are as defined in OAuth 2.0 Authorization 134 [I-D.ietf-oauth-v2]. 136 1.3. Overview 138 OAuth provides a method for clients to access a protected resource on 139 behalf of a resource owner. In the general case, before a client can 140 access a protected resource, it must first obtain an authorization 141 grant from the resource owner and then exchange the authorization 142 grant for an access token. The access token represents the grant's 143 scope, duration, and other attributes granted by the authorization 144 grant. The client accesses the protected resource by presenting the 145 access token to the resource server. In some cases, a client can 146 directly present its own credentials to an authorization server to 147 obtain an access token without having to first obtain an 148 authorization grant from a resource owner. 150 The access token provides an abstraction, replacing different 151 authorization constructs (e.g. username and password, assertion) for 152 a single token understood by the resource server. This abstraction 153 enables issuing access tokens valid for a short time period, as well 154 as removing the resource server's need to understand a wide range of 155 authentication schemes. 157 +--------+ +---------------+ 158 | |--(A)- Authorization Request ->| Resource | 159 | | | Owner | 160 | |<-(B)-- Authorization Grant ---| | 161 | | +---------------+ 162 | | 163 | | Authorization Grant & +---------------+ 164 | |--(C)--- Client Credentials -->| Authorization | 165 | Client | | Server | 166 | |<-(D)----- Access Token -------| | 167 | | +---------------+ 168 | | 169 | | +---------------+ 170 | |--(E)----- Access Token ------>| Resource | 171 | | | Server | 172 | |<-(F)--- Protected Resource ---| | 173 +--------+ +---------------+ 175 Figure 1: Abstract Protocol Flow 177 The abstract flow illustrated in Figure 1 describes the overall OAuth 178 2.0 protocol architecture. The following steps are specified within 179 this document: 181 E) The client makes a protected resource request to the resource 182 server by presenting the access token. 184 F) The resource server validates the access token, and if valid, 185 serves the request. 187 2. Authenticated Requests 189 This section defines three methods of sending bearer access tokens in 190 resource requests to resource servers. Clients MUST NOT use more 191 than one method to transmit the token in each request. 193 2.1. Authorization Request Header Field 195 When sending the access token in the "Authorization" request header 196 field defined by HTTP/1.1, Part 7 [I-D.ietf-httpbis-p7-auth], the 197 client uses the "Bearer" authentication scheme to transmit the access 198 token. 200 For example: 202 GET /resource HTTP/1.1 203 Host: server.example.com 204 Authorization: Bearer vF9dft4qmT 206 The "Authorization" header field uses the framework defined by 207 HTTP/1.1, Part 7 [I-D.ietf-httpbis-p7-auth] as follows: 209 credentials = "Bearer" 1*SP b64token 211 The b64token syntax was chosen over the alternative #auth-param 212 syntax also defined by HTTP/1.1, Part 7 [I-D.ietf-httpbis-p7-auth] 213 both for simplicity and for compatibility with existing 214 implementations. If additional parameters are needed in the future, 215 a different scheme would need to be defined. 217 Clients SHOULD make authenticated requests with a bearer token using 218 the "Authorization" request header field with the "Bearer" HTTP 219 authorization scheme. Resource servers MUST support this method. 221 2.2. Form-Encoded Body Parameter 223 When sending the access token in the HTTP request entity-body, the 224 client adds the access token to the request body using the 225 "access_token" parameter. The client MUST NOT use this method unless 226 all of the following conditions are met: 228 o The HTTP request entity-body is single-part. 230 o The entity-body follows the encoding requirements of the 231 "application/x-www-form-urlencoded" content-type as defined by 232 HTML 4.01 [W3C.REC-html401-19991224]. 234 o The HTTP request entity-header includes the "Content-Type" header 235 field set to "application/x-www-form-urlencoded". 237 o The HTTP request method is one for which the request body has 238 defined semantics. In particular, this means that the "GET" 239 method MUST NOT be used. 241 o The content to be encoded in the entity-body MUST consist entirely 242 of ASCII characters. 244 The entity-body MAY include other request-specific parameters, in 245 which case, the "access_token" parameter MUST be properly separated 246 from the request-specific parameters using "&" character(s) (ASCII 247 code 38). 249 For example, the client makes the following HTTP request using 250 transport-layer security: 252 POST /resource HTTP/1.1 253 Host: server.example.com 254 Content-Type: application/x-www-form-urlencoded 256 access_token=vF9dft4qmT 258 The "application/x-www-form-urlencoded" method SHOULD NOT be used 259 except in application contexts where participating browsers do not 260 have access to the "Authorization" request header field. Resource 261 servers MAY support this method. 263 2.3. URI Query Parameter 265 When sending the access token in the HTTP request URI, the client 266 adds the access token to the request URI query component as defined 267 by Uniform Resource Identifier (URI) [RFC3986] using the 268 "access_token" parameter. 270 For example, the client makes the following HTTP request using 271 transport-layer security: 273 GET /resource?access_token=vF9dft4qmT HTTP/1.1 274 Host: server.example.com 276 The HTTP request URI query can include other request-specific 277 parameters, in which case, the "access_token" parameter MUST be 278 properly separated from the request-specific parameters using "&" 279 character(s) (ASCII code 38). 281 For example: 283 https://server.example.com/resource?x=y&access_token=vF9dft4qmT&p=q 285 Because of the security weaknesses associated with the URI method 286 (see Section 4), including the high likelihood that the URL 287 containing the access token will be logged, it SHOULD NOT be used 288 unless it is impossible to transport the access token in the 289 "Authorization" request header field or the HTTP request entity-body. 290 Resource servers MAY support this method. 292 3. The WWW-Authenticate Response Header Field 294 If the protected resource request does not include authentication 295 credentials or does not contain an access token that enables access 296 to the protected resource, the resource server MUST include the HTTP 297 "WWW-Authenticate" response header field; it MAY include it in 298 response to other conditions as well. The "WWW-Authenticate" header 299 field uses the framework defined by HTTP/1.1, Part 7 300 [I-D.ietf-httpbis-p7-auth] as follows: 302 challenge = "Bearer" [ 1*SP 1#param ] 304 param = realm / scope / 305 error / error-desc / error-uri / 306 auth-param 308 scope = "scope" "=" quoted-string 309 error = "error" "=" quoted-string 310 error-desc = "error_description" "=" quoted-string 311 error-uri = "error_uri" "=" quoted-string 313 A "realm" attribute MAY be included to indicate the scope of 314 protection in the manner described in HTTP/1.1, Part 7 315 [I-D.ietf-httpbis-p7-auth]. The "realm" attribute MUST NOT appear 316 more than once. The "realm" value is intended for programmatic use 317 and is not meant to be displayed to end users. 319 The "scope" attribute is a space-delimited list of scope values 320 indicating the required scope of the access token for accessing the 321 requested resource. In some cases, the "scope" value will be used 322 when requesting a new access token with sufficient scope of access to 323 utilize the protected resource. The "scope" attribute MUST NOT 324 appear more than once. The "scope" value is intended for 325 programmatic use and is not meant to be displayed to end users. 327 If the protected resource request included an access token and failed 328 authentication, the resource server SHOULD include the "error" 329 attribute to provide the client with the reason why the access 330 request was declined. The parameter value is described in 331 Section 3.1. In addition, the resource server MAY include the 332 "error_description" attribute to provide developers a human-readable 333 explanation that is not meant to be displayed to end users. It also 334 MAY include the "error_uri" attribute with an absolute URI 335 identifying a human-readable web page explaining the error. The 336 "error", "error_description", and "error_uri" attributes MUST NOT 337 appear more than once. 339 Producers of "scope" strings MUST NOT use characters outside the set 340 %x21 / %x23-5B / %x5D-7E for representing the scope values and %x20 341 for the delimiter. Producers of "error" and "error_description" 342 strings MUST NOT use characters outside the set %x20-21 / %x23-5B / 343 %x5D-7E for representing these values. Producers of "error-uri" 344 strings MUST NOT use characters outside the set %x21 / %x23-5B / 345 %x5D-7E for representing these values. Furthermore, "error-uri" 346 strings MUST conform to the URI-Reference syntax. In all these 347 cases, no character quoting will occur, as senders are prohibited 348 from using the %5C ('\') character. 350 For example, in response to a protected resource request without 351 authentication: 353 HTTP/1.1 401 Unauthorized 354 WWW-Authenticate: Bearer realm="example" 356 And in response to a protected resource request with an 357 authentication attempt using an expired access token: 359 HTTP/1.1 401 Unauthorized 360 WWW-Authenticate: Bearer realm="example", 361 error="invalid_token", 362 error_description="The access token expired" 364 3.1. Error Codes 366 When a request fails, the resource server responds using the 367 appropriate HTTP status code (typically, 400, 401, 403, or 405), and 368 includes one of the following error codes in the response: 370 invalid_request 371 The request is missing a required parameter, includes an 372 unsupported parameter or parameter value, repeats the same 373 parameter, uses more than one method for including an access 374 token, or is otherwise malformed. The resource server SHOULD 375 respond with the HTTP 400 (Bad Request) status code. 377 invalid_token 378 The access token provided is expired, revoked, malformed, or 379 invalid for other reasons. The resource SHOULD respond with 380 the HTTP 401 (Unauthorized) status code. The client MAY 381 request a new access token and retry the protected resource 382 request. 384 insufficient_scope 385 The request requires higher privileges than provided by the 386 access token. The resource server SHOULD respond with the HTTP 387 403 (Forbidden) status code and MAY include the "scope" 388 attribute with the scope necessary to access the protected 389 resource. 391 If the request lacks any authentication information (i.e. the client 392 was unaware authentication is necessary or attempted using an 393 unsupported authentication method), the resource server SHOULD NOT 394 include an error code or other error information. 396 For example: 398 HTTP/1.1 401 Unauthorized 399 WWW-Authenticate: Bearer realm="example" 401 4. Security Considerations 403 This section describes the relevant security threats regarding token 404 handling when using bearer tokens and describes how to mitigate these 405 threats. 407 4.1. Security Threats 409 The following list presents several common threats against protocols 410 utilizing some form of tokens. This list of threats is based on NIST 411 Special Publication 800-63 [NIST800-63]. Since this document builds 412 on the OAuth 2.0 specification, we exclude a discussion of threats 413 that are described there or in related documents. 415 Token manufacture/modification: An attacker may generate a bogus 416 token or modify the token contents (such as the authentication or 417 attribute statements) of an existing token, causing the resource 418 server to grant inappropriate access to the client. For example, 419 an attacker may modify the token to extend the validity period; a 420 malicious client may modify the assertion to gain access to 421 information that they should not be able to view. 423 Token disclosure: Tokens may contain authentication and attribute 424 statements that include sensitive information. 426 Token redirect: An attacker uses a token generated for consumption 427 by one resource server to gain access to a different resource 428 server that mistakenly believes the token to be for it. 430 Token replay: An attacker attempts to use a token that has already 431 been used with that resource server in the past. 433 4.2. Threat Mitigation 435 A large range of threats can be mitigated by protecting the contents 436 of the token by using a digital signature or a Message Authentication 437 Code (MAC). Alternatively, a bearer token can contain a reference to 438 authorization information, rather than encoding the information 439 directly. Such references MUST be infeasible for an attacker to 440 guess; using a reference may require an extra interaction between a 441 server and the token issuer to resolve the reference to the 442 authorization information. The mechanics of such an interaction are 443 not defined by this specification. 445 This document does not specify the encoding or the contents of the 446 token; hence detailed recommendations about the means of guaranteeing 447 token integrity protection are outside the scope of this document. 448 The token integrity protection MUST be sufficient to prevent the 449 token from being modified. 451 To deal with token redirect, it is important for the authorization 452 server to include the identity of the intended recipients (the 453 audience), typically a single resource server (or a list of resource 454 servers), in the token. Restricting the use of the token to a 455 specific scope is also RECOMMENDED. 457 The authorization server MUST implement TLS. Which version(s) ought 458 to be implemented will vary over time, and depend on the widespread 459 deployment and known security vulnerabilities at the time of 460 implementation. At the time of this writing, TLS version 1.2 461 [RFC5246] is the most recent version, but has very limited actual 462 deployment, and might not be readily available in implementation 463 toolkits. TLS version 1.0 [RFC2246] is the most widely deployed 464 version, and will give the broadest interoperability. 466 To protect against token disclosure, confidentiality protection MUST 467 be applied using TLS [RFC5246] with a ciphersuite that provides 468 confidentiality and integrity protection. This requires that the 469 communication interaction between the client and the authorization 470 server, as well as the interaction between the client and the 471 resource server, utilize confidentiality and integrity protection. 472 Since TLS is mandatory to implement and to use with this 473 specification, it is the preferred approach for preventing token 474 disclosure via the communication channel. For those cases where the 475 client is prevented from observing the contents of the token, token 476 encryption MUST be applied in addition to the usage of TLS 477 protection. As a further defense against token disclosure, the 478 client MUST validate the TLS certificate chain when making requests 479 to protected resources. 481 Cookies are typically transmitted in the clear. Thus, any 482 information contained in them is at risk of disclosure. Therefore, 483 bearer tokens MUST NOT be stored in cookies that can be sent in the 484 clear. 486 In some deployments, including those utilizing load balancers, the 487 TLS connection to the resource server terminates prior to the actual 488 server that provides the resource. This could leave the token 489 unprotected between the front end server where the TLS connection 490 terminates and the back end server that provides the resource. In 491 such deployments, sufficient measures MUST be employed to ensure 492 confidentiality of the token between the front end and back end 493 servers; encryption of the token is one possible such measure. 495 To deal with token capture and replay, the following recommendations 496 are made: First, the lifetime of the token MUST be limited; one means 497 of achieving this is by putting a validity time field inside the 498 protected part of the token. Note that using short-lived (one hour 499 or less) tokens reduces the impact of them being leaked. Second, 500 confidentiality protection of the exchanges between the client and 501 the authorization server and between the client and the resource 502 server MUST be applied. As a consequence, no eavesdropper along the 503 communication path is able to observe the token exchange. 504 Consequently, such an on-path adversary cannot replay the token. 505 Furthermore, when presenting the token to a resource server, the 506 client MUST verify the identity of that resource server, as per 507 Representation and Verification of Domain-Based Application Service 508 Identity within Internet Public Key Infrastructure Using X.509 (PKIX) 509 Certificates in the Context of Transport Layer Security (TLS) 510 [RFC6125]. Note that the client MUST validate the TLS certificate 511 chain when making these requests to protected resources. Presenting 512 the token to an unauthenticated and unauthorized resource server or 513 failing to validate the certificate chain will allow adversaries to 514 steal the token and gain unauthorized access to protected resources. 516 4.3. Summary of Recommendations 518 Safeguard bearer tokens: Client implementations MUST ensure that 519 bearer tokens are not leaked to unintended parties, as they will 520 be able to use them to gain access to protected resources. This 521 is the primary security consideration when using bearer tokens and 522 underlies all the more specific recommendations that follow. 524 Validate SSL certificate chains: The client MUST validate the TLS 525 certificate chain when making requests to protected resources. 526 Failing to do so may enable DNS hijacking attacks to steal the 527 token and gain unintended access. 529 Always use TLS (https): Clients MUST always use TLS [RFC5246] 530 (https) or equivalent transport security when making requests with 531 bearer tokens. Failing to do so exposes the token to numerous 532 attacks that could give attackers unintended access. 534 Don't store bearer tokens in cookies: Implementations MUST NOT store 535 bearer tokens within cookies that can be sent in the clear (which 536 is the default transmission mode for cookies). Implementations 537 that do store bearer tokens in cookies MUST take precautions 538 against cross site request forgery. 540 Issue short-lived bearer tokens: Token servers SHOULD issue short- 541 lived (one hour or less) bearer tokens, particularly when issuing 542 tokens to clients that run within a web browser or other 543 environments where information leakage may occur. Using short- 544 lived bearer tokens can reduce the impact of them being leaked. 546 Issue scoped bearer tokens: Token servers SHOULD issue bearer tokens 547 that contain an audience restriction, scoping their use to the 548 intended relying party or set of relying parties. 550 Don't pass bearer tokens in page URLs: Bearer tokens SHOULD NOT be 551 passed in page URLs (for example as query string parameters). 552 Instead, bearer tokens SHOULD be passed in HTTP message headers or 553 message bodies for which confidentiality measures are taken. 554 Browsers, web servers, and other software may not adequately 555 secure URLs in the browser history, web server logs, and other 556 data structures. If bearer tokens are passed in page URLs, 557 attackers might be able to steal them from the history data, logs, 558 or other unsecured locations. 560 5. IANA Considerations 562 5.1. OAuth Access Token Type Registration 564 This specification registers the following access token type in the 565 OAuth Access Token Type Registry. 567 5.1.1. The "Bearer" OAuth Access Token Type 569 Type name: 570 Bearer 572 Additional Token Endpoint Response Parameters: 573 (none) 575 HTTP Authentication Scheme(s): 576 Bearer 578 Change controller: 579 IETF 581 Specification document(s): 582 [[ this document ]] 584 5.2. Authentication Scheme Registration 586 This specification registers the following authentication scheme in 587 the Authentication Scheme Registry defined in HTTP/1.1, Part 7 588 [I-D.ietf-httpbis-p7-auth]. 590 5.2.1. The "Bearer" Authentication Scheme 592 Authentication Scheme Name: 593 Bearer 595 Pointer to specification text: 596 [[ this document ]] 598 Notes (optional): 599 (none) 601 6. References 603 6.1. Normative References 605 [I-D.ietf-httpbis-p1-messaging] 606 Fielding, R., Gettys, J., Mogul, J., Nielsen, H., 607 Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., and 608 J. Reschke, "HTTP/1.1, part 1: URIs, Connections, and 609 Message Parsing", draft-ietf-httpbis-p1-messaging-17 (work 610 in progress), October 2011. 612 [I-D.ietf-httpbis-p7-auth] 613 Fielding, R., Gettys, J., Mogul, J., Nielsen, H., 614 Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., and 615 J. Reschke, "HTTP/1.1, part 7: Authentication", 616 draft-ietf-httpbis-p7-auth-17 (work in progress), 617 October 2011. 619 [I-D.ietf-oauth-v2] 620 Hammer-Lahav, E., Recordon, D., and D. Hardt, "The OAuth 621 2.0 Authorization Protocol", draft-ietf-oauth-v2-22 (work 622 in progress), September 2011. 624 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 625 Requirement Levels", BCP 14, RFC 2119, March 1997. 627 [RFC2246] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", 628 RFC 2246, January 1999. 630 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 631 Resource Identifier (URI): Generic Syntax", STD 66, 632 RFC 3986, January 2005. 634 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 635 Specifications: ABNF", STD 68, RFC 5234, January 2008. 637 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 638 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 640 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 641 Verification of Domain-Based Application Service Identity 642 within Internet Public Key Infrastructure Using X.509 643 (PKIX) Certificates in the Context of Transport Layer 644 Security (TLS)", RFC 6125, March 2011. 646 [W3C.REC-html401-19991224] 647 Raggett, D., Hors, A., and I. Jacobs, "HTML 4.01 648 Specification", World Wide Web Consortium 649 Recommendation REC-html401-19991224, December 1999, 650 . 652 6.2. Informative References 654 [NIST800-63] 655 Burr, W., Dodson, D., Perlner, R., Polk, T., Gupta, S., 656 and E. Nabbus, "NIST Special Publication 800-63-1, 657 INFORMATION SECURITY", December 2008. 659 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 660 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 661 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 663 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 664 Leach, P., Luotonen, A., and L. Stewart, "HTTP 665 Authentication: Basic and Digest Access Authentication", 666 RFC 2617, June 1999. 668 Appendix A. Acknowledgements 670 The following people contributed to preliminary versions of this 671 document: Blaine Cook (BT), Brian Eaton (Google), Yaron Y. Goland 672 (Microsoft), Brent Goldman (Facebook), Raffi Krikorian (Twitter), 673 Luke Shepard (Facebook), and Allen Tom (Yahoo!). The content and 674 concepts within are a product of the OAuth community, the WRAP 675 community, and the OAuth Working Group. 677 The OAuth Working Group has dozens of very active contributors who 678 proposed ideas and wording for this document, including: Michael 679 Adams, Amanda Anganes, Andrew Arnott, Dirk Balfanz, John Bradley, 680 Brian Campbell, Leah Culver, Bill de hOra, Brian Ellin, Igor 681 Faynberg, Stephen Farrell, George Fletcher, Tim Freeman, Evan 682 Gilbert, Yaron Y. Goland, Thomas Hardjono, Justin Hart, Phil Hunt, 683 John Kemp, Eran Hammer-Lahav, Chasen Le Hara, Barry Leiba, Michael B. 684 Jones, Torsten Lodderstedt, Eve Maler, James Manger, Laurence Miao, 685 William J. Mills, Chuck Mortimore, Anthony Nadalin, Julian Reschke, 686 Justin Richer, Peter Saint-Andre, Nat Sakimura, Rob Sayre, Marius 687 Scurtescu, Naitik Shah, Justin Smith, Jeremy Suriel, Christian 688 Stuebner, Paul Tarjan, Hannes Tschofenig, Franklin Tse, and Shane 689 Weeden. 691 Appendix B. Document History 693 [[ to be removed by the RFC editor before publication as an RFC ]] 695 -15 697 o Clarified that form-encoded content must consist entirely of ASCII 698 characters. 700 o Added TLS version requirements. 702 o Applied editorial improvements suggested by Mark Nottingham during 703 the APPS area review. 705 -14 707 o Changes made in response to review comments by Security Area 708 Director Stephen Farrell. Specifically: 710 o Strengthened warnings about passing an access token as a query 711 parameter and more precisely described the limitations placed upon 712 the use of this method. 714 o Clarified that the "realm" attribute MAY included to indicate the 715 scope of protection in the manner described in HTTP/1.1, Part 7 716 [I-D.ietf-httpbis-p7-auth]. 718 o Normatively stated that "the token integrity protection MUST be 719 sufficient to prevent the token from being modified". 721 o Added statement that "TLS is mandatory to implement and use with 722 this specification" to the introduction. 724 o Stated that TLS MUST be used with "a ciphersuite that provides 725 confidentiality and integrity protection". 727 o Added "As a further defense against token disclosure, the client 728 MUST validate the TLS certificate chain when making requests to 729 protected resources" to the Threat Mitigation section. 731 o Clarified that putting a validity time field inside the protected 732 part of the token is one means, but not the only means, of 733 limiting the lifetime of the token. 735 o Dropped the confusing phrase "for instance, through the use of 736 TLS" from the sentence about confidentiality protection of the 737 exchanges. 739 o Reference RFC 6125 for identity verification, rather than RFC 740 2818. 742 o Stated that the token MUST be protected between front end and back 743 end servers when the TLS connection terminates at a front end 744 server that is distinct from the actual server that provides the 745 resource. 747 o Stated that bearer tokens MUST not be stored in cookies that can 748 be sent in the clear in the Threat Mitigation section. 750 o Replaced sole remaining reference to [RFC2616] with HTTPbis 751 [I-D.ietf-httpbis-p1-messaging] reference. 753 o Replaced all references where the reference is used as if it were 754 part of the sentence (such as "defined by [I-D.whatever]") with 755 ones where the specification name is used, followed by the 756 reference (such as "defined by Whatever [I-D.whatever]"). 758 o Other on-normative editorial improvements. 760 -13 762 o At the request of Hannes Tschofenig, made ABNF changes to make it 763 clear that no special WWW-Authenticate response header field 764 parsers are needed. The "scope", "error-description", and 765 "error-uri" parameters are all now defined as quoted-string in the 766 ABNF (as "error" already was). Restrictions on these values that 767 were formerly described in the ABNFs are now described in 768 normative text instead. 770 -12 772 o Made non-normative editorial changes that Hannes Tschofenig 773 requested be applied prior to forwarding the specification to the 774 IESG. 776 o Added rationale for the choice of the b64token syntax. 778 o Added rationale stating that receivers are free to parse the 779 "scope" attribute using a standard quoted-string parser, since it 780 will correctly process all legal "scope" values. 782 o Added additional active working group contributors to the 783 Acknowledgements section. 785 -11 787 o Replaced uses of <"> with DQUOTE to pass ABNF syntax check. 789 -10 791 o Removed the #auth-param option from Authorization header syntax 792 (leaving only the b64token syntax). 794 o Restricted the "scope" value character set to %x21 / %x23-5B / 795 %x5D-7E (printable ASCII characters excluding double-quote and 796 backslash). Indicated that scope is intended for programmatic use 797 and is not meant to be displayed to end users. 799 o Restricted the character set for "error_description" strings to SP 800 / VCHAR and indicated that they are not meant to be displayed to 801 end users. 803 o Included more description in the Abstract, since Hannes Tschofenig 804 indicated that the RFC editor would require this. 806 o Changed "Access Grant" to "Authorization Grant", as was done in 807 the core spec. 809 o Simplified the introduction to the Authenticated Requests section. 811 -09 812 o Incorporated working group last call comments. Specific changes 813 were: 815 o Use definitions from [I-D.ietf-httpbis-p7-auth] rather than 816 [RFC2617]. 818 o Update credentials definition to conform to 819 [I-D.ietf-httpbis-p7-auth]. 821 o Further clarified that query parameters may occur in any order. 823 o Specify that error_description is UTF-8 encoded (matching the core 824 specification). 826 o Registered "Bearer" Authentication Scheme in Authentication Scheme 827 Registry defined by [I-D.ietf-httpbis-p7-auth]. 829 o Updated references to oauth-v2, httpbis-p1-messaging, and httpbis- 830 p7-auth drafts. 832 o Other wording improvements not introducing normative changes. 834 -08 836 o Updated references to oauth-v2 and HTTPbis drafts. 838 -07 840 o Added missing comma in error response example. 842 -06 844 o Changed parameter name "bearer_token" to "access_token", per 845 working group consensus. 847 o Changed HTTP status code for "invalid_request" error code from 848 HTTP 401 (Unauthorized) back to HTTP 400 (Bad Request), per input 849 from HTTP working group experts. 851 -05 853 o Removed OAuth Errors Registry, per design team input. 855 o Changed HTTP status code for "invalid_request" error code from 856 HTTP 400 (Bad Request) to HTTP 401 (Unauthorized) to match HTTP 857 usage [[ change pending working group consensus ]]. 859 o Added missing quotation marks in error-uri definition. 861 o Added note to add language and encoding information to 862 error_description if the core specification does. 864 o Explicitly reference the Augmented Backus-Naur Form (ABNF) defined 865 in [RFC5234]. 867 o Use auth-param instead of repeating its definition, which is ( 868 token "=" ( token / quoted-string ) ). 870 o Clarify security considerations about including an audience 871 restriction in the token and include a recommendation to issue 872 scoped bearer tokens in the summary of recommendations. 874 -04 876 o Edits responding to working group last call feedback on -03. 877 Specific edits enumerated below. 879 o Added Bearer Token definition in Terminology section. 881 o Changed parameter name "oauth_token" to "bearer_token". 883 o Added realm parameter to "WWW-Authenticate" response to comply 884 with [RFC2617]. 886 o Removed "[ RWS 1#auth-param ]" from "credentials" definition since 887 it did not comply with the ABNF in [I-D.ietf-httpbis-p7-auth]. 889 o Removed restriction that the "bearer_token" (formerly 890 "oauth_token") parameter be the last parameter in the entity-body 891 and the HTTP request URI query. 893 o Do not require WWW-Authenticate Response in a reply to a malformed 894 request, as an HTTP 400 Bad Request response without a WWW- 895 Authenticate header is likely the right response in some cases of 896 malformed requests. 898 o Removed OAuth Parameters registry extension. 900 o Numerous editorial improvements suggested by working group 901 members. 903 -03 905 o Restored the WWW-Authenticate response header functionality 906 deleted from the framework specification in draft 12 based upon 907 the specification text from draft 11. 909 o Augmented the OAuth Parameters registry by adding two additional 910 parameter usage locations: "resource request" and "resource 911 response". 913 o Registered the "oauth_token" OAuth parameter with usage location 914 "resource request". 916 o Registered the "error" OAuth parameter. 918 o Created the OAuth Error registry and registered errors. 920 o Changed the "OAuth2" OAuth access token type name to "Bearer". 922 -02 924 o Incorporated feedback received on draft 01. Most changes were to 925 the security considerations section. No normative changes were 926 made. Specific changes included: 928 o Changed terminology from "token reuse" to "token capture and 929 replay". 931 o Removed sentence "Encrypting the token contents is another 932 alternative" from the security considerations since it was 933 redundant and potentially confusing. 935 o Corrected some references to "resource server" to be 936 "authorization server" in the security considerations. 938 o Generalized security considerations language about obtaining 939 consent of the resource owner. 941 o Broadened scope of security considerations description for 942 recommendation "Don't pass bearer tokens in page URLs". 944 o Removed unused reference to OAuth 1.0. 946 o Updated reference to framework specification and updated David 947 Recordon's e-mail address. 949 o Removed security considerations text on authenticating clients. 951 o Registered the "OAuth2" OAuth access token type and "oauth_token" 952 parameter. 954 -01 955 o First public draft, which incorporates feedback received on -00 956 including enhanced Security Considerations content. This version 957 is intended to accompany OAuth 2.0 draft 11. 959 -00 961 o Initial draft based on preliminary version of OAuth 2.0 draft 11. 963 Authors' Addresses 965 Michael B. Jones 966 Microsoft 968 Email: mbj@microsoft.com 969 URI: http://self-issued.info/ 971 Dick Hardt 972 independent 974 Email: dick.hardt@gmail.com 975 URI: http://dickhardt.org/ 977 David Recordon 978 Facebook 980 Email: dr@fb.com 981 URI: http://www.davidrecordon.com/