idnits 2.17.1 draft-ietf-oauth-authentication-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** The document seems to lack a License Notice according IETF Trust Provisions of 28 Dec 2009, Section 6.b.i or Provisions of 12 Sep 2009 Section 6.b -- however, there's a paragraph with a matching beginning. Boilerplate error? (You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Feb 2009 rather than one of the newer Notices. See https://trustee.ietf.org/license-info/.) 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 (July 6, 2009) is 5380 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) ** Downref: Normative reference to an Informational RFC: RFC 2104 ** Obsolete normative reference: RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) ** Obsolete normative reference: RFC 2617 (Obsoleted by RFC 7235, RFC 7615, RFC 7616, RFC 7617) ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) Summary: 5 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group E. Hammer-Lahav, Ed. 3 Internet-Draft Yahoo! 4 Intended status: Standards Track July 6, 2009 5 Expires: January 7, 2010 7 The OAuth Protocol: Authentication 8 draft-ietf-oauth-authentication-01 10 Status of this Memo 12 This Internet-Draft is submitted to IETF in full conformance with the 13 provisions of BCP 78 and BCP 79. 15 Internet-Drafts are working documents of the Internet Engineering 16 Task Force (IETF), its areas, and its working groups. Note that 17 other groups may also distribute working documents as Internet- 18 Drafts. 20 Internet-Drafts are draft documents valid for a maximum of six months 21 and may be updated, replaced, or obsoleted by other documents at any 22 time. It is inappropriate to use Internet-Drafts as reference 23 material or to cite them other than as "work in progress." 25 The list of current Internet-Drafts can be accessed at 26 http://www.ietf.org/ietf/1id-abstracts.txt. 28 The list of Internet-Draft Shadow Directories can be accessed at 29 http://www.ietf.org/shadow.html. 31 This Internet-Draft will expire on January 7, 2010. 33 Copyright Notice 35 Copyright (c) 2009 IETF Trust and the persons identified as the 36 document authors. All rights reserved. 38 This document is subject to BCP 78 and the IETF Trust's Legal 39 Provisions Relating to IETF Documents in effect on the date of 40 publication of this document (http://trustee.ietf.org/license-info). 41 Please review these documents carefully, as they describe your rights 42 and restrictions with respect to this document. 44 Abstract 46 This document specifies the OAuth protocol authentication method. 47 OAuth allows clients to access server resources on behalf of another 48 party (such a different client or an end user). This document 49 defines an HTTP authentication method which supports the ability to 50 include two sets of credential with each request, one identifying the 51 client and another identifying the resource owner on whose behalf the 52 request is made. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 57 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 58 2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 4 59 3. Authenticated Requests . . . . . . . . . . . . . . . . . . . . 4 60 4. Protocol Parameters . . . . . . . . . . . . . . . . . . . . . 5 61 5. Nonce and Timestamp . . . . . . . . . . . . . . . . . . . . . 6 62 6. Signature . . . . . . . . . . . . . . . . . . . . . . . . . . 6 63 6.1. Signature Base String . . . . . . . . . . . . . . . . . . 7 64 6.1.1. Collect Request Parameters . . . . . . . . . . . . . . 7 65 6.1.2. Normalize Request Parameters . . . . . . . . . . . . . 9 66 6.1.3. Construct Base String URI . . . . . . . . . . . . . . 10 67 6.1.4. Concatenate Base String Elements . . . . . . . . . . . 11 68 6.2. HMAC-SHA1 . . . . . . . . . . . . . . . . . . . . . . . . 11 69 6.3. RSA-SHA1 . . . . . . . . . . . . . . . . . . . . . . . . . 12 70 6.4. PLAINTEXT . . . . . . . . . . . . . . . . . . . . . . . . 13 71 7. Parameter Transmission . . . . . . . . . . . . . . . . . . . . 13 72 7.1. Authorization Header . . . . . . . . . . . . . . . . . . . 14 73 7.2. Form-Encoded Body . . . . . . . . . . . . . . . . . . . . 15 74 7.3. Request URI Query . . . . . . . . . . . . . . . . . . . . 15 75 8. Server Response . . . . . . . . . . . . . . . . . . . . . . . 15 76 9. Percent Encoding . . . . . . . . . . . . . . . . . . . . . . . 16 77 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 78 11. Security Considerations . . . . . . . . . . . . . . . . . . . 17 79 11.1. RSA-SHA1 Signature Method . . . . . . . . . . . . . . . . 17 80 11.2. PLAINTEXT Signature Method . . . . . . . . . . . . . . . . 17 81 11.3. Confidentiality of Requests . . . . . . . . . . . . . . . 17 82 11.4. Spoofing by Counterfeit Servers . . . . . . . . . . . . . 18 83 11.5. Proxying and Caching of Authenticated Content . . . . . . 18 84 11.6. Plaintext Storage of Credentials . . . . . . . . . . . . . 18 85 11.7. Secrecy of the Client Credentials . . . . . . . . . . . . 18 86 11.8. Cryptographic Attacks . . . . . . . . . . . . . . . . . . 19 87 11.9. Signature Base String Limitations . . . . . . . . . . . . 19 88 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 19 89 Appendix B. Acknowledgments . . . . . . . . . . . . . . . . . . . 19 90 Appendix C. Document History . . . . . . . . . . . . . . . . . . 20 91 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 20 92 12.1. Normative References . . . . . . . . . . . . . . . . . . . 20 93 12.2. Informative References . . . . . . . . . . . . . . . . . . 21 94 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 21 96 1. Introduction 98 The OAuth protocol provides a method for servers to allow third-party 99 access to protected resources, without forcing their end users to 100 share their credentials. This pattern is common among services that 101 allow third-party developers to extend the service functionality, by 102 building applications using an open API. 104 For example, a web user (resource owner) can grant a printing service 105 (client) access to its private photos stored at a photo sharing 106 service (server), without sharing its credentials with the printing 107 service. Instead, the user authenticates directly with the photo 108 sharing service and issue the printing service delegation-specific 109 credentials. 111 OAuth introduces a third role to the traditional client-server 112 authentication model: the resource owner. In the OAuth model, the 113 client requests access to resources hosted by the server but not 114 controlled by the client, but by the resource owner. In addition, 115 OAuth allows the server to verify not only the resource owner's 116 credentials, but also those of the client making the request. 118 In order for the client to access resources, it first has to obtain 119 permission from the resource owner. This permission is expressed in 120 the form of a token and matching shared-secret. The purpose of the 121 token is to substitute the need for the resource owner to share its 122 server credentials (usually a username and password pair) with the 123 client. Unlike server credentials, tokens can be issued with a 124 restricted scope and limited lifetime. 126 This specification consists of two parts. This document defines a 127 method for making authenticated HTTP requests using two sets of 128 credentials, one identifying the client making the request, and a 129 second identifying the resource owner on whose behalf the request is 130 being made. 132 [draft-ietf-oauth-web-delegation] defines a redirection-based user 133 agent process for end users to authorize client access to their 134 resources, by authenticating directly with the server and 135 provisioning tokens to the client for use with the authentication 136 method. 138 1.1. Terminology 139 client 140 An HTTP client (per [RFC2616]) capable of making OAuth- 141 authenticated requests. 143 server 144 An HTTP server (per [RFC2616]) capable of accepting OAuth- 145 authenticated requests. 147 protected resource 148 An access-restricted resource (per [RFC2616]) which can be 149 obtained from the server using an OAuth-authenticated request. 151 resource owner 152 An entity capable of accessing and controlling protected 153 resources by using credentials to authenticate with the server. 155 token 156 An unique identifier issued by the server and used by the 157 client to associate authenticated requests with the resource 158 owner whose authorization is requested or has been obtained by 159 the client. Tokens have a matching shared-secret that is used 160 by the client to establish its ownership of the token, and its 161 authority to represent the resource owner. 163 2. Notational Conventions 165 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 166 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 167 document are to be interpreted as described in [RFC2119]. 169 3. Authenticated Requests 171 The HTTP authentication methods defined by [RFC2617], enable clients 172 to make authenticated HTTP requests. Clients using these methods 173 gain access to protected resource by using their server credentials 174 (typically a username and password pair), which allows the server to 175 verify their authenticity. Using these methods for delegation 176 requires the client to pretend it was the resource owner. 178 OAuth provides a method designed to include two sets of credentials 179 with each request, one to identify the client, and another to 180 identify the resource owner. Before a client can make authenticated 181 requests on behalf of the resource owner, it must obtain a token 182 authorized by the resource owner. [draft-ietf-oauth-web-delegation] 183 provides one such method in which the client can obtain a token 184 authorized by the resource owner. 186 The client credentials take the form of a unique identifier, and an 187 associated share-secret or RSA key pair. Prior to making 188 authenticated requests, the client establishes a set of credentials 189 with the server. The process and requirements for provisioning these 190 are outside the scope of this specification. Implementers are urged 191 to consider the security ramification of using client credentials, 192 some of which are described in Section 11.7. 194 Making authenticated requests requires prior knowledge of the 195 server's configuration. OAuth provides multiple methods for 196 including protocol parameters in requests (Section 7), as well as 197 multiple methods for the client to prove its rightful ownership of 198 the credentials used (Section 6). The way in which clients discovery 199 the required configuration is outside the scope of this 200 specification. 202 4. Protocol Parameters 204 An OAuth-authenticated request includes several protocol parameters. 205 Each parameter name begins with the "oauth_" prefix, and the 206 parameter names and values are case sensitive. Protocol parameters 207 MUST NOT appear more than once per request. The parameters are: 209 oauth_consumer_key 210 The identifier portion of the client credentials (equivalent to 211 a username). The parameter name reflects a deprecated term 212 (Consumer Key) used in previous revisions of the specification, 213 and has been retained to maintain backward compatibility. 215 oauth_token 216 The token value used to associate the request with the resource 217 owner. If the request is not associated with a resource owner 218 (no token), clients MAY omit the parameter. 220 oauth_signature_method 221 The name of the signature method used by the client to sign the 222 request, as defined in Section 6. 224 oauth_signature 225 The signature value as defined in Section 6. 227 oauth_timestamp 228 The timestamp value as defined in Section 5. 230 oauth_nonce 231 The nonce value as defined in Section 5. 233 oauth_version 234 The protocol version. If omitted, the protocol version 235 defaults to "1.0". 237 Server-specific request parameters MUST NOT begin with the "oauth_" 238 prefix. 240 5. Nonce and Timestamp 242 Unless otherwise specified by the server, the timestamp is expressed 243 in the number of seconds since January 1, 1970 00:00:00 GMT. The 244 timestamp value MUST be a positive integer and MUST be equal or 245 greater than the timestamp used in previous requests with the same 246 client credentials and token credentials combination. 248 A nonce is a random string, uniquely generated to allows the server 249 to verify that a request has never been made before and helps prevent 250 replay attacks when requests are made over a non-secure channel. The 251 nonce value MUST be unique across all requests with the same 252 timestamp, client credentials, and token combinations. 254 To avoid the need to retain an infinite number of nonce values for 255 future checks, servers MAY choose to restrict the time period after 256 which a request with an old timestamp is rejected. Server applying 257 such restriction SHOULD provide a way for the client to sync its 258 clock with the server's clock. 260 6. Signature 262 OAuth-authenticated requests can have two sets of credentials 263 included via the "oauth_consumer_key" parameter and the "oauth_token" 264 parameter. In order for the server to verify the authenticity of the 265 request and prevent unauthorized access, the client needs to prove it 266 is the rightful owner of the credentials. This is accomplished using 267 the shared-secret (or RSA key) part of each set of credentials. 269 OAuth provides three methods for the client to prove its rightful 270 ownership of the credentials: "HMAC-SHA1", "RSA-SHA1", and 271 "PLAINTEXT". These methods are generally referred to as signature 272 methods, even though "PLAINTEXT" does not involve a signature. In 273 addition, "RSA-SHA1" utilizes an RSA key instead of the shared- 274 secrets associated with the client credentials. 276 OAuth does not mandate a particular signature method, as each 277 implementation can have its own unique requirements. Servers are 278 free to implement and document their own custom methods. 279 Recommending any particular method is beyond the scope of this 280 specification. 282 The client declares which signature method is used via the 283 "oauth_signature_method" parameter. It then generates a signature 284 (or a sting of an equivalent value), and includes it in the 285 "oauth_signature" parameter. The server verifies the signature as 286 specified for each method. 288 The signature process does not change the request or its parameter, 289 with the exception of the "oauth_signature" parameter. 291 6.1. Signature Base String 293 The signature base string is a consistent, reproducible concatenation 294 of several request elements into a single string. The string is used 295 as an input to the "HMAC-SHA1" and "RSA-SHA1" signature methods, or 296 potential future extension. 298 The signature base string does not cover the entire HTTP request. 299 Most notably, it does not include the entity-body in most requests, 300 nor does it include most HTTP entity-headers. The importance of the 301 signature base string scope is that the authenticity of the excluded 302 components cannot be verified using the signature. 304 6.1.1. Collect Request Parameters 306 The signature base string includes a specific set of request 307 parameters. In order for the parameter to be included in the 308 signature base string, they MUST be used in their unencoded form. 310 For example, the URI: 312 http://example.com/request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2q 314 contains the following raw-form parameters: 316 +------+-------+ 317 | Name | Value | 318 +------+-------+ 319 | b5 | =%3D | 320 | a3 | a | 321 | c@ | | 322 | a2 | r b | 323 | c2 | | 324 | a3 | 2q | 325 +------+-------+ 327 Note that the value of "b5" is "=%3D" and not "==". Both "c@" and 328 "c2" have empty values. 330 The request parameters, which include both protocol parameters and 331 request-specific parameters, are extracted and restored to their 332 original unencoded form, from the following sources: 334 o The OAuth HTTP Authorization header (Section 7.1). The "realm" 335 parameter MUST be excluded if present. 337 o The HTTP request entity-body, but only if: 339 * The entity-body is single-part. 341 * The entity-body follows the encoding requirements of the 342 "application/x-www-form-urlencoded" content-type as defined by 343 [W3C.REC-html40-19980424]. 345 * The HTTP request entity-header includes the "Content-Type" 346 header set to "application/x-www-form-urlencoded". 348 o The query component of the HTTP request URI as defined by 349 [RFC3986] section 3. 351 The "oauth_signature" parameter MUST be excluded if present. 353 In many cases, clients have direct access to the parameters in their 354 original, unencoded form. In such cases, clients SHOULD use the 355 unencoded values instead of extracting them. This option is not 356 available for servers when validating incoming requests. Even though 357 the parameters are encoded again in the process, they are decoded 358 because each of the three sources uses a different encoding 359 algorithm. 361 The output of this step is a list of unencoded parameter name / value 362 pairs. 364 6.1.2. Normalize Request Parameters 366 The parameter collected in Section 6.1.1 are normalized into a single 367 string as follows: 369 1. First, the name and value of each parameter are encoded 370 (Section 9). 372 2. The parameters are sorted by name, using lexicographical byte 373 value ordering. If two or more parameters share the same name, 374 they are sorted by their value. 376 3. The name of each parameter is concatenated to its corresponding 377 value using an "=" character (ASCII code 61) as separator, even 378 if the value is empty. 380 4. The sorted name / value pairs are concatenated together into a 381 single string by using an "&" character (ASCII code 38) as 382 separator. 384 For example, the list of parameters from the previous section would 385 be normalized as follows: 387 Encoded: 389 +------+----------+ 390 | Name | Value | 391 +------+----------+ 392 | b5 | %3D%253D | 393 | a3 | a | 394 | c%40 | | 395 | a2 | r%20b | 396 | c2 | | 397 | a3 | 2q | 398 +------+----------+ 399 Sorted: 401 +------+----------+ 402 | Name | Value | 403 +------+----------+ 404 | a2 | r%20b | 405 | a3 | 2q | 406 | a3 | a | 407 | b5 | %3D%253D | 408 | c%40 | | 409 | c2 | | 410 +------+----------+ 412 Concatenated Pairs: 414 +-------------+ 415 | Name=Value | 416 +-------------+ 417 | a2=r%20b | 418 | a3=2q | 419 | a3=a | 420 | b5=%3D%253D | 421 | c%40= | 422 | c2= | 423 +-------------+ 425 And concatenated together into a single string: 427 a2=r%20b&a3=2q&a3=a&b5=%3D%253D&c%40=&c2= 429 6.1.3. Construct Base String URI 431 The signature base string incorporates the scheme, authority, and 432 path of the request URI as defined by [RFC3986] section 3. The 433 request URI query component is included through the normalized 434 parameters string (Section 6.1.2), and the fragment component is 435 excluded. 437 This is done by constructing a base string URI representing the 438 request without the query or fragment components. The base string 439 URI is constructed as follows: 441 1. The scheme and host MUST be in lowercase. 443 2. The host and port values MUST match the content of the HTTP 444 request "Host" header, if present. If the "Host" header is not 445 present, the client MUST use the hostname and port used to make 446 the request. Servers SHOULD remove potential ambiguity in such 447 cases by specifying the expected host value. 449 3. The port MUST be included if it is not the default port for the 450 scheme, and MUST be excluded if it is the default. Specifically, 451 the port MUST be excluded when an "http" request uses port 80 or 452 when an "https" request uses port 443. All other non-default 453 port numbers MUST be included. 455 4. If the URI includes an empty path, it MUST be included as "/". 457 For example: 459 +----------------------------------+-------------------------------+ 460 | The request URI | Is included in base string as | 461 +----------------------------------+-------------------------------+ 462 | HTTP://EXAMPLE.com:80/r/x?id=123 | http://example.com/r/x | 463 | https://example.net:8080?q=1#top | https://example.net:8080/ | 464 +----------------------------------+-------------------------------+ 466 6.1.4. Concatenate Base String Elements 468 Finally, the signature base string is put together by concatenating 469 its elements together. The elements MUST be concatenated in the 470 following order: 472 1. The HTTP request method in uppercase. For example: "HEAD", 473 "GET", "POST", etc. If the request uses a custom HTTP method, it 474 MUST be encoded (Section 9). 476 2. An "&" character (ASCII code 38). 478 3. The base string URI from Section 6.1.3, after being encoded 479 (Section 9). 481 4. An "&" character (ASCII code 38). 483 5. The normalized request parameters string from Section 6.1.2, 484 after being encoded (Section 9). 486 6.2. HMAC-SHA1 488 The "HMAC-SHA1" signature method uses the HMAC-SHA1 signature 489 algorithm as defined in [RFC2104]: 491 digest = HMAC-SHA1 (key, text) 493 The HMAC-SHA1 function variables are used in following way: 495 text 496 is set to the value of the signature base string from 497 Section 6.1.4. 499 key 500 is set to the concatenated values of: 502 1. The client shared-secret, after being encoded 503 (Section 9). 505 2. An "&" character (ASCII code 38), which MUST be included 506 even when either secret is empty. 508 3. The token shared-secret, after being encoded (Section 9). 510 digest 511 is used to set the value of the "oauth_signature" protocol 512 parameter, after the result octet string is base64-encoded per 513 [RFC2045] section 6.8. 515 6.3. RSA-SHA1 517 The "RSA-SHA1" signature method uses the RSASSA-PKCS1-v1_5 signature 518 algorithm as defined in [RFC3447] section 8.2 (also known as PKCS#1), 519 using SHA-1 as the hash function for EMSA-PKCS1-v1_5. To use this 520 method, the client MUST have established client credentials with the 521 server which included its RSA public key (in a manner which is beyond 522 the scope of this specification). 524 The signature base string is signed using the client's RSA private 525 key per [RFC3447] section 8.2.1: 527 S = RSASSA-PKCS1-V1_5-SIGN (K, M) 529 Where: 531 K 532 is set to the client's RSA private key, 534 M 535 is set to the value of the signature base string from 536 Section 6.1.4, and 538 S 539 is the result signature used to set the value of the 540 "oauth_signature" protocol parameter, after the result octet 541 string is base64-encoded per [RFC2045] section 6.8. 543 The server verifies the signature per [RFC3447] section 8.2.2: 545 RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S) 547 Where: 549 (n, e) 550 is set to the client's RSA public key, 552 M 553 is set to the value of the signature base string from 554 Section 6.1.4, and 556 S 557 is set to the octet string value of the "oauth_signature" 558 protocol parameter received from the client. 560 6.4. PLAINTEXT 562 The "PLAINTEXT" method does not employ a signature algorithm and does 563 not provide any security as it transmits secrets in the clear. It 564 SHOULD only be used with a transport-layer mechanisms such as TLS or 565 SSL. It does not use the signature base string. 567 The "oauth_signature" protocol parameter is set to the concatenated 568 value of: 570 1. The client shared-secret, after being encoded (Section 9). 572 2. An "&" character (ASCII code 38), which MUST be included even 573 when either secret is empty. 575 3. The token shared-secret, after being encoded (Section 9). 577 7. Parameter Transmission 579 When making an OAuth-authenticated request, protocol parameters SHALL 580 be included in the request using one and only one of the following 581 locations, listed in order of decreasing preference: 583 1. The HTTP "Authorization" header as described in Section 7.1. 585 2. The HTTP request entity-body as described in Section 7.2. 587 3. The HTTP request URI query as described in Section 7.3. 589 In addition to these three methods, future extensions may provide 590 other methods for including protocol parameters in the request. 592 7.1. Authorization Header 594 Protocol parameters can be transmitted using the HTTP "Authorization" 595 header as defined by [RFC2617] with the auth-scheme name set to 596 "OAuth" (case-insensitive). 598 For example: 600 Authorization: OAuth realm="http://server.example.com/", 601 oauth_consumer_key="0685bd9184jfhq22", 602 oauth_token="ad180jjd733klru7", 603 oauth_signature_method="HMAC-SHA1", 604 oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D", 605 oauth_timestamp="137131200", 606 oauth_nonce="4572616e48616d6d65724c61686176", 607 oauth_version="1.0" 609 Protocol parameters SHALL be included in the "Authorization" header 610 as follows: 612 1. Parameter names and values are encoded per Parameter Encoding 613 (Section 9). 615 2. Each parameter's name is immediately followed by an "=" character 616 (ASCII code 61), a """ character (ASCII code 34), the parameter 617 value (MAY be empty), and another """ character (ASCII code 34). 619 3. Parameters are separated by a "," character (ASCII code 44) and 620 OPTIONAL linear whitespace per [RFC2617]. 622 4. The OPTIONAL "realm" parameter MAY be added and interpreted per 623 [RFC2617], section 1.2. 625 Servers MAY indicate their support for the "OAuth" auth-scheme by 626 returning the HTTP "WWW-Authenticate" response header upon client 627 requests for protected resources. As per [RFC2617] such a response 628 MAY include additional HTTP "WWW-Authenticate" headers: 630 For example: 632 WWW-Authenticate: OAuth realm="http://server.example.com/" 634 The realm parameter defines a protection realm per [RFC2617], section 635 1.2. 637 7.2. Form-Encoded Body 639 Protocol parameters can be transmitted in the HTTP request entity- 640 body, but only if the following REQUIRED conditions are met: 642 o The entity-body is single-part. 644 o The entity-body follows the encoding requirements of the 645 "application/x-www-form-urlencoded" content-type as defined by 646 [W3C.REC-html40-19980424]. 648 o The HTTP request entity-header includes the "Content-Type" header 649 set to "application/x-www-form-urlencoded". 651 For example (line breaks are for display purposes only): 653 oauth_consumer_key=0685bd9184jfhq22&oauth_token=ad180jjd733klr 654 u7&oauth_signature_method=HMAC-SHA1&oauth_signature=wOJIO9A2W5 655 mFwDgiDvZbTSMK%2FPY%3D&oauth_timestamp=137131200&oauth_nonce=4 656 572616e48616d6d65724c61686176&oauth_version=1.0 658 The entity-body MAY include other request-specific parameters, in 659 which case, the protocol parameters SHOULD be appended following the 660 request-specific parameters, properly separated by an "&" character 661 (ASCII code 38). 663 7.3. Request URI Query 665 Protocol parameters can be transmitted by being added to the HTTP 666 request URI as a query parameter as defined by [RFC3986] section 3. 668 For example (line breaks are for display purposes only): 670 GET /example/path?oauth_consumer_key=0685bd9184jfhq22& 671 oauth_token=ad180jjd733klru7&oauth_signature_method=HM 672 AC-SHA1&oauth_signature=wOJIO9A2W5mFwDgiDvZbTSMK%2FPY% 673 3D&oauth_timestamp=137131200&oauth_nonce=4572616e48616 674 d6d65724c61686176&oauth_version=1.0 HTTP/1.1 676 The request URI MAY include other request-specific query parameters, 677 in which case, the protocol parameters SHOULD be appended following 678 the request-specific parameters, properly separated by an "&" 679 character (ASCII code 38). 681 8. Server Response 683 Servers receiving an authenticated request MUST: 685 o Recalculate the request signature independently and compare it to 686 the value received from the client. 688 o Ensure that the nonce / timestamp / token combination has not been 689 used before, and MAY reject requests with stale timestamps. 691 o If a token is present, verify the scope and status of the client 692 authorization by using the token, and MAY choose to restrict token 693 usage to the client to which it was issued. 695 o Ensure that the protocol version used is "1.0". 697 If the request fails verification, the server SHOULD respond with the 698 appropriate HTTP response status code. The server MAY include 699 further details about why the request was rejected in the response 700 body. The following status codes SHOULD be used: 702 o 400 (Bad Request) 704 * Unsupported parameters 706 * Unsupported signature method 708 * Missing parameters 710 * Duplicated protocol parameters 712 o 401 (Unauthorized) 714 * Invalid client credentials 716 * Invalid or expired token 718 * Invalid signature 720 * Invalid or used nonce 722 9. Percent Encoding 724 OAuth uses the following percent-encoding rules: 726 1. Text values are first encoded as UTF-8 octets per [RFC3629] if 727 they are not already. This does not include binary values which 728 are not intended for human consumption. 730 2. The values are then escaped using the [RFC3986] percent-encoding 731 (%XX) mechanism as follows: 733 * Characters in the unreserved character set as defined by 734 [RFC3986] section 2.3 (ALPHA, DIGIT, "-", ".", "_", "~") MUST 735 NOT be encoded. 737 * All other characters MUST be encoded. 739 * The two hexadecimal characters use to represent encoded 740 characters MUST be upper case. 742 10. IANA Considerations 744 This memo includes no request to IANA. 746 11. Security Considerations 748 As stated in [RFC2617], the greatest sources of risks are usually 749 found not in the core protocol itself but in policies and procedures 750 surrounding its use. Implementers are strongly encouraged to assess 751 how this protocol addresses their security requirements. 753 11.1. RSA-SHA1 Signature Method 755 When used with "RSA-SHA1" signatures, the OAuth protocol does not use 756 the token shared-secret, or any provisioned client shared-secret. 757 This means the protocol relies completely on the secrecy of the 758 private key used by the client to sign requests. 760 11.2. PLAINTEXT Signature Method 762 When used with the "PLAINTEXT" method, the protocol makes no attempts 763 to protect credentials from eavesdroppers or man-in-the-middle 764 attacks. The "PLAINTEXT" method is only intended to be used in 765 conjunction with a transport-layer security mechanism such as TLS or 766 SSL which does provide such protection. 768 11.3. Confidentiality of Requests 770 While OAuth provides a mechanism for verifying the integrity of 771 requests, it provides no guarantee of request confidentiality. 772 Unless further precautions are taken, eavesdroppers will have full 773 access to request content. Servers should carefully consider the 774 kinds of data likely to be sent as part of such requests, and should 775 employ transport-layer security mechanisms to protect sensitive 776 resources. 778 11.4. Spoofing by Counterfeit Servers 780 OAuth makes no attempt to verify the authenticity of the server. A 781 hostile party could take advantage of this by intercepting the 782 client's requests and returning misleading or otherwise incorrect 783 responses. Service providers should consider such attacks when 784 developing services based on OAuth, and should require transport- 785 layer security for any requests where the authenticity of the server 786 or of request responses is an issue. 788 11.5. Proxying and Caching of Authenticated Content 790 The HTTP Authorization scheme (Section 7.1) is optional. However, 791 [RFC2616] relies on the "Authorization" and "WWW-Authenticate" 792 headers to distinguish authenticated content so that it can be 793 protected. Proxies and caches, in particular, may fail to adequately 794 protect requests not using these headers. 796 For example, private authenticated content may be stored in (and thus 797 retrievable from) publicly-accessible caches. Servers not using the 798 HTTP Authorization header (Section 7.1) should take care to use other 799 mechanisms, such as the "Cache-Control" header, to ensure that 800 authenticated content is protected. 802 11.6. Plaintext Storage of Credentials 804 The client shared-secret and token shared-secret function the same 805 way passwords do in traditional authentication systems. In order to 806 compute the signatures used in methods other than "RSA-SHA1", the 807 server must have access to these secrets in plaintext form. This is 808 in contrast, for example, to modern operating systems, which store 809 only a one-way hash of user credentials. 811 If an attacker were to gain access to these secrets - or worse, to 812 the server's database of all such secrets - he or she would be able 813 to perform any action on behalf of any resource owner. Accordingly, 814 it is critical that servers protect these secrets from unauthorized 815 access. 817 11.7. Secrecy of the Client Credentials 819 In many cases, the client application will be under the control of 820 potentially untrusted parties. For example, if the client is a 821 freely available desktop application, an attacker may be able to 822 download a copy for analysis. In such cases, attackers will be able 823 to recover the client credentials. 825 Accordingly, servers should not use the client credentials alone to 826 verify the identity of the client. Where possible, other factors 827 such as IP address should be used as well. 829 11.8. Cryptographic Attacks 831 SHA-1, the hash algorithm used in "HMAC-SHA1" signatures, has been 832 shown [SHA1-CHARACTERISTICS] to have a number of cryptographic 833 weaknesses that significantly reduce its resistance to collision 834 attacks. Practically speaking, these weaknesses are difficult to 835 exploit, and by themselves do not pose a significant risk to users of 836 OAuth. They may, however, make more efficient attacks possible, and 837 NIST has announced [SHA-COMMENTS] that it will phase out use of SHA-1 838 by 2010. Servers should take this into account when considering 839 whether SHA-1 provides an adequate level of security for their 840 applications. 842 11.9. Signature Base String Limitations 844 The signature base string has been designed to support the signature 845 methods defined in this specification. When designing additional 846 signature methods, the signature base string should be evaluated to 847 ensure compatibility with the algorithms used. 849 Since the signature base string does not cover the entire HTTP 850 request, such as most request entity-body, most entity-headers, and 851 the order in which parameters are sent, servers should employ 852 additional mechanisms to protect such elements. 854 Appendix A. Examples 856 [[ TODO ]] 858 Appendix B. Acknowledgments 860 This specification is directly based on the [OAuth Core 1.0 Revision 861 A] community specification which was the product of the OAuth 862 community. OAuth was modeled after existing proprietary protocols 863 and best practices that have been independently implemented by 864 various web sites. This specification was orignially authored by: 865 Mark Atwood, Dirk Balfanz, Darren Bounds, Richard M. Conlan, Blaine 866 Cook, Leah Culver, Breno de Medeiros, Brian Eaton, Kellan Elliott- 867 McCrea, Larry Halff, Eran Hammer-Lahav, Ben Laurie, Chris Messina, 868 John Panzer, Sam Quigley, David Recordon, Eran Sandler, Jonathan 869 Sergent, Todd Sieling, Brian Slesinsky, and Andy Smith. 871 Appendix C. Document History 873 [[ To be removed by the RFC editor before publication as an RFC. ]] 875 -01 877 o Moved all subsection from section 3 to the document root. 879 o Synced acknoledgments section with web-delegation draft. 881 -00 883 o Transitioned from the individual submission draft-hammer-oauth-02 884 to working group draft. 886 o Split draft-hammer-oauth-02 into two drafts, one dealing with 887 authentication (this draft) and another dealing with web 888 delegation draft-ietf-oauth-web-delegation. 890 12. References 892 12.1. Normative References 894 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 895 Extensions (MIME) Part One: Format of Internet Message 896 Bodies", RFC 2045, November 1996. 898 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 899 Hashing for Message Authentication", RFC 2104, 900 February 1997. 902 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 903 Requirement Levels", BCP 14, RFC 2119, March 1997. 905 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 906 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 907 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 909 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 910 Leach, P., Luotonen, A., and L. Stewart, "HTTP 911 Authentication: Basic and Digest Access Authentication", 912 RFC 2617, June 1999. 914 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 915 Standards (PKCS) #1: RSA Cryptography Specifications 916 Version 2.1", RFC 3447, February 2003. 918 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 919 10646", STD 63, RFC 3629, November 2003. 921 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 922 Resource Identifier (URI): Generic Syntax", STD 66, 923 RFC 3986, January 2005. 925 [W3C.REC-html40-19980424] 926 Hors, A., Jacobs, I., and D. Raggett, "HTML 4.0 927 Specification", World Wide Web Consortium 928 Recommendation REC-html40-19980424, April 1998, 929 . 931 [draft-ietf-oauth-web-delegation] 932 Hammer-Lahav, E., Ed., "The OAuth Protocol: Web 933 Delegation". 935 12.2. Informative References 937 [OAuth Core 1.0 Revision A] 938 OAuth, OCW., "OAuth Core 1.0". 940 [SHA-COMMENTS] 941 National Institute of Standards and Technology, NIST., 942 "NIST Brief Comments on Recent Cryptanalytic Attacks on 943 Secure Hashing Functions and the Continued Security 944 Provided by SHA-1, August, 2004.". 946 [SHA1-CHARACTERISTICS] 947 De Canniere, C. and C. Rechberger, "Finding SHA-1 948 Characteristics: General Results and Applications". 950 Author's Address 952 Eran Hammer-Lahav (editor) 953 Yahoo! 955 Email: eran@hueniverse.com 956 URI: http://hueniverse.com