idnits 2.17.00 (12 Aug 2021) /tmp/idnits37973/draft-ietf-kitten-sasl-oauth-11.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 9 instances of too long lines in the document, the longest one being 3 characters in excess of 72. 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 (October 17, 2013) is 3137 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: 'RFC3174' is defined on line 799, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 817, but no explicit reference was found in the text ** 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) == 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-04 -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 5 errors (**), 0 flaws (~~), 6 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: April 20, 2014 6 H. Tschofenig 7 Nokia Solutions and Networks 8 October 17, 2013 10 A set of SASL Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-11.txt 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) to access a protected resource at a resource serve. Thereby, 23 it enables schemes defined within the OAuth framework for non-HTTP- 24 based application protocols. 26 Clients typically store the user's long-term credential. This does, 27 however, lead to significant security vulnerabilities, for example, 28 when such a credential leaks. A significant benefit of OAuth for 29 usage in those clients is that the password is replaced by a shared 30 secret with higher entropy, i.e., the token. Tokens typically 31 provide limited access rights and can be managed and revoked 32 separately from the user's long-term password. 34 Status of This Memo 36 This Internet-Draft is submitted in full conformance with the 37 provisions of BCP 78 and BCP 79. 39 Internet-Drafts are working documents of the Internet Engineering 40 Task Force (IETF). Note that other groups may also distribute 41 working documents as Internet-Drafts. The list of current Internet- 42 Drafts is at http://datatracker.ietf.org/drafts/current/. 44 Internet-Drafts are draft documents valid for a maximum of six months 45 and may be updated, replaced, or obsoleted by other documents at any 46 time. It is inappropriate to use Internet-Drafts as reference 47 material or to cite them other than as "work in progress." 48 This Internet-Draft will expire on April 20, 2014. 50 Copyright Notice 52 Copyright (c) 2013 IETF Trust and the persons identified as the 53 document authors. All rights reserved. 55 This document is subject to BCP 78 and the IETF Trust's Legal 56 Provisions Relating to IETF Documents 57 (http://trustee.ietf.org/license-info) in effect on the date of 58 publication of this document. Please review these documents 59 carefully, as they describe your rights and restrictions with respect 60 to this document. Code Components extracted from this document must 61 include Simplified BSD License text as described in Section 4.e of 62 the Trust Legal Provisions and are provided without warranty as 63 described in the Simplified BSD License. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 68 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 69 3. OAuth SASL Mechanism Specifications . . . . . . . . . . . . . 5 70 3.1. Initial Client Response . . . . . . . . . . . . . . . . . 7 71 3.1.1. Reserved Key/Values . . . . . . . . . . . . . . . . . 7 72 3.2. Server's Response . . . . . . . . . . . . . . . . . . . . 8 73 3.2.1. OAuth Identifiers in the SASL Context . . . . . . . . 8 74 3.2.2. Server Response to Failed Authentication . . . . . . 9 75 3.2.3. Completing an Error Message Sequence . . . . . . . . 9 76 3.3. OAuth Access Token Types using Keyed Message Digests . . 9 77 3.4. Channel Binding . . . . . . . . . . . . . . . . . . . . . 10 78 4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 11 79 4.1. Successful Bearer Token Exchange . . . . . . . . . . . . 11 80 4.2. OAuth 1.0a Authorization with Channel Binding . . . . . . 12 81 4.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 13 82 4.4. Failed Channel Binding . . . . . . . . . . . . . . . . . 14 83 4.5. SMTP Example of a Failed Negotiation . . . . . . . . . . 14 84 5. Security Considerations . . . . . . . . . . . . . . . . . . . 15 85 6. Internationalization Considerations . . . . . . . . . . . . . 16 86 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 87 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 17 88 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 18 89 8.1. Normative References . . . . . . . . . . . . . . . . . . 18 90 8.2. Informative References . . . . . . . . . . . . . . . . . 19 91 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . 19 92 Appendix B. Document History . . . . . . . . . . . . . . . . . . 19 93 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 95 1. Introduction 97 OAuth 1.0a [RFC5849] and OAuth 2.0 [RFC6749] are protocol frameworks 98 that enable a third-party application to obtain limited access to a 99 protected resource, either on behalf of a resource owner by 100 orchestrating an approval interaction, or by allowing the third-party 101 application to obtain access on its own behalf. 103 The core OAuth 2.0 specification [RFC6749] specifies the interaction 104 between the OAuth client and the authorization server; it does not 105 define the interaction between the OAuth client and the resource 106 server for the access to a protected resource using an Access Token. 107 Instead, the OAuth client to resource server interaction is described 108 in separate specifications, such as the bearer token specification 109 [RFC6750] and the MAC Token specification 110 [I-D.ietf-oauth-v2-http-mac]. OAuth 1.0a included the protocol 111 specification for the communication between the OAuth client and the 112 resource server in [RFC5849]. 114 The main use cases for OAuth 2.0 and OAuth 1.0a have so far focused 115 on an HTTP-based environment only. This document integrates OAuth 116 1.0a and OAuth 2.0 into non-HTTP-based applications using the 117 integration into SASL. Hence, this document takes advantage of the 118 OAuth protocol and its deployment base to provide a way to use the 119 Simple Authentication and Security Layer (SASL) [RFC4422] to gain 120 access to resources when using non-HTTP-based protocols, such as the 121 Internet Message Access Protocol (IMAP) [RFC3501] and SMTP [RFC5321], 122 which is what this memo uses in the examples. 124 To illustrate the impact of integrating this specification into an 125 OAuth-enabled application environment Figure 1 shows the abstract 126 message flow of OAuth 2.0 [RFC6749]. As indicated in the figure, 127 this document impacts the exchange of messages (E) and (F) since SASL 128 is used for interaction between the client and the resource server 129 instead of HTTP. 131 ----+ 132 +--------+ +---------------+ | 133 | |--(A)-- Authorization Request --->| Resource | | 134 | | | Owner | |Plain 135 | |<-(B)------ Access Grant ---------| | |OAuth 136 | | +---------------+ |2.0 137 | | | 138 | | Client Credentials & +---------------+ | 139 | |--(C)------ Access Grant -------->| Authorization | | 140 | Client | | Server | | 141 | |<-(D)------ Access Token ---------| | | 142 | | (w/ Optional Refresh Token) +---------------+ | 143 | | ----+ 144 | | ----+ 145 | | +---------------+ | 146 | | | | |OAuth 147 | |--(E)------ Access Token -------->| Resource | |over 148 | | | Server | |SASL 149 | |<-(F)---- Protected Resource -----| | | 150 | | | | | 151 +--------+ +---------------+ | 152 ----+ 154 Figure 1: OAuth 2.0 Protocol Flow 156 The Simple Authentication and Security Layer (SASL) is a framework 157 for providing authentication and data security services in 158 connection-oriented protocols via replaceable authentication 159 mechanisms. It provides a structured interface between protocols and 160 mechanisms. The resulting framework allows new protocols to reuse 161 existing authentication protocols and allows old protocols to make 162 use of new authentication mechanisms. The framework also provides a 163 protocol for securing subsequent protocol exchanges within a data 164 security layer. 166 When OAuth is integrated into SASL the high-level steps are as 167 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 Again, steps (E) and (F) are not defined in [RFC6749] (but are 195 described in, for example, [RFC6750] for the OAuth Bearer Token 196 instead) and are the main functionality specified within this 197 document. Consequently, the message exchange shown in Figure 1 is 198 the result of this specification. The client will generally need to 199 determine the authentication endpoints (and perhaps the service 200 endpoints) before the OAuth 2.0 protocol exchange messages in steps 201 (A)-(D) are executed. The discovery of the resource owner and 202 authorization server endpoints is outside the scope of this 203 specification. The client must discover those endpoints using a 204 discovery mechanisms, such as Webfinger using host-meta [RFC7033]. 205 In band discovery is not tenable if clients support the OAuth 2.0 206 password grant. Once credentials are obtained the client proceeds to 207 steps (E) and (F) defined in this specification. 209 OAuth 1.0 follows a similar model but uses a different terminology 210 and does not separate the resource server from the authorization 211 server. 213 2. Terminology 215 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 216 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 217 document are to be interpreted as described in [RFC2119]. 219 The reader is assumed to be familiar with the terms used in the OAuth 220 2.0 specification [RFC6749]. 222 In examples, "C:" and "S:" indicate lines sent by the client and 223 server respectively. Line breaks have been inserted for readability. 225 Note that the IMAP SASL specification requires base64 encoding, see 226 Section 4 of [RFC4648], not this memo. 228 3. OAuth SASL Mechanism Specifications 230 SASL is used as an authentication framework in a variety of 231 application layer protocols. This document defines the following 232 SASL mechanisms for usage with OAuth: 234 OAUTHBEARER: OAuth 2.0 bearer tokens, as described in [RFC6750]. 235 RFC 6750 uses Transport Layer Security (TLS) to secure the 236 protocol interaction between the client and the resource 237 server. 239 OAUTH10A: OAuth 1.0a MAC tokens (using the HMAC-SHA1 keyed 240 message digest), as described in Section 3.4.2 of [RFC5849]. 242 OAUTH10A-PLUS: Adds channel binding [RFC5056] capability to 243 OAUTH10A for protection against man-in-the-middle attacks. 244 OAUTH10A-PLUS mandates the usage of Transport Layer Security 245 (TLS). 247 New extensions may be defined to add additional OAuth Access Token 248 Types. Such a new SASL OAuth mechanism can be added by simply 249 registering the new name(s) and citing this specification for the 250 further definition. New channel binding enabled "-PLUS" mechanisms 251 defined in this way MUST include message integrity protection. 253 These mechanisms are client initiated and lock-step, the server 254 always replying to a client message. In the case where the client 255 has and correctly uses a valid token the flow is: 257 o Client sends a valid and correct initial client response. 259 o Server responds with a successful authentication. 261 In the case where authorization fails the server sends an error 262 result, then client MUST then send an additional message to the 263 server in order to allow the server to finish the exchange. Some 264 protocols and common SASL implementations do not support both sending 265 a SASL message and finalizing a SASL negotiation, the additional 266 client message in the error case deals with this problem. This 267 exchange is: 269 o Client sends an invalid initial client response. 271 o Server responds with an error message. 273 o Client sends a dummy client response. 275 o Server fails the authentication. 277 3.1. Initial Client Response 279 Client responses are a key/value pair sequence. These key/value 280 pairs carry the equivalent values from an HTTP context in order to be 281 able to complete an OAuth style HTTP authorization. Unknown key/ 282 value pairs MUST be ignored by the server. The ABNF [RFC5234] syntax 283 is: 285 kvsep = %x01 286 key = 1*ALPHA 287 value = *(VCHAR / SP / HTAB / CR / LF ) 288 kvpair = key "=" value kvsep 289 client_resp = 0*kvpair kvsep 291 The following key/value pairs are defined in the client response: 293 auth (REQUIRED): The payload of the HTTP Authorization header for 294 an equivalent HTTP OAuth authorization. 296 host: Contains the host name to which the client connected. 298 port: Contains the port number represented as a decimal positive 299 integer string without leading zeros to which the client 300 connected. 302 qs: The HTTP query string. In non-channel binding mechanisms 303 this is reserved, the client SHOUD NOT send it, and has the 304 default value of "". In "-PLUS" variants this carries a 305 single key value pair "cbdata" for the channel binding data 306 payload formatted as an HTTP query string. 308 For OAuth token types that use keyed message digests the client MUST 309 send host and port number key/values, and the server MUST fail an 310 authorization request requiring keyed message digests that do not 311 have host and port values. In OAuth 1.0a for example, the so-called 312 "signature base string calculation" includes the reconstructed HTTP 313 URL. 315 3.1.1. Reserved Key/Values 317 In these mechanisms values for path, query string and post body are 318 assigned default values. OAuth authorization schemes MAY define 319 usage of these in the SASL context and extend this specification. 320 For OAuth Access Token Types that use request keyed message digest 321 the default values MUST be used unless explicit values are provided 322 in the client response. The following key values are reserved for 323 future use: 325 mthd (RESERVED): HTTP method, the default value is "POST". 327 path (RESERVED): HTTP path data, the default value is "/". 329 post (RESERVED): HTTP post data, the default value is "". 331 3.2. Server's Response 333 The server validates the response per the specification for the OAuth 334 Access Token Types used. If the OAuth Access Token Type utilizes a 335 keyed message digest of the request parameters then the client must 336 provide a client response that satisfies the data requirements for 337 the scheme in use. 339 In a "-PLUS" mechanism the server examines the channel binding data, 340 extracts the channel binding unique prefix, and extracts the raw 341 channel biding data based on the channel binding type used. It then 342 computes it's own copy of the channel binding payload and compares 343 that to the payload sent by the client in the cbdata key/value. 344 Those two must be equal for channel binding to succeed. 346 The server responds to a successfully verified client message by 347 completing the SASL negotiation. The authenticated identity reported 348 by the SASL mechanism is the identity securely established for the 349 client with the OAuth credential. The application, not the SASL 350 mechanism, based on local access policy determines whether the 351 identity reported by the mechanism is allowed access to the requested 352 resource. Note that the semantics of the authz-id is specified by 353 the SASL framework [RFC4422]. 355 3.2.1. OAuth Identifiers in the SASL Context 357 In the OAuth framework the client may be authenticated by the 358 authorization server and the resource owner is authenticated to the 359 authorization server. OAuth access tokens may contain information 360 about the authentication of the resource owner and about the client 361 and may therefore make this information accessible to the resource 362 server. 364 If both identifiers are needed by an application the developer will 365 need to provide a way to communicate that from the SASL mechanism 366 back to the application. 368 3.2.2. Server Response to Failed Authentication 370 For a failed authentication the server returns a JSON [RFC4627] 371 formatted error result, and fails the authentication. The error 372 result consists of the following values: 374 status (REQUIRED): The authorization error code. Valid error 375 codes are defined in the IANA [[need registry name]] 376 registry specified in the OAuth 2 core specification. 378 scope (OPTIONAL): An OAuth scope which is valid to access the 379 service. This may be empty which implies that unscoped 380 tokens are required, or a space separated list. Use of a 381 space separated list is NOT RECOMMENDED. 383 If the resource server provides a scope then the client MUST always 384 request scoped tokens from the token endpoint. If the resource 385 server provides no scope to the client then the client SHOULD presume 386 an empty scope (unscoped token) is needed. 388 If channel binding is in use and the channel binding fails the server 389 responds with a status code set to 412 to indicate that the channel 390 binding precondition failed. If the authentication scheme in use 391 does not include signing the server SHOULD revoke the presented 392 credential and the client SHOULD discard that credential. 394 3.2.3. Completing an Error Message Sequence 396 Section 3.6 of [RFC4422] explicitly prohibits additional information 397 in an unsuccessful authentication outcome. Therefore, the error 398 message is sent in a normal message. The client MUST then send an 399 additional client response consisting of a single %x01 (control A) 400 character to the server in order to allow the server to finish the 401 exchange. 403 3.3. OAuth Access Token Types using Keyed Message Digests 405 OAuth Access Token Types may use keyed message digests and the client 406 and the resource server may need to perform a cryptographic 407 computation for integrity protection and data origin authentication. 409 OAuth is designed for access to resources identified by URIs. SASL 410 is designed for user authentication, and has no facility for more 411 fine-grained access control. In this specification we require or 412 define default values for the data elements from an HTTP request 413 which allow the signature base string to be constructed properly. 415 The default HTTP path is "/" and the default post body is empty. 416 These atoms are defined as extension points so that no changes are 417 needed if there is a revision of SASL which supports more specific 418 resource authorization, e.g., IMAP access to a specific folder or FTP 419 access limited to a specific directory. 421 Using the example in the OAuth 1.0a specification as a starting 422 point, on an IMAP server running on port 143 and given the OAuth 1.0a 423 style authorization request (with %x01 shown as ^A and line breaks 424 added for readability) below: 426 n,a=user@example.com^A 427 host=example.com^A 428 user=user@example.com^A 429 port=143^A 430 auth=OAuth realm="Example", 431 oauth_consumer_key="9djdj82h48djs9d2", 432 oauth_token="kkk9d7dh3k39sjv7", 433 oauth_signature_method="HMAC-SHA1", 434 oauth_timestamp="137131201", 435 oauth_nonce="7d8f3e4a", 436 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU%3D"^A^A 438 The signature base string would be constructed per the OAuth 1.0 439 specification [RFC5849] with the following things noted: 441 o The method value is defaulted to POST. 443 o The scheme defaults to be "http", and any port number other than 444 80 is included. 446 o The path defaults to "/". 448 o The query string defaults to "". 450 In this example the signature base string with line breaks added for 451 readability would be: 453 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 454 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 455 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 457 3.4. Channel Binding 459 The channel binding data is carried in the "qs" (query string) key 460 value pair formatted as a standard HTTP query parameter with the name 461 "cbdata". Channel binding requires that the channel binding data be 462 integrity protected end-to-end in order to protect against man-in- 463 the-middle attacks. All SASL OAuth mechanisms with a "-PLUS" postfix 464 MUST provide integrity protection. It should be noted that while the 465 OAuth 2.0 Bearer Token mandates TLS it does not create keying 466 material at the application layer and is not suitable for use with 467 channel bindings. 469 The channel binding data is computed by the client based on it's 470 choice of preferred channel binding type. As specified in [RFC5056], 471 the channel binding information MUST start with the channel binding 472 unique prefix, followed by a colon (ASCII 0x3A), followed by a base64 473 encoded channel binding payload. The channel binding payload is the 474 raw data from the channel binding type. For example, if the client 475 is using tls-unique for channel binding then the raw channel binding 476 data is the TLS finished message as specified in Section 3.1 of 477 [RFC5929]. 479 4. Examples 481 These examples illustrate exchanges between an IMAP and SMTP clients 482 and servers. 484 Note to implementers: The SASL OAuth method names are case 485 insensitive. One example uses "Bearer" but that could as easily be 486 "bearer", "BEARER", or "BeArEr". 488 4.1. Successful Bearer Token Exchange 490 This example shows a successful OAuth 2.0 bearer token exchange. 491 Note that line breaks are inserted for readability and the underlying 492 TLS establishment is not shown either. 494 S: * OK IMAP4rev1 Server Ready 495 C: t0 CAPABILITY 496 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 497 S: t0 OK Completed 498 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 499 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 500 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 501 S: t1 OK SASL authentication succeeded 503 As required by IMAP [RFC3501], the payloads are base64-encoded. The 504 decoded initial client response (with %x01 represented as ^A and long 505 lines wrapped for readability) is: 507 n,a=user@example.com^Ahost=server.example.com^Aport=143^A 508 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 510 The same credential used in an SMTP exchange is shown below. Note 511 that line breaks are inserted for readability, and that the SMTP 512 protocol terminates lines with CR and LF characters (ASCII values 513 0x0D and 0x0A), these are not displayed explicitly in the example. 515 [connection begins] 516 S: 220 mx.example.com ESMTP 12sm2095603fks.9 517 C: EHLO sender.example.com 518 S: 250-mx.example.com at your service,[172.31.135.47] 519 S: 250-SIZE 35651584 520 S: 250-8BITMIME 521 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 522 S: 250-ENHANCEDSTATUSCODES 523 S: 250 PIPELINING 524 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 525 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 526 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 527 S: 235 Authentication successful. 528 [connection continues...] 530 4.2. OAuth 1.0a Authorization with Channel Binding 532 This example shows channel binding in the context of an OAuth 1.0a 533 request using a keyed message digest. Note that line breaks are 534 inserted for readability. 536 S: * OK [CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR] 537 IMAP4rev1 Server Ready 538 C: t1 AUTHENTICATE OAUTH10A-PLUS cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcGxlL 539 mNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoPU9BdXRoI 540 HJlYWxtPSJFeGFtcGxlIixvYXV0aF9jb25zdW1lcl9rZXk9IjlkamRqODJoNDhka 541 nM5ZDIiLG9hdXRoX3Rva2VuPSJra2s5ZDdkaDNrMzlzanY3IixvYXV0aF9zaWduY 542 XR1cmVfbWV0aG9kPSJITUFDLVNIQTEiLG9hdXRoX3RpbWVzdGFtcD0iMTM3MTMxM 543 jAxIixvYXV0aF9ub25jZT0iN2Q4ZjNlNGEiLG9hdXRoX3NpZ25hdHVyZT0iU1Nkd 544 ElHRWdiR2wwZEd4bElIUmxZU0J3YjNRdSIBcXM9Y2JkYXRhPXRscy11bmlxdWU6U 545 0c5M0lHSnBaeUJwY3lCaElGUk1VeUJtYVc1aGJDQnRaWE56WVdkbFB3bz0BAQ== 546 S: t1 OK SASL authentication succeeded 548 As required by IMAP [RFC3501], the payloads are base64-encoded. The 549 decoded initial client response (with %x01 represented as ^A and 550 lines wrapped for readability) is: 552 p=tls-unique,a=user@example.com^A 553 host=server.example.com^A 554 port=143^A 555 auth=OAuth realm="Example", 556 oauth_consumer_key="9djdj82h48djs9d2", 557 oauth_token="kkk9d7dh3k39sjv7", 558 oauth_signature_method="HMAC-SHA1", 559 oauth_timestamp="137131201", 560 oauth_nonce="7d8f3e4a", 561 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A 562 qs=cbdata=tls-unique:SG93IGJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=^A^A 564 In this example the signature base string with line breaks added for 565 readability would be: 567 POST&http%3A%2F%2Fserver.example.com:143%2F&cbdata=tls-unique:SG93I 568 GJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=%26oauth_consumer_key%3D9djd 569 j82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHM 570 AC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39s 571 jv7 573 4.3. Failed Exchange 575 This example shows a failed exchange because of the empty 576 Authorization header, which is how a client can query for the needed 577 scope. Note that line breaks are inserted for readability. 579 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 580 Ready 581 S: t0 OK Completed 582 C: t1 AUTHENTICATE OAUTHBEARER cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcG 583 xlLmNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoP 584 QFjYmRhdGE9AQE= 585 S: + ewoic3RhdHVzIjoiNDAxIgoic2NvcGUiOiJleGFtcGxlX3Njb3BlIgp9 586 C: + AQ== 587 S: t1 NO SASL authentication failed 589 The decoded initial client response is: 591 n,a=user@example.com,^Ahost=server.example.com^A 592 port=143^Aauth=^A^A 594 The decoded server error response is: 596 { 597 "status":"401", 598 "scope":"example_scope" 599 } 601 The client responds with the required dummy response. 603 4.4. Failed Channel Binding 605 This example shows a channel binding failure in an empty request. 606 The channel binding information is empty. Note that line breaks are 607 inserted for readability. 609 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 610 Ready 611 S: t0 OK Completed 612 C: t1 AUTHENTICATE OAUTH10A-PLUS cCxhPXVzZXJAZXhhbXBsZS5jb20BaG9z 613 dD1zZXJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD0BY2JkYXRhPQEB 614 S: + ewoic3RhdHVzIjoiNDEyIiwKInNjb3BlIjoiZXhhbXBsZV9zY29wZSIKfQ== 615 C: + AQ== 616 S: t1 NO SASL authentication failed 618 The decoded initial client response is: 620 p=tls-unique,a=user@example.com,^Ahost=server.example.com^A 621 port=143^Aauth=^Acbdata=^A^A 623 The decoded server response is: 625 { 626 "status":"412", 627 "scope":"example_scope" 628 } 630 The client responds with the required dummy response. 632 4.5. SMTP Example of a Failed Negotiation 634 This example shows an authorization failure in an SMTP exchange. 635 Note that line breaks are inserted for readability, and that the SMTP 636 protocol terminates lines with CR and LF characters (ASCII values 637 0x0D and 0x0A), these are not displayed explicitly in the example. 639 [connection begins] 640 S: 220 mx.example.com ESMTP 12sm2095603fks.9 641 C: EHLO sender.example.com 642 S: 250-mx.example.com at your service,[172.31.135.47] 643 S: 250-SIZE 35651584 644 S: 250-8BITMIME 645 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 646 S: 250-ENHANCEDSTATUSCODES 647 S: 250 PIPELINING 648 C: AUTH OAUTHBEARER bixhPT1zb21ldXNlckBleGFtcGxlLmNvbQFhdXRoPUJlYXJlciB2 649 RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 650 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 651 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 652 C: AQ== 653 S: 535-5.7.1 Username and Password not accepted. Learn more at 654 S: 535 5.7.1 http://support.example.com/mail/oauth 655 [connection continues...] 657 The server returned an error message in the 334 SASL message, the 658 client responds with the required dummy response, and the server 659 finalizes the negotiation. 661 5. Security Considerations 663 OAuth 1.0a and OAuth 2 allows for a variety of deployment scenarios, 664 and the security properties of these profiles vary. As shown in 665 Figure 1 this specification is aimed to be integrated into a larger 666 OAuth deployment. Application developers therefore need to 667 understand the needs of their security requirements based on a threat 668 assessment before selecting a specific SASL OAuth mechanism. For 669 OAuth 2.0 a detailed security document [RFC6819] provides guidance to 670 select those OAuth 2.0 components that help to mitigate threats for a 671 given deployment. For OAuth 1.0a Section 4 of RFC 5849 [RFC5849] 672 provides guidance specific to OAuth 1.0. 674 This document specifies three SASL Mechanisms for OAuth and each 675 comes with different security properties. 677 OAUTHBEARER: This mechanism borrows from OAuth 2.0 bearer tokens 678 [RFC6750]. It relies on the application using TLS to protect the 679 OAuth 2.0 Bearer Token exchange; without TLS usage at the 680 application layer this method is completely insecure. 681 Consequently, TLS MUST be provided by the application when 682 choosing this authentication mechanism. 684 OAUTH10A: This mechanism re-uses OAuth 1.0a MAC tokens (using the 685 HMAC-SHA1 keyed message digest), as described in Section 3.4.2 of 687 [RFC5849]. To compute the keyed message digest in the same way 688 was in RFC 5839 this specification conveys additional parameters 689 between the client and the server. This SASL mechanism only 690 supports client authentication. If server-side authentication is 691 desireable then it must be provided by the application underneath 692 the SASL layer. The use of TLS is strongly RECOMMENDED. 694 OAUTH10A-PLUS: This mechanism adds the channel binding [RFC5056] 695 capability to OAUTH10A for protection against man-in-the-middle 696 attacks. OAUTH10A-PLUS mandates the usage of Transport Layer 697 Security (TLS) at the application layer. 699 Additionally, the following aspects are worth pointing out: 701 An access token is not equivalent to the user's long term password. 703 Care has to be taken when these OAuth credentials are used for 704 actions like changing passwords (as it is possible with some 705 protocols, e.g., XMPP). The resource server should ensure that 706 actions taken in the authenticated channel are appropriate to the 707 strength of the presented credential. 709 Lifetime of the appliation sessions. 711 It is possible that SASL will be authenticating a connection and 712 the life of that connection may outlast the life of the access 713 token used to establish it. This is a common problem in 714 application protocols where connections are long-lived, and not a 715 problem with this mechanism per se. Resource servers may 716 unilaterally disconnect clients in accordance with the application 717 protocol. 719 Access tokens have a lifetime. 721 Reducing the lifetime of an access token provides security 722 benefits and OAuth 2.0 introduces refresh tokens to obtain new 723 access token on the fly without any need for a human interaction. 724 Additionally, a previously obtained access token may be revoked or 725 rendered invalid at any time by the authorization server. The 726 client may request a new access token for each connection to a 727 resource server, but it should cache and re-use valid credentials. 729 6. Internationalization Considerations 731 The identifer asserted by the OAuth authorization server about the 732 resource owner inside the access token may be displayed to a human. 733 For example, when SASL is used in the context of IMAP the resource 734 server may assert the resource owner's email address to the IMAP 735 server for usage in an email-based application. The identifier may 736 therefore contain internationalized characters and an application 737 needs to ensure that the mapping between the identifier provided by 738 OAuth is suitable for use with the application layer protocol SASL is 739 incorporated into. 741 At the time of writing the standardization of the various claims in 742 the access token (in JSON format) is still ongoing, see 743 [I-D.ietf-oauth-json-web-token]. Once completed it will provide a 744 standardized format for exchanging identity information between the 745 authorization server and the resource server. 747 7. IANA Considerations 749 7.1. SASL Registration 751 The IANA is requested to register the following SASL profile: 753 SASL mechanism profile: OAUTHBEARER 755 Security Considerations: See this document 757 Published Specification: See this document 759 For further information: Contact the authors of this document. 761 Owner/Change controller: the IETF 763 Note: None 765 The IANA is requested to register the following SASL profile: 767 SASL mechanism profile: OAUTH10A 769 Security Considerations: See this document 771 Published Specification: See this document 773 For further information: Contact the authors of this document. 775 Owner/Change controller: the IETF 777 Note: None 779 The IANA is requested to register the following SASL profile: 781 SASL mechanism profile: OAUTH10A-PLUS 782 Security Considerations: See this document 784 Published Specification: See this document 786 For further information: Contact the authors of this document. 788 Owner/Change controller: the IETF 790 Note: None 792 8. References 794 8.1. Normative References 796 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 797 Requirement Levels", BCP 14, RFC 2119, March 1997. 799 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 800 (SHA1)", RFC 3174, September 2001. 802 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 803 Security Layer (SASL)", RFC 4422, June 2006. 805 [RFC4627] Crockford, D., "The application/json Media Type for 806 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 808 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 809 Encodings", RFC 4648, October 2006. 811 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 812 Channels", RFC 5056, November 2007. 814 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 815 Specifications: ABNF", STD 68, RFC 5234, January 2008. 817 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 818 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 820 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 821 April 2010. 823 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 824 for TLS", RFC 5929, July 2010. 826 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", RFC 827 6749, October 2012. 829 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 830 Framework: Bearer Token Usage", RFC 6750, October 2012. 832 8.2. Informative References 834 [I-D.ietf-oauth-json-web-token] 835 Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 836 (JWT)", draft-ietf-oauth-json-web-token-12 (work in 837 progress), October 2013. 839 [I-D.ietf-oauth-v2-http-mac] 840 Richer, J., Mills, W., Tschofenig, H., and P. Hunt, "OAuth 841 2.0 Message Authentication Code (MAC) Tokens", draft-ietf- 842 oauth-v2-http-mac-04 (work in progress), July 2013. 844 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 845 4rev1", RFC 3501, March 2003. 847 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 848 October 2008. 850 [RFC6819] Lodderstedt, T., McGloin, M., and P. Hunt, "OAuth 2.0 851 Threat Model and Security Considerations", RFC 6819, 852 January 2013. 854 [RFC7033] Jones, P., Salgueiro, G., Jones, M., and J. Smarr, 855 "WebFinger", RFC 7033, September 2013. 857 Appendix A. Acknowlegements 859 The authors would like to thank the members of the Kitten working 860 group, and in addition and specifically: Simon Josefson, Torsten 861 Lodderstadt, Ryan Troll, Alexey Melnikov, Jeffrey Hutzelman, and Nico 862 Williams. 864 This document was produced under the chairmanship of Alexey Melnikov, 865 Tom Yu, Shawn Emery, Josh Howlett, Sam Hartman. The supervising area 866 directors was Stephen Farrell. 868 Appendix B. Document History 870 [[ to be removed by RFC editor before publication as an RFC ]] 872 -12 874 o Removed GSS-API components from the specification. 876 -11 877 o Updated security consideration section. 879 -10 881 o Clarifications throughout the document in response to the feedback 882 from Jeffrey Hutzelman. 884 -09 886 o Incorporated review by Alexey and Hannes. 888 o Clarified the three OAuth SASL mechanisms. 890 o Updated references 892 o Extended acknowledgements 894 -08 896 o Fixed the channel binding examples for p=$cbtype 898 o More tuning of the authcid language and edited and renamed 3.2.1. 900 -07 902 o Struck the MUST langiage from authzid. 904 -06 906 o Removed the user field. Fixed the examples again. 908 o Added canonicalization language. 910 -05 912 o Fixed the GS2 header language again. 914 o Separated out different OAuth schemes into different SASL 915 mechanisms. Took out the scheme in the error return. Tuned up 916 the IANA registrations. 918 o Added the user field back into the SASL message. 920 o Fixed the examples (again). 922 -04 923 o Changed user field to be carried in the gs2-header, and made gs2 924 header explicit in all cases. 926 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 927 reference. 929 o Changed to sending an empty client response (single control-A) as 930 the second message of a failed sequence. 932 o Fixed channel binding prose to refer to the normative specs and 933 removed the hashing of large channel binding data, which brought 934 mroe problems than it solved. 936 o Added a SMTP examples for Bearer use case. 938 -03 940 o Added user field into examples and fixed egregious errors there as 941 well. 943 o Added text reminding developers that Authorization scheme names 944 are case insensitive. 946 -02 948 o Added the user data element back in. 950 o Minor editorial changes. 952 -01 954 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 955 webfinger instead of WF and SWD older drafts. 957 o Replacing HTTP as the message format and adjusted all examples. 959 -00 961 o Renamed draft into proper IETF naming format now that it's 962 adopted. 964 o Minor fixes. 966 Authors' Addresses 968 William Mills 969 Yahoo! Inc. 971 Email: wmills@yahoo-inc.com 973 Tim Showalter 975 Email: tjs@psaux.com 977 Hannes Tschofenig 978 Nokia Solutions and Networks 979 Linnoitustie 6 980 Espoo 02600 981 Finland 983 Phone: +358 (50) 4871445 984 Email: Hannes.Tschofenig@gmx.net 985 URI: http://www.tschofenig.priv.at