idnits 2.17.1 draft-ietf-kitten-sasl-oauth-06.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 : ---------------------------------------------------------------------------- == There are 1 instance of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. -- The document date (September 1, 2012) is 4255 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) == Unused Reference: 'RFC2616' is defined on line 858, but no explicit reference was found in the text == Unused Reference: 'RFC2617' is defined on line 862, but no explicit reference was found in the text == Unused Reference: 'RFC3174' is defined on line 870, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 885, but no explicit reference was found in the text == Unused Reference: 'RFC5988' is defined on line 902, but no explicit reference was found in the text ** 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) ** Downref: Normative reference to an Informational RFC: RFC 3174 ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 5849 (Obsoleted by RFC 6749) ** Obsolete normative reference: RFC 5988 (Obsoleted by RFC 8288) ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) == Outdated reference: A later version (-05) exists of draft-ietf-oauth-v2-http-mac-01 -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 8 errors (**), 0 flaws (~~), 9 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 KITTEN W. Mills 3 Internet-Draft Yahoo! Inc. 4 Intended status: Standards Track T. Showalter 5 Expires: March 5, 2013 6 H. Tschofenig 7 Nokia Siemens Networks 8 September 1, 2012 10 A set of SASL and GSS-API Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-06 13 Abstract 15 OAuth enables a third-party application to obtain limited access to a 16 protected resource, either on behalf of a resource owner by 17 orchestrating an approval interaction, or by allowing the third-party 18 application to obtain access on its own behalf. 20 This document defines how an application client uses credentials 21 obtained via OAuth over the Simple Authentication and Security Layer 22 (SASL) or the Generic Security Service Application Program Interface 23 (GSS-API) to access a protected resource at a resource serve. 24 Thereby, it enables schemes defined within the OAuth framework for 25 non-HTTP-based application protocols. 27 Clients typically store the user's long term credential. This does, 28 however, lead to significant security vulnerabilities, for example, 29 when such a credential leaks. A significant benefit of OAuth for 30 usage in those clients is that the password is replaced by a token. 31 Tokens typically provided limited access rights and can be managed 32 and revoked separately from the user's long-term credential 33 (password). 35 Status of this Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at http://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on March 5, 2013. 51 Copyright Notice 53 Copyright (c) 2012 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (http://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 Table of Contents 68 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 69 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 7 70 3. OAuth SASL Mechanism Specifications . . . . . . . . . . . . . 8 71 3.1. Initial Client Response . . . . . . . . . . . . . . . . . 9 72 3.1.1. Reserved Key/Values . . . . . . . . . . . . . . . . . 10 73 3.1.2. Use of the gs2-header . . . . . . . . . . . . . . . . 10 74 3.2. Server's Response . . . . . . . . . . . . . . . . . . . . 10 75 3.2.1. Mapping to SASL Identities . . . . . . . . . . . . . . 11 76 3.2.2. Canonicalization . . . . . . . . . . . . . . . . . . . 11 77 3.2.3. Server response to failed authentication. . . . . . . 11 78 3.2.4. Completing an error message sequence. . . . . . . . . 12 79 3.3. Use of Signature Type Authorization . . . . . . . . . . . 12 80 3.4. Channel Binding . . . . . . . . . . . . . . . . . . . . . 13 81 4. GSS-API OAuth Mechanism Specification . . . . . . . . . . . . 14 82 5. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 83 5.1. Successful Bearer Token Exchange . . . . . . . . . . . . . 16 84 5.2. OAuth 1.0a Authorization with Channel Binding . . . . . . 17 85 5.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 18 86 5.4. Failed Channel Binding . . . . . . . . . . . . . . . . . . 19 87 5.5. SMTP Example of a failed negotiation. . . . . . . . . . . 19 88 6. Security Considerations . . . . . . . . . . . . . . . . . . . 21 89 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 22 90 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 22 91 7.2. GSS-API Registration . . . . . . . . . . . . . . . . . . . 23 92 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 24 93 8.1. Normative References . . . . . . . . . . . . . . . . . . . 24 94 8.2. Informative References . . . . . . . . . . . . . . . . . . 25 95 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . . 26 96 Appendix B. Document History . . . . . . . . . . . . . . . . . . 27 97 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 29 99 1. Introduction 101 OAuth [I-D.ietf-oauth-v2] enables a third-party application to obtain 102 limited access to a protected resource, either on behalf of a 103 resource owner by orchestrating an approval interaction, or by 104 allowing the third-party application to obtain access on its own 105 behalf. The core OAuth specification [I-D.ietf-oauth-v2] does not 106 define the interaction between the client and the resource server 107 with the access to a protected resource using an Access Token. This 108 functionality is described in separate specifications, for example 109 Bearer tokens [I-D.ietf-oauth-v2-bearer], MAC tokens 110 [I-D.ietf-oauth-v2-http-mac], and OAuth 1.0a [RFC5849]. In each of 111 these are defined in an HTTP-based environment only. 113 Figure 1 shows the abstract message flow as shown in Figure 1 of 114 [I-D.ietf-oauth-v2]. 116 +--------+ +---------------+ 117 | |--(A)- Authorization Request ->| Resource | 118 | | | Owner | 119 | |<-(B)-- Authorization Grant ---| | 120 | | +---------------+ 121 | | 122 | | +---------------+ 123 | |--(C)-- Authorization Grant -->| Authorization | 124 | Client | | Server | 125 | |<-(D)----- Access Token -------| | 126 | | +---------------+ 127 | | 128 | | +---h------------+ 129 | |--(E)----- Access Token ------>| Resource | 130 | | | Server | 131 | |<-(F)--- Protected Resource ---| | 132 +--------+ +---------------+ 134 Figure 1: Abstract OAuth 2.0 Protocol Flow 136 This document takes advantage of the OAuth protocol and its 137 deployment base to provide a way to use SASL [RFC4422] as well as the 138 GSS-API [RFC2743] to gain access to resources when using non-HTTP- 139 based protocols, such as the Internet Message Access Protocol (IMAP) 140 [RFC3501] and SMTP [RFC5321], which is what this memo uses in the 141 examples. 143 The Simple Authentication and Security Layer (SASL) is a framework 144 for providing authentication and data security services in 145 connection-oriented protocols via replaceable mechanisms. It 146 provides a structured interface between protocols and mechanisms. 147 The resulting framework allows new protocols to reuse existing 148 mechanisms and allows old protocols to make use of new mechanisms. 149 The framework also provides a protocol for securing subsequent 150 protocol exchanges within a data security layer. 152 The Generic Security Service Application Program Interface (GSS-API) 153 [RFC2743] provides a framework for applications to support multiple 154 authentication mechanisms through a unified interface. 156 This document defines SASL mechanisms for OAuth, and it conforms to 157 the new bridge between SASL and the GSS-API called GS2 [RFC5801]. 158 This means that this document defines both SASL and GSS-API 159 mechanisms. Implementers may be interested in either the SASL, the 160 GSS-API, or even both mechanisms. To faciliate these two variants, 161 the description has been split into two parts, one part that provides 162 normative references for those interested in the SASL OAuth mechanism 163 (see Section 3), and a second part for those implementers that wish 164 to implement the GSS-API portion (see Section 4). 166 When OAuth is integrated into SASL and the GSS-API the high-level 167 steps are as follows: 169 (A) The client requests authorization from the resource owner. 170 The authorization request can be made directly to the resource 171 owner (as shown), or preferably indirectly via the authorization 172 server as an intermediary. 174 (B) The client receives an authorization grant which is a 175 credential representing the resource owner's authorization, 176 expressed using one of four grant types defined in this 177 specification or using an extension grant type. The authorization 178 grant type depends on the method used by the client to request 179 authorization and the types supported by the authorization server. 181 (C) The client requests an access token by authenticating with the 182 authorization server and presenting the authorization grant. 184 (D) The authorization server authenticates the client and 185 validates the authorization grant, and if valid issues an access 186 token. 188 (E) The client requests the protected resource from the resource 189 server and authenticates by presenting the access token. 191 (F) The resource server validates the access token, and if valid, 192 indicates a successful authentication. 194 Steps (E) and (F) are not defined in [I-D.ietf-oauth-v2] and are the 195 main functionality specified within this document. Consequently, the 196 message exchange shown in Figure 2 is the result of this 197 specification. The client will genrally need to determine the 198 authentication endpoints (and perhaps the service endpoints) before 199 the OAuth 2.0 protocol exchange messages in steps (A)-(D) are 200 executed. The discovery of the resource owner and authorization 201 server endpoints is outside the scope of this specification. The 202 client must discover those endpoints using a discovery mechanisms 203 such as Webfinger using host-meta [I-D.jones-appsawg-webfinger]. In 204 band discovery is not tenable if clients support the OAuth 2.0 205 password grant. Once credentials are obtained the client proceeds to 206 steps (E) and (F) defined in this specification. 208 ----+ 209 +--------+ +---------------+ | 210 | |--(A)-- Authorization Request --->| Resource | | 211 | | | Owner | |Plain 212 | |<-(B)------ Access Grant ---------| | |OAuth 213 | | +---------------+ |2.0 214 | | | 215 | | Client Credentials & +---------------+ | 216 | |--(C)------ Access Grant -------->| Authorization | | 217 | Client | | Server | | 218 | |<-(D)------ Access Token ---------| | | 219 | | (w/ Optional Refresh Token) +---------------+ | 220 | | ----+ 221 | | ----+ 222 | | +---------------+ | 223 | | | | |OAuth 224 | |--(E)------ Access Token -------->| Resource | |over 225 | | | Server | |SASL/ 226 | |<-(F)---- Protected Resource -----| | |GSS- 227 | | | | |API 228 +--------+ +---------------+ | 229 ----+ 231 Figure 2: OAuth SASL Architecture 233 2. Terminology 235 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 236 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 237 document are to be interpreted as described in [RFC2119]. 239 The reader is assumed to be familiar with the terms used in the OAuth 240 2.0 specification [I-D.ietf-oauth-v2]. 242 In examples, "C:" and "S:" indicate lines sent by the client and 243 server respectively. Line breaks have been inserted for readability. 245 Note that the IMAP SASL specification requires base64 encoding 246 message, not this memo. 248 3. OAuth SASL Mechanism Specifications 250 SASL is used as a generalized authentication method in a variety of 251 application layer protocols. This document defines the following 252 SASL mechanisms for usage with OAuth: 254 OAUTHBEARER Authorization using Bearer tokens. 256 OAUTH10A Authorization using OAuth 1.0a tokens. 258 OAUTH10A-PLUS Adds channel binding [RFC5056] capability to 259 OAUTH10A for additional security guarantees. 261 Any new OAuth token scheme MAY define a new SASL mechanism compatible 262 with the mechanisms defined here by simply registering the new 263 name(s) and citing this specification for the further definition. 264 New channel binding enabled "-PLUS" mechanisms defined in this way 265 MUST include message integrity protection. A newly defined mechanism 266 would also need to register a new GS2 OID. 268 These mechanisms are client initiated and lock-step, the server 269 always replying to a client message. In the case where the client 270 has and correctly uses a valid token the flow is: 272 o Client sends a valid and correct initial client response. 274 o Server responds with a successful authentication. 276 In the case where authorization fails the server sends an error 277 result, then client MUST then send an additional message to the 278 server in order to allow the server to finish the exchange. Some 279 protocols and common SASL implementations do not support both sending 280 a SASL message and finalizing a SASL negotiation, the additional 281 client message in the error case deals with this problem. This 282 exchange is: 284 o Client sends an invalid initial client response. 286 o Server responds with an error message. 288 o Client sends an empty client reponse. 290 o Server fails the authentication. 292 3.1. Initial Client Response 294 Client responses are a key/value pair sequence. The initial client 295 response includes a gs2-header as defined in GS2 [RFC5801], which 296 carries the authorization ID. These key/value pairs carry the 297 equivalent values from an HTTP context in order to be able to 298 complete an OAuth style HTTP authorization. The client MUST send an 299 authorization ID in the gs2-header. The ABNF [RFC5234] syntax is: 301 kvsep = %x01 302 key = 1*ALPHA 303 value = *(VCHAR | SP | HTAB | CR | LF ) 304 kvpair = key "=" value kvsep 305 client_resp = 0*kvpair kvsep 306 ;; gs2-header = As defined in GSS-API 307 initial_client_resp = gs2-header kvsep client_resp 309 The following key/value pairs are defined in the client response: 311 auth (REQUIRED): The payload of the HTTP Authorization header for 312 an equivalent HTTP OAuth authroization. 314 host: Contains the host name to which the client connected. 316 port: Contains the port number represented as a decimal positive 317 integer string without leading zeros to which the client 318 connected. 320 qs: The HTTP query string. In non-channel binding mechanisms 321 this is reserved, the client SHOUD NOT send it, and has the 322 default value of "". In "-PLUS" variants this carries a single 323 key value pair "cbdata" for the channel binding data payload 324 formatted as an HTTP query string. 326 In authorization schemes that use signatures, the client MUST send 327 host and port number key/values, and the server MUST fail an 328 authorization request requiring signatures that does not have host 329 and port values. For authorization schemes that require a URI scheme 330 as part of the data being signed "http" is always used. In OAuth 331 1.0a for example, the signature base string includes the 332 reconstructed HTTP URL. 334 3.1.1. Reserved Key/Values 336 In these mechanisms values for path, query string and post body are 337 assigned default values. OAuth authorization schemes MAY define 338 usage of these in the SASL context and extend this specification. 339 For OAuth schemes that use request signatures the default values MUST 340 be used unless explict values are provided in the client response. 341 The following key values are reserved for future use: 343 mthd (RESERVED): HTTP method for use in signatures, the default 344 value is "POST". 346 path (RESERVED): HTTP path data, the default value is "/". 348 post (RESERVED): HTTP post data, the default value is "". 350 3.1.2. Use of the gs2-header 352 The OAuth scheme related mechanisms are also GSS-API mechanisms, see 353 Section 4 for further detail. The gs2-header is used as follows: 355 o The "gs2-nonstd-flag" MUST NOT be present. 357 o The "gs2-authzid" carries the authorization identity as specified 358 in [RFC5801]. This MUST agree with the identity asserted in the 359 OAuth credential. 361 In the non "-PLUS" mechanisms the "gs2-cb-flag" MUST be set to "n" 362 because channel-binding [RFC5056] data is not expected. In the 363 OAUTH10A-PLUS mechanism (or other -PLUS variants based on this 364 specification) the "gs2-cb-flag" MUST be set appropriately by the 365 client. 367 3.2. Server's Response 369 The server validates the response per the specification for the 370 authorization scheme used. If the authorization scheme used includes 371 signing of the request parameters the client must provide a client 372 response that satisfies the data requirements for the scheme in use. 374 In a "-PLUS" mechanism the server examines the channel binding data, 375 extracts the channel binding unique prefix, and extracts the raw 376 channel biding data based on the channel binding type used. It then 377 computes it's own copy of the channel binding payload and compares 378 that to the payload sent by the client in the cbdata key/value. 379 Those two must be equal for channel binding to succeed. 381 The server responds to a successfully verified client message by 382 completing the SASL negotiation. The authorization scheme MUST carry 383 the user ID to be used as the authorization identity (identity to act 384 as). The server MUST use the ID obtained from the credential as the 385 user being authorized. 387 3.2.1. Mapping to SASL Identities 389 Some OAuth mechanisms can provide both an authorization identity and 390 an authentication identity. An example of this is OAuth 1.0a 391 [RFC5849] where the consumer key (oauth_consumer_key) identifies the 392 entity using the token which equates to the SASL authentication 393 identity, and is authenticated using the shared secret. The server 394 MAY use a consumer key, a value derived from it, or other comparable 395 identity in the OAuth authorization scheme to allow SASL an 396 authentication identity different from the authorization identity to 397 be set. 399 3.2.2. Canonicalization 401 The identity asserted by the OAuth authorization server is canonical 402 for display. The server MAY provide a different canonical form based 403 on local data. 405 3.2.3. Server response to failed authentication. 407 For a failed authentication the server returns a JSON [RFC4627] 408 formatted error result, and fails the authentication. The error 409 result consists of the following values: 411 status (REQUIRED): The authorization error code. Valid error 412 codes are defined in the IANA [[need registry name]] registry 413 specified in the OAuth 2 core specification. 415 scope (OPTIONAL): An OAuth scope which is valid to access the 416 service. This may be empty which implies that unscoped tokens 417 are required, or a space separated list. Use of a space 418 separated list is NOT RECOMMENDED. 420 If the resource server provides a scope the client SHOULD always 421 request scoped tokens from the token endpoint. The client MAY use a 422 scope other than the one provided by the resource server. Scopes 423 other than those advertised by the resource server are be defined by 424 the resource owner and provided in service documentation or discovery 425 information (which is beyond the scope of this memo). If not present 426 then the client SHOULD presume an empty scope (unscoped token) is 427 needed. 429 If channel binding is in use and the channel binding fails the server 430 responds with a status code set to 412 to indicate that the channel 431 binding precondition failed. If the authentication scheme in use 432 does not include signing the server SHOULD revoke the presented 433 credential and the client SHOULD discard that credential. 435 3.2.4. Completing an error message sequence. 437 Section 3.6 of [RFC4422] explicitly prohibits additional information 438 in an unsuccessful authentication outcome. Therefor, the error 439 message is sent in a normal message. The client MUST then send an 440 additional client response consisting of a single %x01 (control A) 441 character to the server in order to allow the server to finish the 442 exchange. 444 3.3. Use of Signature Type Authorization 446 Some OAuth mechanisms support authorization using signatures, which 447 requires that both client and server construct the string to be 448 signed. OAuth 2 is designed for authentication/authorization to 449 access specific URIs. SASL is designed for user authentication, and 450 has no facility for being more specific. In this mechanism we 451 require or define default values for the data elements from an HTTP 452 request which allow the signature base string to be constructed 453 properly. The default HTTP path is "/" and the default post body is 454 empty. These atoms are defined as extension points so that no 455 changes are needed if there is a revision of SASL which supports more 456 specific resource authorization, e.g. IMAP access to a specific 457 folder or FTP access limited to a specific directory. 459 Using the example in the OAuth 1.0a specification as a starting 460 point, on an IMAP server running on port 143 and given the OAuth 1.0a 461 style authorization request (with %x01 shown as ^A and line breaks 462 added for readability) below: 464 n,a=user@example.com^A 465 host=example.com^A 466 user=user@example.com^A 467 port=143^A 468 auth=OAuth realm="Example", 469 oauth_consumer_key="9djdj82h48djs9d2", 470 oauth_token="kkk9d7dh3k39sjv7", 471 oauth_signature_method="HMAC-SHA1", 472 oauth_timestamp="137131201", 473 oauth_nonce="7d8f3e4a", 474 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU%3D"^A^A 476 The signature base string would be constructed per the OAuth 1.0 477 specification [RFC5849] with the following things noted: 479 o The method value is defaulted to POST. 481 o The scheme defaults to be "http", and any port number other than 482 80 is included. 484 o The path defaults to "/". 486 o The query string defaults to "". 488 In this example the signature base string with line breaks added for 489 readability would be: 491 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 492 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 493 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 495 3.4. Channel Binding 497 The channel binding data is carried in the "qs" (query string) key 498 value pair formatted as a standard HTTP query parameter with the name 499 "cbdata". Channel binding requires that the channel binding data be 500 integrity protected end-to-end in order to protect against man-in- 501 the-middle attacks. All authorization schemes offered with "-PLUS" 502 mechanisms MUST provide integrity protection. It should be noted 503 that while the Bearer token scheme specifies SSL for normal usage it 504 offers no integrity protection and is not suitable for use with 505 channel binding. 507 The channel binding data is computed by the client based on it's 508 choice of preferred channel binding type. As specified in [RFC5056], 509 the channel binding information MUST start with the channel binding 510 unique prefix, followed by a colon (ASCII 0x3A), followed by a base64 511 encoded channel binding payload. The channel binding payload is the 512 raw data from the channel binding type. For example, if the client 513 is using tls-unique for channel binding then the raw channel binding 514 data is the TLS finished message as specified in section 3.1 of 515 [RFC5929]. 517 4. GSS-API OAuth Mechanism Specification 519 Note: The normative references in this section are informational for 520 SASL implementers, but they are normative for GSS-API implementers. 522 A SASL OAuth mechanism is also a GSS-API mechanism and the messages 523 described in Section 3 are the same with the following changes to the 524 GS2 related elements: 526 1. the GS2 header on the client's first message is excluded when 527 used as a GSS-API mechanism. 529 2. the initial context token header is prefixed to the client's 530 first authentication message (context token), as described in 531 Section 3.1 of RFC 2743, 533 The GSS-API mechanism OIDs are: 535 o OAUTHBEARER: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 537 o OAUTH10A: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 539 OAuth mechanims security contexts always have the mutual_state flag 540 (GSS_C_MUTUAL_FLAG) set to TRUE. OAuth supports credential 541 delegation, therefore security contexts may have the deleg_state flag 542 (GSS_C_DELEG_FLAG) set to either TRUE or FALSE. 544 The mutual authentication property of this mechanism relies on 545 successfully comparing the TLS server identity with the negotiated 546 target name. Since the TLS channel is managed by the application 547 outside of the GSS-API mechanism, the mechanism itself is unable to 548 confirm the name while the application is able to perform this 549 comparison for the mechanism. For this reason, applications MUST 550 match the TLS server identity with the target name, as discussed in 551 [RFC6125]. 553 OAuth mechanisms do not support per-message tokens or 554 GSS_Pseudo_random. 556 OAuth supports a standard generic name syntax for acceptors, such as 557 GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], Section 4.1). These 558 service names MUST be associated with the "entityID" claimed by the 559 RP. OAuth mechanisms support only a single name type for initiators: 560 GSS_C_NT_USER_NAME. GSS_C_NT_USER_NAME is the default name type. 561 The query, display, and exported name syntaxes for OAuth principal 562 names are all the same. There is no OAuth-specific name syntax; 563 applications SHOULD use generic GSS-API name types, such as 564 GSS_C_NT_USER_NAME and GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], 565 Section 4). The exported name token does, of course, conform to 566 [RFC2743], Section 3.2, but the "NAME" part of the token should be 567 treated as a potential input string to the OAuth name normalization 568 rules. 570 5. Examples 572 These examples illustrate exchanges between an IMAP and SMTP clients 573 and servers. 575 Note to implementers: Authorization scheme names are case 576 insensitive. One example uses "Bearer" but that could as easily be 577 "bearer", "BEARER", or "BeArEr". 579 5.1. Successful Bearer Token Exchange 581 This example shows a successful OAuth 2.0 bearer token exchange. 582 Note that line breaks are inserted for readability. 584 S: * IMAP4rev1 Server Ready 585 C: t0 CAPABILITY 586 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER 587 S: t0 OK Completed 588 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 589 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 590 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 591 S: t1 OK SASL authentication succeeded 593 As required by IMAP [RFC3501], the payloads are base64-encoded. The 594 decoded initial client response (with %x01 represented as ^A and long 595 lines wrapped for readability) is: 597 n,a=user@example.com^Ahost=server.example.com^Aport=143^A 598 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 600 The same credential used in an SMTP exchange is shown below. Note 601 that line breaks are inserted for readability, and that the SMTP 602 protocol terminates lines with CR and LF characters (ASCII values 603 0x0D and 0x0A), these are not displayed explicitly in the example. 605 [connection begins] 606 S: 220 mx.example.com ESMTP 12sm2095603fks.9 607 C: EHLO sender.example.com 608 S: 250-mx.example.com at your service,[172.31.135.47] 609 S: 250-SIZE 35651584 610 S: 250-8BITMIME 611 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 612 S: 250-ENHANCEDSTATUSCODES 613 S: 250-PIPELINING 614 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 615 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 616 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 617 S: 235 Authentication successful. 618 [connection continues...] 620 5.2. OAuth 1.0a Authorization with Channel Binding 622 This example shows channel binding in the context of an OAuth 1.0a 623 signed authorization request. Note that line breaks are inserted for 624 readability. 626 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 627 Ready 628 S: t0 OK Completed 629 C: t1 AUTHENTICATE OAUTH10A-PLUS eSxhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZ 630 XJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1PQXV0aCByZWFsbT0iRXhhb 631 XBsZSIsb2F1dGhfY29uc3VtZXJfa2V5PSI5ZGpkajgyaDQ4ZGpzOWQyIixvYXV0a 632 F90b2tlbj0ia2trOWQ3ZGgzazM5c2p2NyIsb2F1dGhfc2lnbmF0dXJlX21ldGhvZ 633 D0iSE1BQy1TSEExIixvYXV0aF90aW1lc3RhbXA9IjEzNzEzMTIwMSIsb2F1dGhfb 634 m9uY2U9IjdkOGYzZTRhIixvYXV0aF9zaWduYXR1cmU9IlNTZHRJR0VnYkdsMGRHe 635 GxJSFJsWVNCd2IzUXUiAXFzPWNiZGF0YT10bHMtdW5pcXVlOlNHOTNJR0pwWnlCc 636 GN5QmhJRlJNVXlCbWFXNWhiQ0J0WlhOellXZGxQd289AQE= 637 S: t1 OK SASL authentication succeeded 639 As required by IMAP [RFC3501], the payloads are base64-encoded. The 640 decoded initial client response (with %x01 represented as ^A and 641 lines wrapped for readability) is: 643 y,a=user@example.com^A 644 host=server.example.com^A 645 port=143^A 646 auth=OAuth realm="Example", 647 oauth_consumer_key="9djdj82h48djs9d2", 648 oauth_token="kkk9d7dh3k39sjv7", 649 oauth_signature_method="HMAC-SHA1", 650 oauth_timestamp="137131201", 651 oauth_nonce="7d8f3e4a", 652 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A 653 qs=cbdata=tls-unique:SG93IGJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=^A^A 655 In this example the signature base string with line breaks added for 656 readability would be: 658 POST&http%3A%2F%2Fserver.example.com:143%2F&cbdata=tls-unique:SG93I 659 GJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=%26oauth_consumer_key%3D9djd 660 j82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHM 661 AC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39s 662 jv7 664 5.3. Failed Exchange 666 This example shows a failed exchange because of the empty 667 Authorization header, which is how a client can query for the needed 668 scope. Note that line breaks are inserted for readability. 670 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 671 Ready 672 S: t0 OK Completed 673 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD 674 1zZXJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD0BAQ== 675 S: + ewoic3RhdHVzIjoiNDAxIgoic2NvcGUiOiJleGFtcGxlX3Njb3BlIgp9 676 C: + AQ== 677 S: t1 NO SASL authentication failed 679 The decoded initial client response is: 681 n,a=user@example.com,^Ahost=server.example.com^A 682 port=143^Aauth=^A^A 684 The decoded server error response is: 686 { 687 "status":"401", 688 "scope":"example_scope" 689 } 691 The client responds with the required empty response. 693 5.4. Failed Channel Binding 695 This example shows a channel binding failure in an empty request. 696 The channel binding information is empty. Note that line breaks are 697 inserted for readability. 699 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 700 Ready 701 S: t0 OK Completed 702 C: t1 AUTHENTICATE OAUTH10A-PLUS eSxhPXVzZXJAZXhhbXBsZS5jb20BaG9z 703 dD1zZXJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD0BY2JkYXRhPQEB 704 S: + ewoic3RhdHVzIjoiNDEyIiwKInNjb3BlIjoiZXhhbXBsZV9zY29wZSIKfQ== 705 C: + AQ== 706 S: t1 NO SASL authentication failed 708 The decoded initial client response is: 710 y,a=user@example.com,^Ahost=server.example.com^A 711 port=143^Aauth=^Acbdata=^A^A 713 The decoded server response is: 715 { 716 "status":"412", 717 "scope":"example_scope" 718 } 720 The client responds with the required empty response. 722 5.5. SMTP Example of a failed negotiation. 724 This example shows an authorization failure in an SMTP exchange. 725 Note that line breaks are inserted for readability, and that the SMTP 726 protocol terminates lines with CR and LF characters (ASCII values 727 0x0D and 0x0A), these are not displayed explicitly in the example. 729 [connection begins] 730 S: 220 mx.example.com ESMTP 12sm2095603fks.9 731 C: EHLO sender.example.com 732 S: 250-mx.example.com at your service,[172.31.135.47] 733 S: 250-SIZE 35651584 734 S: 250-8BITMIME 735 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 736 S: 250-ENHANCEDSTATUSCODES 737 S: 250-PIPELINING 738 C: AUTH OAUTHBEARER bixhPT1zb21ldXNlckBleGFtcGxlLmNvbQFhdXRoPUJlYXJlciB2 739 RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 740 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 741 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 742 C: AQ== 743 S: 535-5.7.1 Username and Password not accepted. Learn more at 744 S: 535 5.7.1 http://support.example.com/mail/oauth 745 [connection continues...] 747 The server returned an error message in the 334 SASL message, the 748 client responds with the required empty response, and the server 749 finalizes the negotiation. 751 6. Security Considerations 753 This mechanism does not provide a security layer, but does provide a 754 provision for channel binding. The OAuth 2 specification 755 [I-D.ietf-oauth-v2] allows for a variety of usages, and the security 756 properties of these profiles vary. The usage of bearer tokens, for 757 example, provide security features similar to cookies. Applications 758 using this mechanism SHOULD exercise the same level of care using 759 this mechanism as they would in using the SASL PLAIN mechanism. In 760 particular, TLS 1.2 or an equivalent secure channel MUST be 761 implemented and its usage is RECOMMENDED. 763 The channel binding in this mechanism has different properties based 764 on the authentication scheme used. The integrity guarantee for 765 channel binding depends on the quality of the guarantee in the the 766 authorization scheme. 768 It is possible that SASL will be authenticating a connection and the 769 life of that connection may outlast the life of the token used to 770 authenticate it. This is a common problem in application protocols 771 where connections are long-lived, and not a problem with this 772 mechanism per se. Servers MAY unilaterally disconnect clients in 773 accordance with the application protocol. 775 An OAuth credential is not equivalent to the password or primary 776 account credential. There are protocols like XMPP that allow actions 777 like change password. The server SHOULD ensure that actions taken in 778 the authenticated channel are appropriate to the strength of the 779 presented credential. 781 Tokens have a lifetime associated with them. Reducing the lifetime 782 of a token provides security benefits in the case that tokens leak. 783 In addition a previously obtained token MAY be revoked or rendered 784 invalid at any time. The client MAY request a new access token for 785 each connection to a resource server, but it SHOULD cache and re-use 786 access credentials that appear to be valid. 788 7. IANA Considerations 790 7.1. SASL Registration 792 The IANA is requested to register the following SASL profile: 794 SASL mechanism profile: OAUTHBEARER 796 Security Considerations: See this document 798 Published Specification: See this document 800 For further information: Contact the authors of this document. 802 Owner/Change controller: the IETF 804 Note: None 806 The IANA is requested to register the following SASL profile: 808 SASL mechanism profile: OAUTH10A 810 Security Considerations: See this document 812 Published Specification: See this document 814 For further information: Contact the authors of this document. 816 Owner/Change controller: the IETF 818 Note: None 820 The IANA is requested to register the following SASL profile: 822 SASL mechanism profile: OAUTH10A-PLUS 824 Security Considerations: See this document 826 Published Specification: See this document 828 For further information: Contact the authors of this document. 830 Owner/Change controller: the IETF 832 Note: None 834 7.2. GSS-API Registration 836 IANA is further requested to assign an OID for thESE GSS mechanismS 837 in the SMI numbers registry, with the prefix of 838 iso.org.dod.internet.security.mechanisms (1.3.6.1.5.5) and to 839 reference this specification in the registry. 841 8. References 843 8.1. Normative References 845 [I-D.ietf-oauth-v2] 846 Hardt, D., "The OAuth 2.0 Authorization Framework", 847 draft-ietf-oauth-v2-31 (work in progress), August 2012. 849 [I-D.ietf-oauth-v2-bearer] 850 Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 851 Framework: Bearer Token Usage", 852 draft-ietf-oauth-v2-bearer-23 (work in progress), 853 August 2012. 855 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 856 Requirement Levels", BCP 14, RFC 2119, March 1997. 858 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 859 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 860 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 862 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 863 Leach, P., Luotonen, A., and L. Stewart, "HTTP 864 Authentication: Basic and Digest Access Authentication", 865 RFC 2617, June 1999. 867 [RFC2743] Linn, J., "Generic Security Service Application Program 868 Interface Version 2, Update 1", RFC 2743, January 2000. 870 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 871 (SHA1)", RFC 3174, September 2001. 873 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 874 Security Layer (SASL)", RFC 4422, June 2006. 876 [RFC4627] Crockford, D., "The application/json Media Type for 877 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 879 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 880 Channels", RFC 5056, November 2007. 882 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 883 Specifications: ABNF", STD 68, RFC 5234, January 2008. 885 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 886 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 888 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 889 October 2008. 891 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 892 Service Application Program Interface (GSS-API) Mechanisms 893 in Simple Authentication and Security Layer (SASL): The 894 GS2 Mechanism Family", RFC 5801, July 2010. 896 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 897 April 2010. 899 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 900 for TLS", RFC 5929, July 2010. 902 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 904 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 905 Verification of Domain-Based Application Service Identity 906 within Internet Public Key Infrastructure Using X.509 907 (PKIX) Certificates in the Context of Transport Layer 908 Security (TLS)", RFC 6125, March 2011. 910 8.2. Informative References 912 [I-D.ietf-oauth-v2-http-mac] 913 Hammer-Lahav, E., "HTTP Authentication: MAC Access 914 Authentication", draft-ietf-oauth-v2-http-mac-01 (work in 915 progress), February 2012. 917 [I-D.jones-appsawg-webfinger] 918 Jones, P., Salgueiro, G., and J. Smarr, "WebFinger", 919 draft-jones-appsawg-webfinger-06 (work in progress), 920 June 2012. 922 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 923 4rev1", RFC 3501, March 2003. 925 Appendix A. Acknowlegements 927 The authors would like to thank the members of the Kitten working 928 group, and in addition and specifically: Simon Josefson, Torsten 929 Lodderstadt, Ryan Troll, and Nico Williams. 931 Appendix B. Document History 933 [[ to be removed by RFC editor before publication as an RFC ]] 935 -06 937 o Removed the user field. Fixed the examples again. 939 o Added canonicalization language. 941 o 943 -05 945 o Fixed the GS2 header language again. 947 o Separated out different OAuth schemes into different SASL 948 mechanisms. Took out the scheme in the error return. Tuned up 949 the IANA registrations. 951 o Added the user field back into the SASL message. 953 o Fixed the examples (again). 955 o 957 -04 959 o Changed user field to be carried in the gs2-header, and made gs2 960 header explicit in all cases. 962 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 963 reference. 965 o Changed to sending an empty client response (single control-A) as 966 the second message of a failed sequence. 968 o Fixed channel binding prose to refer to the normative specs and 969 removed the hashing of large channel binding data, which brought 970 mroe problems than it solved. 972 o Added a SMTP examples for Bearer use case. 974 -03 976 o Added user field into examples and fixed egregious errors there as 977 well. 979 o Added text reminding developers that Authorization scheme names 980 are case insensitive. 982 -02 984 o Added the user data element back in. 986 o Minor editorial changes. 988 -01 990 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 991 webfinger instead of WF and SWD older drafts. 993 o Replacing HTTP as the message format and adjusted all examples. 995 -00 997 o Renamed draft into proper IETF naming format now that it's 998 adopted. 1000 o Minor fixes. 1002 Authors' Addresses 1004 William Mills 1005 Yahoo! Inc. 1007 Phone: 1008 Email: wmills@yahoo-inc.com 1010 Tim Showalter 1012 Phone: 1013 Email: tjs@psaux.com 1015 Hannes Tschofenig 1016 Nokia Siemens Networks 1017 Linnoitustie 6 1018 Espoo 02600 1019 Finland 1021 Phone: +358 (50) 4871445 1022 Email: Hannes.Tschofenig@gmx.net 1023 URI: http://www.tschofenig.priv.at