idnits 2.17.00 (12 Aug 2021) /tmp/idnits30165/draft-ietf-kitten-sasl-oauth-09.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 (December 17, 2012) is 3441 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: 'RFC2473' is defined on line 867, but no explicit reference was found in the text == Unused Reference: 'RFC2616' is defined on line 870, but no explicit reference was found in the text == Unused Reference: 'RFC2617' is defined on line 874, but no explicit reference was found in the text == Unused Reference: 'RFC3174' is defined on line 882, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 900, but no explicit reference was found in the text == Unused Reference: 'RFC5988' is defined on line 917, 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) == Outdated reference: draft-ietf-appsawg-webfinger has been published as RFC 7033 == Outdated reference: draft-ietf-oauth-json-web-token has been published as RFC 7519 == Outdated reference: A later version (-05) exists of draft-ietf-oauth-v2-http-mac-02 == Outdated reference: draft-ietf-oauth-v2-threatmodel has been published as RFC 6819 -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 7 errors (**), 0 flaws (~~), 13 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: June 20, 2013 6 H. Tschofenig 7 Nokia Siemens Networks 8 December 17, 2012 10 A set of SASL and GSS-API Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-09 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 June 20, 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. OAuth Identifiers in the SASL Context . . . . . . . . 11 76 3.2.2. Server Response to Failed Authentication . . . . . . . 11 77 3.2.3. Completing an Error Message Sequence . . . . . . . . . 12 78 3.3. OAuth Access Token Types using Digital Signatures and 79 Keyed Message Digests . . . . . . . . . . . . . . . . . . 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. Internationalization Considerations . . . . . . . . . . . . . 22 90 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23 91 8.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 23 92 8.2. GSS-API Registration . . . . . . . . . . . . . . . . . . . 24 93 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 25 94 9.1. Normative References . . . . . . . . . . . . . . . . . . . 25 95 9.2. Informative References . . . . . . . . . . . . . . . . . . 26 96 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . . 28 97 Appendix B. Document History . . . . . . . . . . . . . . . . . . 29 98 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 31 100 1. Introduction 102 OAuth [RFC6749] enables a third-party application to obtain limited 103 access to a protected resource, either on behalf of a resource owner 104 by orchestrating an approval interaction, or by allowing the third- 105 party application to obtain access on its own behalf. The core OAuth 106 2.0 specification [RFC6749] does not define the interaction between 107 the client and the resource server with the access to a protected 108 resource using an Access Token. This functionality is described in 109 separate specifications, for example bearer tokens [RFC6750], OAuth 110 2.0 MAC tokens [I-D.ietf-oauth-v2-http-mac]. OAuth 1.0a [RFC5849], 111 the predecessor of OAuth 2.0, has a similar design. The main use 112 cases for OAuth 2.0 and OAuth 1.0 have so far focused on an HTTP- 113 based environment only. 115 Figure 1 shows the abstract message flow as shown in Figure 1 of 116 OAuth 2.0 [RFC6749]. 118 +--------+ +---------------+ 119 | |--(A)- Authorization Request ->| Resource | 120 | | | Owner | 121 | |<-(B)-- Authorization Grant ---| | 122 | | +---------------+ 123 | | 124 | | +---------------+ 125 | |--(C)-- Authorization Grant -->| Authorization | 126 | Client | | Server | 127 | |<-(D)----- Access Token -------| | 128 | | +---------------+ 129 | | 130 | | +---------------+ 131 | |--(E)----- Access Token ------>| Resource | 132 | | | Server | 133 | |<-(F)--- Protected Resource ---| | 134 +--------+ +---------------+ 136 Figure 1: Abstract OAuth 2.0 Protocol Flow 138 This document takes advantage of the OAuth protocol and its 139 deployment base to provide a way to use SASL [RFC4422] as well as the 140 GSS-API [RFC2743] to gain access to resources when using non-HTTP- 141 based protocols, such as the Internet Message Access Protocol (IMAP) 142 [RFC3501] and SMTP [RFC5321], which is what this memo uses in the 143 examples. 145 The Simple Authentication and Security Layer (SASL) is a framework 146 for providing authentication and data security services in 147 connection-oriented protocols via replaceable mechanisms. It 148 provides a structured interface between protocols and mechanisms. 149 The resulting framework allows new protocols to reuse existing 150 mechanisms and allows old protocols to make use of new mechanisms. 151 The framework also provides a protocol for securing subsequent 152 protocol exchanges within a data security layer. 154 The Generic Security Service Application Program Interface (GSS-API) 155 [RFC2743] provides a framework for applications to support multiple 156 authentication mechanisms through a unified interface. 158 This document defines SASL mechanisms for OAuth, and it conforms to 159 the new bridge between SASL and the GSS-API called GS2 [RFC5801]. 160 This means that this document defines both SASL and GSS-API 161 mechanisms. Implementers may be interested in either the SASL, the 162 GSS-API, or even both mechanisms. To facilitate these two variants, 163 the description has been split into two parts, one part that provides 164 normative references for those interested in the SASL OAuth mechanism 165 (see Section 3), and a second part for those implementers that wish 166 to implement the GSS-API portion (see Section 4). 168 When OAuth is integrated into SASL and the GSS-API the high-level 169 steps are as follows: 171 (A) The client requests authorization from the resource owner. 172 The authorization request can be made directly to the resource 173 owner (as shown), or preferably indirectly via the authorization 174 server as an intermediary. 176 (B) The client receives an authorization grant which is a 177 credential representing the resource owner's authorization, 178 expressed using one of four grant types defined in this 179 specification or using an extension grant type. The authorization 180 grant type depends on the method used by the client to request 181 authorization and the types supported by the authorization server. 183 (C) The client requests an access token by authenticating with the 184 authorization server and presenting the authorization grant. 186 (D) The authorization server authenticates the client and 187 validates the authorization grant, and if valid issues an access 188 token. 190 (E) The client requests the protected resource from the resource 191 server and authenticates by presenting the access token. 193 (F) The resource server validates the access token, and if valid, 194 indicates a successful authentication. 196 Steps (E) and (F) are not defined in [RFC6749] and are the main 197 functionality specified within this document. Consequently, the 198 message exchange shown in Figure 2 is the result of this 199 specification. The client will generally need to determine the 200 authentication endpoints (and perhaps the service endpoints) before 201 the OAuth 2.0 protocol exchange messages in steps (A)-(D) are 202 executed. The discovery of the resource owner and authorization 203 server endpoints is outside the scope of this specification. The 204 client must discover those endpoints using a discovery mechanisms 205 such as Webfinger using host-meta [I-D.ietf-appsawg-webfinger]. In 206 band discovery is not tenable if clients support the OAuth 2.0 207 password grant. Once credentials are obtained the client proceeds to 208 steps (E) and (F) defined in this specification. 210 ----+ 211 +--------+ +---------------+ | 212 | |--(A)-- Authorization Request --->| Resource | | 213 | | | Owner | |Plain 214 | |<-(B)------ Access Grant ---------| | |OAuth 215 | | +---------------+ |2.0 216 | | | 217 | | Client Credentials & +---------------+ | 218 | |--(C)------ Access Grant -------->| Authorization | | 219 | Client | | Server | | 220 | |<-(D)------ Access Token ---------| | | 221 | | (w/ Optional Refresh Token) +---------------+ | 222 | | ----+ 223 | | ----+ 224 | | +---------------+ | 225 | | | | |OAuth 226 | |--(E)------ Access Token -------->| Resource | |over 227 | | | Server | |SASL/ 228 | |<-(F)---- Protected Resource -----| | |GSS- 229 | | | | |API 230 +--------+ +---------------+ | 231 ----+ 233 Figure 2: OAuth SASL Architecture 235 2. Terminology 237 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 238 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 239 document are to be interpreted as described in [RFC2119]. 241 The reader is assumed to be familiar with the terms used in the OAuth 242 2.0 specification [RFC6749]. 244 In examples, "C:" and "S:" indicate lines sent by the client and 245 server respectively. Line breaks have been inserted for readability. 247 Note that the IMAP SASL specification requires base64 encoding, see 248 Section 4 of [RFC4648], not this memo. 250 3. OAuth SASL Mechanism Specifications 252 SASL is used as an authentication framework in a variety of 253 application layer protocols. This document defines the following 254 SASL mechanisms for usage with OAuth: 256 OAUTHBEARER: Authorization using OAuth 2.0 bearer tokens as 257 described in [RFC6750]. 259 OAUTH10A: Authorization using OAuth 1.0a MAC tokens (using the 260 HMAC-SHA1 keyed message digest) as described in Section 3.4.2 261 of [RFC5849]. 263 OAUTH10A-PLUS: Adds channel binding [RFC5056] capability to 264 OAUTH10A for protection against man-in-the-middle attacks. 266 New extensions may be defined to add additional OAuth Access Token 267 Types. Such a new SASL OAuth mechanism can be added by simply 268 registering the new name(s) and citing this specification for the 269 further definition. New channel binding enabled "-PLUS" mechanisms 270 defined in this way MUST include message integrity protection. A 271 newly defined mechanism would also need to register a new GS2 OID. 273 These mechanisms are client initiated and lock-step, the server 274 always replying to a client message. In the case where the client 275 has and correctly uses a valid token the flow is: 277 o Client sends a valid and correct initial client response. 279 o Server responds with a successful authentication. 281 In the case where authorization fails the server sends an error 282 result, then client MUST then send an additional message to the 283 server in order to allow the server to finish the exchange. Some 284 protocols and common SASL implementations do not support both sending 285 a SASL message and finalizing a SASL negotiation, the additional 286 client message in the error case deals with this problem. This 287 exchange is: 289 o Client sends an invalid initial client response. 291 o Server responds with an error message. 293 o Client sends a dummy client response. 295 o Server fails the authentication. 297 3.1. Initial Client Response 299 Client responses are a key/value pair sequence. The initial client 300 response includes a gs2-header as defined in GS2 [RFC5801], which 301 carries the authorization ID. These key/value pairs carry the 302 equivalent values from an HTTP context in order to be able to 303 complete an OAuth style HTTP authorization. Unknown key/value pairs 304 MUST be ignored by the server. The ABNF [RFC5234] syntax is: 306 kvsep = %x01 307 key = 1*ALPHA 308 value = *(VCHAR / SP / HTAB / CR / LF ) 309 kvpair = key "=" value kvsep 310 client_resp = 0*kvpair kvsep 311 ;; gs2-header = As defined in GSS-API 312 initial_client_resp = gs2-header kvsep client_resp 314 The following key/value pairs are defined in the client response: 316 auth (REQUIRED): The payload of the HTTP Authorization header for 317 an equivalent HTTP OAuth authorization. 319 host: Contains the host name to which the client connected. 321 port: Contains the port number represented as a decimal positive 322 integer string without leading zeros to which the client 323 connected. 325 qs: The HTTP query string. In non-channel binding mechanisms 326 this is reserved, the client SHOUD NOT send it, and has the 327 default value of "". In "-PLUS" variants this carries a single 328 key value pair "cbdata" for the channel binding data payload 329 formatted as an HTTP query string. 331 For OAuth Access Token Types that use digital signatures or keyed 332 message digests the client MUST send host and port number key/values, 333 and the server MUST fail an authorization request requiring 334 signatures or keyed message digests that do not have host and port 335 values. For authorization schemes that require a URI scheme as part 336 of the data being signed "http" is always used. In OAuth 1.0a for 337 example, the so-called signature base string calculation includes the 338 reconstructed HTTP URL. 340 3.1.1. Reserved Key/Values 342 In these mechanisms values for path, query string and post body are 343 assigned default values. OAuth authorization schemes MAY define 344 usage of these in the SASL context and extend this specification. 345 For OAuth Access Token Types that use request signatures the default 346 values MUST be used unless explicit values are provided in the client 347 response. The following key values are reserved for future use: 349 mthd (RESERVED): HTTP method for use in signatures, the default 350 value is "POST". 352 path (RESERVED): HTTP path data, the default value is "/". 354 post (RESERVED): HTTP post data, the default value is "". 356 3.1.2. Use of the gs2-header 358 The OAuth scheme related mechanisms are also GSS-API mechanisms, see 359 Section 4 for further detail. The gs2-header is used as follows: 361 o The "gs2-nonstd-flag" MUST NOT be present. 363 o The "gs2-authzid" carries the authorization identity as specified 364 in [RFC5801]. If present the application MUST determine whether 365 access is granted for the identity asserted in the OAuth 366 credential, if it does not the server MUST fail the negotiation. 368 In the non "-PLUS" mechanisms the "gs2-cb-flag" MUST be set to "n" 369 because channel-binding [RFC5056] data is not expected. In the 370 OAUTH10A-PLUS mechanism (or other -PLUS variants based on this 371 specification) the "gs2-cb-flag" MUST be set appropriately by the 372 client. 374 3.2. Server's Response 376 The server validates the response per the specification for the OAuth 377 Access Token Types used. If the OAuth Access Token Type utilizes a 378 digital signature or a keyed message digest of the request parameters 379 then the client must provide a client response that satisfies the 380 data requirements for the scheme in use. 382 In a "-PLUS" mechanism the server examines the channel binding data, 383 extracts the channel binding unique prefix, and extracts the raw 384 channel biding data based on the channel binding type used. It then 385 computes it's own copy of the channel binding payload and compares 386 that to the payload sent by the client in the cbdata key/value. 387 Those two must be equal for channel binding to succeed. 389 The server responds to a successfully verified client message by 390 completing the SASL negotiation. The authenticated identity reported 391 by the SASL mechanism is the identity securely established for the 392 client with the OAuth credential. The application, not the SASL 393 mechanism, based on local access policy determines whether the 394 identity reported by the mechanism is allowed access to the requested 395 resource. Note that the semantics of the authz-id is specified by 396 the SASL framework [RFC4422]. 398 3.2.1. OAuth Identifiers in the SASL Context 400 OAuth access tokens may carry the authenticated identifier of the 401 resource owner and client authentication provides the authenticated 402 identity of the client issuing the request to the resource server. 404 If both identities are needed by an application the developer will 405 need to provide a way to communicate that from the SASL mechanism 406 back to the application such as a GSS-API [RFC2743] named type like 407 GSS_C_NT_USER_NAME or a comparable newly defined GSS-API name type or 408 name attribute [RFC6680]. 410 3.2.2. Server Response to Failed Authentication 412 For a failed authentication the server returns a JSON [RFC4627] 413 formatted error result, and fails the authentication. The error 414 result consists of the following values: 416 status (REQUIRED): The authorization error code. Valid error 417 codes are defined in the IANA [[need registry name]] registry 418 specified in the OAuth 2 core specification. 420 scope (OPTIONAL): An OAuth scope which is valid to access the 421 service. This may be empty which implies that unscoped tokens 422 are required, or a space separated list. Use of a space 423 separated list is NOT RECOMMENDED. 425 If the resource server provides a scope then the client MUST always 426 request scoped tokens from the token endpoint. If the resource 427 server provides no scope to the client then the client SHOULD presume 428 an empty scope (unscoped token) is needed. 430 If channel binding is in use and the channel binding fails the server 431 responds with a status code set to 412 to indicate that the channel 432 binding precondition failed. If the authentication scheme in use 433 does not include signing the server SHOULD revoke the presented 434 credential and the client SHOULD discard that credential. 436 3.2.3. Completing an Error Message Sequence 438 Section 3.6 of [RFC4422] explicitly prohibits additional information 439 in an unsuccessful authentication outcome. Therefore, the error 440 message is sent in a normal message. The client MUST then send an 441 additional client response consisting of a single %x01 (control A) 442 character to the server in order to allow the server to finish the 443 exchange. 445 3.3. OAuth Access Token Types using Digital Signatures and Keyed 446 Message Digests 448 OAuth Access Token Types may use digital signatures or keyed message 449 digests. The client and the resource server need to perform a 450 cryptographic computation for integrity protection and data origin 451 authentication. 453 OAuth is designed for access to resources identified by URIs. SASL 454 is designed for user authentication, and has no facility for more 455 fine-grained access control. In this specification we require or 456 define default values for the data elements from an HTTP request 457 which allow the signature base string to be constructed properly. 458 The default HTTP path is "/" and the default post body is empty. 459 These atoms are defined as extension points so that no changes are 460 needed if there is a revision of SASL which supports more specific 461 resource authorization, e.g., IMAP access to a specific folder or FTP 462 access limited to a specific directory. 464 Using the example in the OAuth 1.0a specification as a starting 465 point, on an IMAP server running on port 143 and given the OAuth 1.0a 466 style authorization request (with %x01 shown as ^A and line breaks 467 added for readability) below: 469 n,a=user@example.com^A 470 host=example.com^A 471 user=user@example.com^A 472 port=143^A 473 auth=OAuth realm="Example", 474 oauth_consumer_key="9djdj82h48djs9d2", 475 oauth_token="kkk9d7dh3k39sjv7", 476 oauth_signature_method="HMAC-SHA1", 477 oauth_timestamp="137131201", 478 oauth_nonce="7d8f3e4a", 479 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU%3D"^A^A 481 The signature base string would be constructed per the OAuth 1.0 482 specification [RFC5849] with the following things noted: 484 o The method value is defaulted to POST. 486 o The scheme defaults to be "http", and any port number other than 487 80 is included. 489 o The path defaults to "/". 491 o The query string defaults to "". 493 In this example the signature base string with line breaks added for 494 readability would be: 496 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 497 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 498 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 500 3.4. Channel Binding 502 The channel binding data is carried in the "qs" (query string) key 503 value pair formatted as a standard HTTP query parameter with the name 504 "cbdata". Channel binding requires that the channel binding data be 505 integrity protected end-to-end in order to protect against man-in- 506 the-middle attacks. All SASL OAuth mechanisms with a "-PLUS" postfix 507 MUST provide integrity protection. It should be noted that while the 508 Bearer Access Token Type mandates TLS it does not create keying 509 material at the application layer and is not suitable for use with 510 channel bindings. 512 The channel binding data is computed by the client based on it's 513 choice of preferred channel binding type. As specified in [RFC5056], 514 the channel binding information MUST start with the channel binding 515 unique prefix, followed by a colon (ASCII 0x3A), followed by a base64 516 encoded channel binding payload. The channel binding payload is the 517 raw data from the channel binding type. For example, if the client 518 is using tls-unique for channel binding then the raw channel binding 519 data is the TLS finished message as specified in Section 3.1 of 520 [RFC5929]. 522 4. GSS-API OAuth Mechanism Specification 524 Note: The normative references in this section are informational for 525 SASL implementers, but they are normative for GSS-API implementers. 527 A SASL OAuth mechanism is also a GSS-API mechanism and the messages 528 described in Section 3 are the same with the following changes to the 529 GS2 related elements: 531 1. the GS2 header on the client's first message is excluded when 532 used as a GSS-API mechanism. 534 2. the initial context token header is prefixed to the client's 535 first authentication message (context token), as described in 536 Section 3.1 of RFC 2743, 538 The GSS-API mechanism OIDs are: 540 o OAUTHBEARER: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 542 o OAUTH10A: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 544 OAuth mechanims security contexts always have the mutual_state flag 545 (GSS_C_MUTUAL_FLAG) set to TRUE. OAuth supports credential 546 delegation, therefore security contexts may have the deleg_state flag 547 (GSS_C_DELEG_FLAG) set to either TRUE or FALSE. 549 The mutual authentication property of this mechanism relies on 550 successfully comparing the TLS server identity with the negotiated 551 target name. Since the TLS channel is managed by the application 552 outside of the GSS-API mechanism, the mechanism itself is unable to 553 confirm the name while the application is able to perform this 554 comparison for the mechanism. For this reason, applications MUST 555 match the TLS server identity with the target name using the 556 appropriate application profile, as discussed in [RFC6125]. For 557 example, when SASL OAuth is run over IMAP then the IMAP profile of 558 RFC 6125 is used. 560 OAuth mechanisms do not support per-message tokens or 561 GSS_Pseudo_random. 563 OAuth supports a standard generic name syntax for acceptors, such as 564 GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], Section 4.1). These 565 service names MUST be associated with the "entityID" claimed by the 566 RP. OAuth mechanisms support only a single name type for initiators: 567 GSS_C_NT_USER_NAME. GSS_C_NT_USER_NAME is the default name type. 568 The query, display, and exported name syntaxes for OAuth principal 569 names are all the same. There is no OAuth-specific name syntax; 570 applications SHOULD use generic GSS-API name types, such as 571 GSS_C_NT_USER_NAME and GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], 572 Section 4). The exported name token does, of course, conform to 573 [RFC2743], Section 3.2, but the "NAME" part of the token should be 574 treated as a potential input string to the OAuth name normalization 575 rules. 577 5. Examples 579 These examples illustrate exchanges between an IMAP and SMTP clients 580 and servers. 582 Note to implementers: The SASL OAuth method names are case 583 insensitive. One example uses "Bearer" but that could as easily be 584 "bearer", "BEARER", or "BeArEr". 586 5.1. Successful Bearer Token Exchange 588 This example shows a successful OAuth 2.0 bearer token exchange. 589 Note that line breaks are inserted for readability. 591 S: * OK IMAP4rev1 Server Ready 592 C: t0 CAPABILITY 593 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 594 S: t0 OK Completed 595 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 596 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 597 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 598 S: t1 OK SASL authentication succeeded 600 As required by IMAP [RFC3501], the payloads are base64-encoded. The 601 decoded initial client response (with %x01 represented as ^A and long 602 lines wrapped for readability) is: 604 n,a=user@example.com^Ahost=server.example.com^Aport=143^A 605 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 607 The same credential used in an SMTP exchange is shown below. Note 608 that line breaks are inserted for readability, and that the SMTP 609 protocol terminates lines with CR and LF characters (ASCII values 610 0x0D and 0x0A), these are not displayed explicitly in the example. 612 [connection begins] 613 S: 220 mx.example.com ESMTP 12sm2095603fks.9 614 C: EHLO sender.example.com 615 S: 250-mx.example.com at your service,[172.31.135.47] 616 S: 250-SIZE 35651584 617 S: 250-8BITMIME 618 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 619 S: 250-ENHANCEDSTATUSCODES 620 S: 250 PIPELINING 621 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 622 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 623 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 624 S: 235 Authentication successful. 625 [connection continues...] 627 5.2. OAuth 1.0a Authorization with Channel Binding 629 This example shows channel binding in the context of an OAuth 1.0a 630 request using a keyed message digest. Note that line breaks are 631 inserted for readability. 633 S: * OK [CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR] 634 IMAP4rev1 Server Ready 635 C: t1 AUTHENTICATE OAUTH10A-PLUS cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcGxlL 636 mNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoPU9BdXRoI 637 HJlYWxtPSJFeGFtcGxlIixvYXV0aF9jb25zdW1lcl9rZXk9IjlkamRqODJoNDhka 638 nM5ZDIiLG9hdXRoX3Rva2VuPSJra2s5ZDdkaDNrMzlzanY3IixvYXV0aF9zaWduY 639 XR1cmVfbWV0aG9kPSJITUFDLVNIQTEiLG9hdXRoX3RpbWVzdGFtcD0iMTM3MTMxM 640 jAxIixvYXV0aF9ub25jZT0iN2Q4ZjNlNGEiLG9hdXRoX3NpZ25hdHVyZT0iU1Nkd 641 ElHRWdiR2wwZEd4bElIUmxZU0J3YjNRdSIBcXM9Y2JkYXRhPXRscy11bmlxdWU6U 642 0c5M0lHSnBaeUJwY3lCaElGUk1VeUJtYVc1aGJDQnRaWE56WVdkbFB3bz0BAQ== 643 S: t1 OK SASL authentication succeeded 645 As required by IMAP [RFC3501], the payloads are base64-encoded. The 646 decoded initial client response (with %x01 represented as ^A and 647 lines wrapped for readability) is: 649 p=tls-unique,a=user@example.com^A 650 host=server.example.com^A 651 port=143^A 652 auth=OAuth realm="Example", 653 oauth_consumer_key="9djdj82h48djs9d2", 654 oauth_token="kkk9d7dh3k39sjv7", 655 oauth_signature_method="HMAC-SHA1", 656 oauth_timestamp="137131201", 657 oauth_nonce="7d8f3e4a", 658 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A 659 qs=cbdata=tls-unique:SG93IGJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=^A^A 661 In this example the signature base string with line breaks added for 662 readability would be: 664 POST&http%3A%2F%2Fserver.example.com:143%2F&cbdata=tls-unique:SG93I 665 GJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=%26oauth_consumer_key%3D9djd 666 j82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHM 667 AC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39s 668 jv7 670 5.3. Failed Exchange 672 This example shows a failed exchange because of the empty 673 Authorization header, which is how a client can query for the needed 674 scope. Note that line breaks are inserted for readability. 676 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 677 Ready 678 S: t0 OK Completed 679 C: t1 AUTHENTICATE OAUTHBEARER cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcG 680 xlLmNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoP 681 QFjYmRhdGE9AQE= 682 S: + ewoic3RhdHVzIjoiNDAxIgoic2NvcGUiOiJleGFtcGxlX3Njb3BlIgp9 683 C: + AQ== 684 S: t1 NO SASL authentication failed 686 The decoded initial client response is: 688 n,a=user@example.com,^Ahost=server.example.com^A 689 port=143^Aauth=^A^A 691 The decoded server error response is: 693 { 694 "status":"401", 695 "scope":"example_scope" 696 } 698 The client responds with the required dummy response. 700 5.4. Failed Channel Binding 702 This example shows a channel binding failure in an empty request. 703 The channel binding information is empty. Note that line breaks are 704 inserted for readability. 706 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 707 Ready 708 S: t0 OK Completed 709 C: t1 AUTHENTICATE OAUTH10A-PLUS cCxhPXVzZXJAZXhhbXBsZS5jb20BaG9z 710 dD1zZXJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD0BY2JkYXRhPQEB 711 S: + ewoic3RhdHVzIjoiNDEyIiwKInNjb3BlIjoiZXhhbXBsZV9zY29wZSIKfQ== 712 C: + AQ== 713 S: t1 NO SASL authentication failed 715 The decoded initial client response is: 717 p=tls-unique,a=user@example.com,^Ahost=server.example.com^A 718 port=143^Aauth=^Acbdata=^A^A 720 The decoded server response is: 722 { 723 "status":"412", 724 "scope":"example_scope" 725 } 727 The client responds with the required dummy response. 729 5.5. SMTP Example of a Failed Negotiation 731 This example shows an authorization failure in an SMTP exchange. 732 Note that line breaks are inserted for readability, and that the SMTP 733 protocol terminates lines with CR and LF characters (ASCII values 734 0x0D and 0x0A), these are not displayed explicitly in the example. 736 [connection begins] 737 S: 220 mx.example.com ESMTP 12sm2095603fks.9 738 C: EHLO sender.example.com 739 S: 250-mx.example.com at your service,[172.31.135.47] 740 S: 250-SIZE 35651584 741 S: 250-8BITMIME 742 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 743 S: 250-ENHANCEDSTATUSCODES 744 S: 250 PIPELINING 745 C: AUTH OAUTHBEARER bixhPT1zb21ldXNlckBleGFtcGxlLmNvbQFhdXRoPUJlYXJlciB2 746 RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 747 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 748 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 749 C: AQ== 750 S: 535-5.7.1 Username and Password not accepted. Learn more at 751 S: 535 5.7.1 http://support.example.com/mail/oauth 752 [connection continues...] 754 The server returned an error message in the 334 SASL message, the 755 client responds with the required dummy response, and the server 756 finalizes the negotiation. 758 6. Security Considerations 760 OAuth 1.0a and OAuth 2 allows for a variety of deployment scenarios, 761 and the security properties of these profiles vary. Application 762 developers therefore need to understand the needs of their 763 applications before selecting a specific SASL OAuth mechanism. 765 The channel binding in this mechanism has different properties based 766 on the Access Token Type used. 768 It is possible that SASL will be authenticating a connection and the 769 life of that connection may outlast the life of the access token used 770 to establish 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 The OAuth access token (and related keying material) is not 776 equivalent to the user's long term password. As such, care has to be 777 taken when these OAuth credentials are used for actions like changing 778 passwords (as it is possible with some protocols, e.g., XMPP). The 779 server SHOULD ensure that actions taken in the authenticated channel 780 are appropriate to the strength of the presented credential. 782 Access tokens have a lifetime. Reducing the lifetime of an access 783 token provides security benefits, as described in 784 [I-D.ietf-oauth-v2-threatmodel], and OAuth 2.0 introduces refresh 785 tokens to obtain new access token on the fly. Additionally, a 786 previously obtained access token MAY be revoked or rendered invalid 787 at any time. The client MAY request a new access token for each 788 connection to a resource server, but it SHOULD cache and re-use 789 access credentials that appear to be valid. 791 7. Internationalization Considerations 793 The identifer asserted by the OAuth authorization server about the 794 resource owner inside the access token may be displayed to a human. 795 For example, when SASL is used in the context of IMAP the resource 796 server may assert the resource owner's email address to the IMAP 797 server for usage in an email-based application. The identifier may 798 therefore contain internationalized characters and an application 799 needs to ensure that the mapping between the identifier provided by 800 OAuth is suitable for use with the application layer protocol SASL is 801 incorporated into. 803 At the time of writing the standardization of the assertion format 804 (in JSON format) is still ongoing, see 805 [I-D.ietf-oauth-json-web-token]. 807 8. IANA Considerations 809 8.1. SASL Registration 811 The IANA is requested to register the following SASL profile: 813 SASL mechanism profile: OAUTHBEARER 815 Security Considerations: See this document 817 Published Specification: See this document 819 For further information: Contact the authors of this document. 821 Owner/Change controller: the IETF 823 Note: None 825 The IANA is requested to register the following SASL profile: 827 SASL mechanism profile: OAUTH10A 829 Security Considerations: See this document 831 Published Specification: See this document 833 For further information: Contact the authors of this document. 835 Owner/Change controller: the IETF 837 Note: None 839 The IANA is requested to register the following SASL profile: 841 SASL mechanism profile: OAUTH10A-PLUS 843 Security Considerations: See this document 845 Published Specification: See this document 847 For further information: Contact the authors of this document. 849 Owner/Change controller: the IETF 851 Note: None 853 8.2. GSS-API Registration 855 IANA is further requested to assign an OID for these GSS mechanisms 856 in the SMI numbers registry, with the prefix of 857 iso.org.dod.internet.security.mechanisms (1.3.6.1.5.5) and to 858 reference this specification in the registry. 860 9. References 862 9.1. Normative References 864 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 865 Requirement Levels", BCP 14, RFC 2119, March 1997. 867 [RFC2473] Conta, A. and S. Deering, "Generic Packet Tunneling in 868 IPv6 Specification", RFC 2473, December 1998. 870 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 871 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 872 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 874 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 875 Leach, P., Luotonen, A., and L. Stewart, "HTTP 876 Authentication: Basic and Digest Access Authentication", 877 RFC 2617, June 1999. 879 [RFC2743] Linn, J., "Generic Security Service Application Program 880 Interface Version 2, Update 1", RFC 2743, January 2000. 882 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 883 (SHA1)", RFC 3174, September 2001. 885 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 886 Security Layer (SASL)", RFC 4422, June 2006. 888 [RFC4627] Crockford, D., "The application/json Media Type for 889 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 891 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 892 Encodings", RFC 4648, October 2006. 894 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 895 Channels", RFC 5056, November 2007. 897 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 898 Specifications: ABNF", STD 68, RFC 5234, January 2008. 900 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 901 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 903 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 904 October 2008. 906 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 907 Service Application Program Interface (GSS-API) Mechanisms 908 in Simple Authentication and Security Layer (SASL): The 909 GS2 Mechanism Family", RFC 5801, July 2010. 911 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 912 April 2010. 914 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 915 for TLS", RFC 5929, July 2010. 917 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 919 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 920 Verification of Domain-Based Application Service Identity 921 within Internet Public Key Infrastructure Using X.509 922 (PKIX) Certificates in the Context of Transport Layer 923 Security (TLS)", RFC 6125, March 2011. 925 [RFC6680] Williams, N., Johansson, L., Hartman, S., and S. 926 Josefsson, "Generic Security Service Application 927 Programming Interface (GSS-API) Naming Extensions", 928 RFC 6680, August 2012. 930 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", 931 RFC 6749, October 2012. 933 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 934 Framework: Bearer Token Usage", RFC 6750, October 2012. 936 9.2. Informative References 938 [I-D.ietf-appsawg-webfinger] 939 Jones, P., Salgueiro, G., and J. Smarr, "WebFinger", 940 draft-ietf-appsawg-webfinger-07 (work in progress), 941 December 2012. 943 [I-D.ietf-oauth-json-web-token] 944 Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 945 (JWT)", draft-ietf-oauth-json-web-token-05 (work in 946 progress), November 2012. 948 [I-D.ietf-oauth-v2-http-mac] 949 Richer, J., Mills, W., and H. Tschofenig, "OAuth 2.0 950 Message Authentication Code (MAC) Tokens", 951 draft-ietf-oauth-v2-http-mac-02 (work in progress), 952 November 2012. 954 [I-D.ietf-oauth-v2-threatmodel] 955 Lodderstedt, T., McGloin, M., and P. Hunt, "OAuth 2.0 956 Threat Model and Security Considerations", 957 draft-ietf-oauth-v2-threatmodel-08 (work in progress), 958 October 2012. 960 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 961 4rev1", RFC 3501, March 2003. 963 Appendix A. Acknowlegements 965 The authors would like to thank the members of the Kitten working 966 group, and in addition and specifically: Simon Josefson, Torsten 967 Lodderstadt, Ryan Troll, Alexey Melnikov, and Nico Williams. 969 This document was produced under the chairmanship of Alexey Melnikov, 970 Tom Yu, Shawn Emery, Josh Howlett, Sam Hartman. The area directors 971 included Stephen Farrell. 973 Appendix B. Document History 975 [[ to be removed by RFC editor before publication as an RFC ]] 977 -09 979 o Incorporated review by Alexey and Hannes. 981 o Clarified the three OAuth SASL mechanisms. 983 o Updated references 985 o Extended acknowledgements 987 -08 989 o Fixed the channel binding examples for p=$cbtype 991 o More tuning of the authcid language and edited and renamed 3.2.1. 993 -07 995 o Struck the MUST langiage from authzid. 997 o 999 -06 1001 o Removed the user field. Fixed the examples again. 1003 o Added canonicalization language. 1005 o 1007 -05 1009 o Fixed the GS2 header language again. 1011 o Separated out different OAuth schemes into different SASL 1012 mechanisms. Took out the scheme in the error return. Tuned up 1013 the IANA registrations. 1015 o Added the user field back into the SASL message. 1017 o Fixed the examples (again). 1019 o 1020 -04 1022 o Changed user field to be carried in the gs2-header, and made gs2 1023 header explicit in all cases. 1025 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 1026 reference. 1028 o Changed to sending an empty client response (single control-A) as 1029 the second message of a failed sequence. 1031 o Fixed channel binding prose to refer to the normative specs and 1032 removed the hashing of large channel binding data, which brought 1033 mroe problems than it solved. 1035 o Added a SMTP examples for Bearer use case. 1037 -03 1039 o Added user field into examples and fixed egregious errors there as 1040 well. 1042 o Added text reminding developers that Authorization scheme names 1043 are case insensitive. 1045 -02 1047 o Added the user data element back in. 1049 o Minor editorial changes. 1051 -01 1053 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 1054 webfinger instead of WF and SWD older drafts. 1056 o Replacing HTTP as the message format and adjusted all examples. 1058 -00 1060 o Renamed draft into proper IETF naming format now that it's 1061 adopted. 1063 o Minor fixes. 1065 Authors' Addresses 1067 William Mills 1068 Yahoo! Inc. 1070 Phone: 1071 Email: wmills@yahoo-inc.com 1073 Tim Showalter 1075 Phone: 1076 Email: tjs@psaux.com 1078 Hannes Tschofenig 1079 Nokia Siemens Networks 1080 Linnoitustie 6 1081 Espoo 02600 1082 Finland 1084 Phone: +358 (50) 4871445 1085 Email: Hannes.Tschofenig@gmx.net 1086 URI: http://www.tschofenig.priv.at