idnits 2.17.1 draft-ietf-kitten-sasl-oauth-15.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 5 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 (July 22, 2014) is 3565 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 720, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 735, 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: A later version (-32) exists of draft-ietf-oauth-json-web-token-25 -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 5 errors (**), 0 flaws (~~), 5 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 KITTEN W. Mills 3 Internet-Draft Skype 4 Intended status: Standards Track T. Showalter 5 Expires: January 23, 2015 6 H. Tschofenig 7 ARM Ltd. 8 July 22, 2014 10 A set of SASL Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-15.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 January 23, 2015. 50 Copyright Notice 52 Copyright (c) 2014 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 . . . . . . . . . . . . . 6 70 3.1. Initial Client Response . . . . . . . . . . . . . . . . . 7 71 3.1.1. Reserved Key/Values . . . . . . . . . . . . . . . . . 8 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 4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 11 78 4.1. Successful Bearer Token Exchange . . . . . . . . . . . . 11 79 4.2. Successful OAuth 1.0a Token Exchange . . . . . . . . . . 12 80 4.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 13 81 4.4. SMTP Example of a Failed Negotiation . . . . . . . . . . 13 82 5. Security Considerations . . . . . . . . . . . . . . . . . . . 14 83 6. Internationalization Considerations . . . . . . . . . . . . . 15 84 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 85 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 16 86 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 87 8.1. Normative References . . . . . . . . . . . . . . . . . . 16 88 8.2. Informative References . . . . . . . . . . . . . . . . . 17 89 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . 18 90 Appendix B. Document History . . . . . . . . . . . . . . . . . . 18 91 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21 93 1. Introduction 95 OAuth 1.0a [RFC5849] and OAuth 2.0 [RFC6749] are protocol frameworks 96 that enable a third-party application to obtain limited access to a 97 protected resource, either on behalf of a resource owner by 98 orchestrating an approval interaction, or by allowing the third-party 99 application to obtain access on its own behalf. 101 The core OAuth 2.0 specification [RFC6749] specifies the interaction 102 between the OAuth client and the authorization server; it does not 103 define the interaction between the OAuth client and the resource 104 server for the access to a protected resource using an Access Token. 105 Instead, the OAuth client to resource server interaction is described 106 in separate specifications, such as the bearer token specification 107 [RFC6750] and the MAC Token specification 108 [I-D.ietf-oauth-v2-http-mac]. OAuth 1.0a included the protocol 109 specification for the communication between the OAuth client and the 110 resource server in [RFC5849]. 112 The main use cases for OAuth 2.0 and OAuth 1.0a have so far focused 113 on an HTTP-based [RFC2616] environment only. This document 114 integrates OAuth 1.0a and OAuth 2.0 into non-HTTP-based applications 115 using the integration into SASL. Hence, this document takes 116 advantage of the OAuth protocol and its deployment base to provide a 117 way to use the Simple Authentication and Security Layer (SASL) 118 [RFC4422] to gain access to resources when using non-HTTP-based 119 protocols, such as the Internet Message Access Protocol (IMAP) 120 [RFC3501] and the Simple Mail Transfer Protocol (SMTP) [RFC5321], 121 which is what this memo uses in the examples. 123 To illustrate the impact of integrating this specification into an 124 OAuth-enabled application environment Figure 1 shows the abstract 125 message flow of OAuth 2.0 [RFC6749]. As indicated in the figure, 126 this document impacts the exchange of messages (E) and (F) since SASL 127 is used for interaction between the client and the resource server 128 instead of HTTP. 130 ----+ 131 +--------+ +---------------+ | 132 | |--(A)-- Authorization Request --->| Resource | | 133 | | | Owner | |Plain 134 | |<-(B)------ Access Grant ---------| | |OAuth 135 | | +---------------+ |2.0 136 | | | 137 | | Client Credentials & +---------------+ | 138 | |--(C)------ Access Grant -------->| Authorization | | 139 | Client | | Server | | 140 | |<-(D)------ Access Token ---------| | | 141 | | (w/ Optional Refresh Token) +---------------+ | 142 | | ----+ 143 | | ----+ 144 | | +---------------+ | 145 | | | | |OAuth 146 | |--(E)------ Access Token -------->| Resource | |over 147 | | | Server | |SASL 148 | |<-(F)---- Protected Resource -----| | | 149 | | | | | 150 +--------+ +---------------+ | 151 ----+ 153 Figure 1: OAuth 2.0 Protocol Flow 155 The Simple Authentication and Security Layer (SASL) is a framework 156 for providing authentication and data security services in 157 connection-oriented protocols via replaceable authentication 158 mechanisms. It provides a structured interface between protocols and 159 mechanisms. The resulting framework allows new protocols to reuse 160 existing authentication protocols and allows old protocols to make 161 use of new authentication mechanisms. The framework also provides a 162 protocol for securing subsequent protocol exchanges within a data 163 security layer. 165 When OAuth is integrated into SASL the high-level steps are as 166 follows: 168 (A) The client requests authorization from the resource owner. 169 The authorization request can be made directly to the resource 170 owner (as shown), or preferably indirectly via the authorization 171 server as an intermediary. 173 (B) The client receives an authorization grant which is a 174 credential representing the resource owner's authorization, 175 expressed using one of the grant types defined in [RFC6749] or 176 [RFC5849] or using an extension grant type. The authorization 177 grant type depends on the method used by the client to request 178 authorization and the types supported by the authorization server. 180 (C) The client requests an access token by authenticating with the 181 authorization server and presenting the authorization grant. 183 (D) The authorization server authenticates the client and 184 validates the authorization grant, and if valid issues an access 185 token. 187 (E) The client requests the protected resource from the resource 188 server and authenticates by presenting the access token. 190 (F) The resource server validates the access token, and if valid, 191 indicates a successful authentication. 193 Again, steps (E) and (F) are not defined in [RFC6749] (but are 194 described in, for example, [RFC6750] for the OAuth Bearer Token 195 instead) and are the main functionality specified within this 196 document. Consequently, the message exchange shown in Figure 1 is 197 the result of this specification. The client will generally need to 198 determine the authentication endpoints (and perhaps the service 199 endpoints) before the OAuth 2.0 protocol exchange messages in steps 200 (A)-(D) are executed. The discovery of the resource owner and 201 authorization server endpoints is outside the scope of this 202 specification. The client must discover those endpoints using a 203 discovery mechanisms, such as Webfinger using host-meta [RFC7033]. 204 In 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 OAuth 1.0 follows a similar model but uses a different terminology 209 and does not separate the resource server from the authorization 210 server. 212 2. Terminology 214 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 215 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 216 document are to be interpreted as described in [RFC2119]. 218 The reader is assumed to be familiar with the terms used in the OAuth 219 2.0 specification [RFC6749] and SASL [RFC4422]. 221 In examples, "C:" and "S:" indicate lines sent by the client and 222 server respectively. Line breaks have been inserted for readability. 224 Note that the IMAP SASL specification requires base64 encoding, see 225 Section 4 of [RFC4648], not this memo. 227 3. OAuth SASL Mechanism Specifications 229 SASL is used as an authentication framework in a variety of 230 application layer protocols. This document defines the following 231 SASL mechanisms for usage with OAuth: 233 OAUTHBEARER: OAuth 2.0 bearer tokens, as described in [RFC6750]. 234 RFC 6750 uses Transport Layer Security (TLS) to secure the 235 protocol interaction between the client and the resource 236 server. 238 OAUTH10A: OAuth 1.0a MAC tokens (using the HMAC-SHA1 keyed 239 message digest), as described in Section 3.4.2 of [RFC5849]. 241 New extensions may be defined to add additional OAuth Access Token 242 Types. Such a new SASL OAuth mechanism can be added by simply 243 registering the new name(s) and citing this specification for the 244 further definition. 246 These mechanisms are client initiated and lock-step, the server 247 always replying to a client message. In the case where the client 248 has and correctly uses a valid token the flow is: 250 1. Client sends a valid and correct initial client response. 252 2. Server responds with a successful authentication. 254 In the case where authorization fails the server sends an error 255 result, then client MUST then send an additional message to the 256 server in order to allow the server to finish the exchange. Some 257 protocols and common SASL implementations do not support both sending 258 a SASL message and finalizing a SASL negotiation, the additional 259 client message in the error case deals with this problem. This 260 exchange is: 262 1. Client sends an invalid initial client response. 264 2. Server responds with an error message. 266 3. Client sends a dummy client response. 268 4. Server fails the authentication. 270 3.1. Initial Client Response 272 Client responses are a GS2 [RFC5801] header followed by a key/value 273 pair sequence, or may be empty. The gs2-header is defined here for 274 compatibility with GS2 if a GS2 mechanism is formally defined, but 275 this document does not define one. These key/value pairs carry the 276 equivalent values from an HTTP context in order to be able to 277 complete an OAuth style HTTP authorization. Unknown key/value pairs 278 MUST be ignored by the server. The ABNF [RFC5234] syntax is: 280 kvsep = %x01 281 key = 1*(ALPHA / ",") 282 value = *(VCHAR / SP / HTAB / CR / LF ) 283 kvpair = key "=" value kvsep 284 ;;gs2-header = See RFC 5801 285 client_resp = (gs2-header kvsep 0*kvpair kvsep) / kvsep 287 The GS2 header MAY include the user name associated with the resource 288 being accessed, the "authzid". It is worth noting that application 289 protocols are allowed to require an authzid, as are specific server 290 implementations. 292 The following key/value pairs are defined in the client response: 294 auth (REQUIRED): The payload of the HTTP Authorization header for 295 an equivalent HTTP OAuth authorization. 297 host: Contains the host name to which the client connected. 299 port: Contains the port number represented as a decimal positive 300 integer string without leading zeros to which the client 301 connected. 303 qs: The HTTP query string. This is reserved for future use, the 304 client SHOUD NOT send it, and has the default value of "". 306 For OAuth token types that use keyed message digests the client MUST 307 send host and port number key/values, and the server MUST fail an 308 authorization request requiring keyed message digests that do not 309 have host and port values. In OAuth 1.0a for example, the so-called 310 "signature base string calculation" includes the reconstructed HTTP 311 URL. 313 3.1.1. Reserved Key/Values 315 In these mechanisms values for path, query string and post body are 316 assigned default values. OAuth authorization schemes MAY define 317 usage of these in the SASL context and extend this specification. 318 For OAuth Access Token Types that use request keyed message digest 319 the default values MUST be used unless explicit values are provided 320 in the client response. The following key values are reserved for 321 future use: 323 mthd (RESERVED): HTTP method, the default value is "POST". 325 path (RESERVED): HTTP path data, the default value is "/". 327 post (RESERVED): HTTP post data, the default value is "". 329 3.2. Server's Response 331 The server validates the response per the specification for the OAuth 332 Access Token Types used. If the OAuth Access Token Type utilizes a 333 keyed message digest of the request parameters then the client must 334 provide a client response that satisfies the data requirements for 335 the scheme in use. 337 The server responds to a successfully verified client message by 338 completing the SASL negotiation. The authenticated identity reported 339 by the SASL mechanism is the identity securely established for the 340 client with the OAuth credential. The application, not the SASL 341 mechanism, based on local access policy determines whether the 342 identity reported by the mechanism is allowed access to the requested 343 resource. Note that the semantics of the authz-id is specified by 344 the SASL framework [RFC4422]. 346 3.2.1. OAuth Identifiers in the SASL Context 348 In the OAuth framework the client may be authenticated by the 349 authorization server and the resource owner is authenticated to the 350 authorization server. OAuth access tokens may contain information 351 about the authentication of the resource owner and about the client 352 and may therefore make this information accessible to the resource 353 server. 355 If both identifiers are needed by an application the developer will 356 need to provide a way to communicate that from the SASL mechanism 357 back to the application. 359 3.2.2. Server Response to Failed Authentication 361 For a failed authentication the server returns a JSON [RFC4627] 362 formatted error result, and fails the authentication. The error 363 result consists of the following values: 365 status (REQUIRED): The authorization error code. Valid error 366 codes are defined in the IANA "OAuth Extensions Error Registry" 367 specified in the OAuth 2 core specification. 369 scope (OPTIONAL): An OAuth scope which is valid to access the 370 service. This may be empty which implies that unscoped tokens 371 are required, or a scope value. If a scope is specified then a 372 single scope is preferred, use of a space separated list of 373 scopes is NOT RECOMMENDED. 375 oauth-configuration (OPTIONAL): The URL for for a document 376 following the OpenID Provider Configuration Information schema 377 as described in OpenID Connect Discovery [OpenID.Discovery] 378 section 3 that is appropriate for the user. This document MUST 379 have all OAuth related data elements populated. The server MAY 380 return different URLs for users in different domains and the 381 client SHOULD NOT cache a single returned value and assume it 382 applies for all users/domains that the server suports. 384 If the resource server provides a scope then the client MUST always 385 request scoped tokens from the token endpoint. If the resource 386 server provides no scope to the client then the client SHOULD presume 387 an empty scope (unscoped token) is needed. 389 3.2.3. Completing an Error Message Sequence 391 Section 3.6 of [RFC4422] explicitly prohibits additional information 392 in an unsuccessful authentication outcome. Therefore, the error 393 message is sent in a normal message. The client MUST then send an 394 additional client response consisting of a single %x01 (control A) 395 character to the server in order to allow the server to finish the 396 exchange. 398 3.3. OAuth Access Token Types using Keyed Message Digests 400 OAuth Access Token Types may use keyed message digests and the client 401 and the resource server may need to perform a cryptographic 402 computation for integrity protection and data origin authentication. 404 OAuth is designed for access to resources identified by URIs. SASL 405 is designed for user authentication, and has no facility for more 406 fine-grained access control. In this specification we require or 407 define default values for the data elements from an HTTP request 408 which allow the signature base string to be constructed properly. 409 The default HTTP path is "/" and the default post body is empty. 410 These atoms are defined as extension points so that no changes are 411 needed if there is a revision of SASL which supports more specific 412 resource authorization, e.g., IMAP access to a specific folder or FTP 413 access limited to a specific directory. 415 Using the example in the OAuth 1.0a specification as a starting 416 point, on an IMAP server running on port 143 and given the OAuth 1.0a 417 style authorization request (with %x01 shown as ^A and line breaks 418 added for readability) below: 420 n,a=user@example.com,^A 421 host=example.com^A 422 port=143^A 423 auth=OAuth realm="Example", 424 oauth_consumer_key="9djdj82h48djs9d2", 425 oauth_token="kkk9d7dh3k39sjv7", 426 oauth_signature_method="HMAC-SHA1", 427 oauth_timestamp="137131201", 428 oauth_nonce="7d8f3e4a", 429 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU"^A^A 431 The signature base string would be constructed per the OAuth 1.0 432 specification [RFC5849] with the following things noted: 434 o The method value is defaulted to POST. 436 o The scheme defaults to be "http", and any port number other than 437 80 is included. 439 o The path defaults to "/". 441 o The query string defaults to "". 443 In this example the signature base string with line breaks added for 444 readability would be: 446 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 447 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 448 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 450 4. Examples 452 These examples illustrate exchanges between an IMAP and SMTP clients 453 and servers. 455 Note to implementers: The SASL OAuth method names are case 456 insensitive. One example uses "Bearer" but that could as easily be 457 "bearer", "BEARER", or "BeArEr". 459 4.1. Successful Bearer Token Exchange 461 This example shows a successful OAuth 2.0 bearer token exchange. 462 Note that line breaks are inserted for readability and the underlying 463 TLS establishment is not shown either. 465 S: * OK IMAP4rev1 Server Ready 466 C: t0 CAPABILITY 467 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 468 S: t0 OK Completed 469 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9c2 470 VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyIHZGOWRmdDRxb 471 VRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQEB 472 S: t1 OK SASL authentication succeeded 474 As required by IMAP [RFC3501], the payloads are base64-encoded. The 475 decoded initial client response (with %x01 represented as ^A and long 476 lines wrapped for readability) is: 478 n,a=user@example.com,^Ahost=server.example.com^Aport=143^A 479 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 481 The same credential used in an SMTP exchange is shown below. Note 482 that line breaks are inserted for readability, and that the SMTP 483 protocol terminates lines with CR and LF characters (ASCII values 484 0x0D and 0x0A), these are not displayed explicitly in the example. 486 [connection begins] 487 S: 220 mx.example.com ESMTP 12sm2095603fks.9 488 C: EHLO sender.example.com 489 S: 250-mx.example.com at your service,[172.31.135.47] 490 S: 250-SIZE 35651584 491 S: 250-8BITMIME 492 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 493 S: 250-ENHANCEDSTATUSCODES 494 S: 250 PIPELINING 495 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9c 496 2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyIHZGOWRmdDR 497 xbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQEB 498 S: 235 Authentication successful. 499 [connection continues...] 501 4.2. Successful OAuth 1.0a Token Exchange 503 This example shows a successful OAuth 1.0a token exchange. Note that 504 line breaks are inserted for readability and the underlying TLS 505 establishment is not shown. Signature computation is discussed in 506 Section 3.3. 508 S: * OK IMAP4rev1 Server Ready 509 C: t0 CAPABILITY 510 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER OAUTH10A SASL-IR 511 S: t0 OK Completed 512 C: t1 AUTHENTICATE OAUTH10A bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9ZXhhb 513 XBsZS5jb20BcG9ydD0xNDMBYXV0aD1PQXV0aCByZWFsbT0iRXhhbXBsZSIsb2F1 514 dGhfY29uc3VtZXJfa2V5PSI5ZGpkajgyaDQ4ZGpzOWQyIixvYXV0aF90b2tlbj0 515 ia2trOWQ3ZGgzazM5c2p2NyIsb2F1dGhfc2lnbmF0dXJlX21ldGhvZD0iSE1BQy 516 1TSEExIixvYXV0aF90aW1lc3RhbXA9IjEzNzEzMTIwMSIsb2F1dGhfbm9uY2U9I 517 jdkOGYzZTRhIixvYXV0aF9zaWduYXR1cmU9IlRtOTBJR0VnY21WaGJDQnphV2R1 518 WVhSMWNtVSUzRCIBAQ== 519 S: t1 OK SASL authentication succeeded 521 As required by IMAP [RFC3501], the payloads are base64-encoded. The 522 decoded initial client response (with %x01 represented as ^A and 523 lines wrapped for readability) is: 525 n,a=user@example.com,^A 526 host=example.com^A 527 port=143^A 528 auth=OAuth realm="Example", 529 oauth_consumer_key="9djdj82h48djs9d2", 530 oauth_token="kkk9d7dh3k39sjv7", 531 oauth_signature_method="HMAC-SHA1", 532 oauth_timestamp="137131201", 533 oauth_nonce="7d8f3e4a", 534 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A^A 536 4.3. Failed Exchange 538 This example shows a failed exchange because of the empty 539 Authorization header, which is how a client can query for the needed 540 scope. Note that line breaks are inserted for readability. 542 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 543 Ready 544 S: t0 OK Completed 545 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAW 546 hvc3Q9c2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9AQE= 547 S: + eyJzdGF0dXMiOiI0MDEiLCJzY29wZSI6ImV4YW1wbGVfc2NvcGUiLCJv 548 cGVuaWQtY29uZmlndXJhdGlvbiI6Imh0dHBzOi8vZXhhbXBsZS5jb20v 549 LndlbGwta25vd24vb3BlbmlkLWNvbmZpZ3VyYXRpb24ifQ== 550 C: + AQ== 551 S: t1 NO SASL authentication failed 553 The decoded initial client response is: 555 n,a=user@example.com,^Ahost=server.example.com^A 556 port=143^Aauth=^A^A 558 The decoded server error response is: 560 { 561 "status":"401", 562 "scope":"example_scope", 563 "openid-configuration":"https://example.com/.well-known/openid-configuration" 564 } 566 The client responds with the required dummy response. 568 4.4. SMTP Example of a Failed Negotiation 570 This example shows an authorization failure in an SMTP exchange. 571 Note that line breaks are inserted for readability, and that the SMTP 572 protocol terminates lines with CR and LF characters (ASCII values 573 0x0D and 0x0A), these are not displayed explicitly in the example. 575 [connection begins] 576 S: 220 mx.example.com ESMTP 12sm2095603fks.9 577 C: EHLO sender.example.com 578 S: 250-mx.example.com at your service,[172.31.135.47] 579 S: 250-SIZE 35651584 580 S: 250-8BITMIME 581 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 582 S: 250-ENHANCEDSTATUSCODES 583 S: 250 PIPELINING 584 C: AUTH OAUTHBEARER bix1c2VyPXNvbWV1c2VyQGV4YW1wbGUuY29tLAFhdXRoPUJlYXJl 585 ciB2RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 586 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 587 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 588 C: AQ== 589 S: 535-5.7.1 Username and Password not accepted. Learn more at 590 S: 535 5.7.1 http://support.example.com/mail/oauth 591 [connection continues...] 593 The server returned an error message in the 334 SASL message, the 594 client responds with the required dummy response, and the server 595 finalizes the negotiation. 597 5. Security Considerations 599 OAuth 1.0a and OAuth 2 allows for a variety of deployment scenarios, 600 and the security properties of these profiles vary. As shown in 601 Figure 1 this specification is aimed to be integrated into a larger 602 OAuth deployment. Application developers therefore need to 603 understand the needs of their security requirements based on a threat 604 assessment before selecting a specific SASL OAuth mechanism. For 605 OAuth 2.0 a detailed security document [RFC6819] provides guidance to 606 select those OAuth 2.0 components that help to mitigate threats for a 607 given deployment. For OAuth 1.0a Section 4 of RFC 5849 [RFC5849] 608 provides guidance specific to OAuth 1.0. 610 This document specifies two SASL Mechanisms for OAuth and each comes 611 with different security properties. 613 OAUTHBEARER: This mechanism borrows from OAuth 2.0 bearer tokens 614 [RFC6750]. It relies on the application using TLS to protect the 615 OAuth 2.0 Bearer Token exchange; without TLS usage at the 616 application layer this method is completely insecure. 617 Consequently, TLS MUST be provided by the application when 618 choosing this authentication mechanism. 620 OAUTH10A: This mechanism re-uses OAuth 1.0a MAC tokens (using the 621 HMAC-SHA1 keyed message digest), as described in Section 3.4.2 of 622 [RFC5849]. To compute the keyed message digest in the same way 623 was in RFC 5839 this specification conveys additional parameters 624 between the client and the server. This SASL mechanism only 625 supports client authentication. If server-side authentication is 626 desireable then it must be provided by the application underneath 627 the SASL layer. The use of TLS is strongly RECOMMENDED. 629 Additionally, the following aspects are worth pointing out: 631 An access token is not equivalent to the user's long term password. 633 Care has to be taken when these OAuth credentials are used for 634 actions like changing passwords (as it is possible with some 635 protocols, e.g., XMPP [RFC6120]). The resource server should 636 ensure that actions taken in the authenticated channel are 637 appropriate to the strength of the presented credential. 639 Lifetime of the appliation sessions. 641 It is possible that SASL will be authenticating a connection and 642 the life of that connection may outlast the life of the access 643 token used to establish it. This is a common problem in 644 application protocols where connections are long-lived, and not a 645 problem with this mechanism per se. Resource servers may 646 unilaterally disconnect clients in accordance with the application 647 protocol. 649 Access tokens have a lifetime. 651 Reducing the lifetime of an access token provides security 652 benefits and OAuth 2.0 introduces refresh tokens to obtain new 653 access token on the fly without any need for a human interaction. 654 Additionally, a previously obtained access token may be revoked or 655 rendered invalid at any time. The client may request a new access 656 token for each connection to a resource server, but it SHOULD 657 cache and re-use valid credentials. 659 6. Internationalization Considerations 661 The identifer asserted by the OAuth authorization server about the 662 resource owner inside the access token may be displayed to a human. 663 For example, when SASL is used in the context of IMAP the resource 664 server may assert the resource owner's email address to the IMAP 665 server for usage in an email-based application. The identifier may 666 therefore contain internationalized characters and an application 667 needs to ensure that the mapping between the identifier provided by 668 OAuth is suitable for use with the application layer protocol SASL is 669 incorporated into. 671 At the time of writing the standardization of the various claims in 672 the access token (in JSON format) is still ongoing, see 673 [I-D.ietf-oauth-json-web-token]. Once completed it will provide a 674 standardized format for exchanging identity information between the 675 authorization server and the resource server. 677 7. IANA Considerations 679 7.1. SASL Registration 681 The IANA is requested to register the following SASL profile: 683 SASL mechanism profile: OAUTHBEARER 685 Security Considerations: See this document 687 Published Specification: See this document 689 For further information: Contact the authors of this document. 691 Owner/Change controller: the IETF 693 Note: None 695 The IANA is requested to register the following SASL profile: 697 SASL mechanism profile: OAUTH10A 699 Security Considerations: See this document 701 Published Specification: See this document 703 For further information: Contact the authors of this document. 705 Owner/Change controller: the IETF 707 Note: None 709 8. References 711 8.1. Normative References 713 [OpenID.Discovery] 714 Sakimura, N., Bradley, J., Jones, M., and E. Jay, "OpenID 715 Connect Discovery 1.0", July 2011. 717 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 718 Requirement Levels", BCP 14, RFC 2119, March 1997. 720 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 721 (SHA1)", RFC 3174, September 2001. 723 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 724 Security Layer (SASL)", RFC 4422, June 2006. 726 [RFC4627] Crockford, D., "The application/json Media Type for 727 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 729 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 730 Encodings", RFC 4648, October 2006. 732 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 733 Specifications: ABNF", STD 68, RFC 5234, January 2008. 735 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 736 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 738 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 739 Service Application Program Interface (GSS-API) Mechanisms 740 in Simple Authentication and Security Layer (SASL): The 741 GS2 Mechanism Family", RFC 5801, July 2010. 743 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 744 April 2010. 746 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", RFC 747 6749, October 2012. 749 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 750 Framework: Bearer Token Usage", RFC 6750, October 2012. 752 8.2. Informative References 754 [I-D.ietf-oauth-json-web-token] 755 Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 756 (JWT)", draft-ietf-oauth-json-web-token-25 (work in 757 progress), July 2014. 759 [I-D.ietf-oauth-v2-http-mac] 760 Richer, J., Mills, W., Tschofenig, H., and P. Hunt, "OAuth 761 2.0 Message Authentication Code (MAC) Tokens", draft-ietf- 762 oauth-v2-http-mac-05 (work in progress), January 2014. 764 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 765 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 766 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 768 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 769 4rev1", RFC 3501, March 2003. 771 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 772 October 2008. 774 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 775 Protocol (XMPP): Core", RFC 6120, March 2011. 777 [RFC6819] Lodderstedt, T., McGloin, M., and P. Hunt, "OAuth 2.0 778 Threat Model and Security Considerations", RFC 6819, 779 January 2013. 781 [RFC7033] Jones, P., Salgueiro, G., Jones, M., and J. Smarr, 782 "WebFinger", RFC 7033, September 2013. 784 Appendix A. Acknowlegements 786 The authors would like to thank the members of the Kitten working 787 group, and in addition and specifically: Simon Josefson, Torsten 788 Lodderstadt, Ryan Troll, Alexey Melnikov, Jeffrey Hutzelman, Nico 789 Williams, and Matt Miller. 791 This document was produced under the chairmanship of Alexey Melnikov, 792 Tom Yu, Shawn Emery, Josh Howlett, Sam Hartman. The supervising area 793 director was Stephen Farrell. 795 Appendix B. Document History 797 [[ to be removed by RFC editor before publication as an RFC ]] 799 -15 801 o Last call feedack on the GS2 stuff being ripped out completely. 803 o Removed the "user" parameter and put stuff back into the 804 gs2-header. Call out that the authzid goes in the gs2-header with 805 some prose about when it might be required. Very comparable to 806 -10. 808 o Added an OAuth 1.0A example explicitly. 810 -14 811 o Last call feedack on RFC citations needed, small editorial. 813 o Added the "user" parameter back, which was pulled when we started 814 down the GS2 path. Same language as -03. 816 o Defined a stub GS2 header to make sure that when the GS2 bride is 817 defined for this that nothing will break when it actually starts 818 to get populated. 820 -13 822 o Changed affiliation. 824 -12 826 o Removed -PLUS components from the specification. 828 -11 830 o Removed GSS-API components from the specification. 832 o Updated security consideration section. 834 -10 836 o Clarifications throughout the document in response to the feedback 837 from Jeffrey Hutzelman. 839 -09 841 o Incorporated review by Alexey and Hannes. 843 o Clarified the three OAuth SASL mechanisms. 845 o Updated references 847 o Extended acknowledgements 849 -08 851 o Fixed the channel binding examples for p=$cbtype 853 o More tuning of the authcid language and edited and renamed 3.2.1. 855 -07 857 o Struck the MUST langiage from authzid. 859 o 861 -06 863 o Removed the user field. Fixed the examples again. 865 o Added canonicalization language. 867 o 869 -05 871 o Fixed the GS2 header language again. 873 o Separated out different OAuth schemes into different SASL 874 mechanisms. Took out the scheme in the error return. Tuned up 875 the IANA registrations. 877 o Added the user field back into the SASL message. 879 o Fixed the examples (again). 881 o 883 -04 885 o Changed user field to be carried in the gs2-header, and made gs2 886 header explicit in all cases. 888 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 889 reference. 891 o Changed to sending an empty client response (single control-A) as 892 the second message of a failed sequence. 894 o Fixed channel binding prose to refer to the normative specs and 895 removed the hashing of large channel binding data, which brought 896 mroe problems than it solved. 898 o Added a SMTP examples for Bearer use case. 900 -03 902 o Added user field into examples and fixed egregious errors there as 903 well. 905 o Added text reminding developers that Authorization scheme names 906 are case insensitive. 908 -02 910 o Added the user data element back in. 912 o Minor editorial changes. 914 -01 916 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 917 webfinger instead of WF and SWD older drafts. 919 o Replacing HTTP as the message format and adjusted all examples. 921 -00 923 o Renamed draft into proper IETF naming format now that it's 924 adopted. 926 o Minor fixes. 928 Authors' Addresses 930 William Mills 931 Skype 933 Email: wmills_92105@yahoo.com 935 Tim Showalter 937 Email: tjs@psaux.com 939 Hannes Tschofenig 940 ARM Ltd. 941 110 Fulbourn Rd 942 Cambridge CB1 9NJ 943 Great Britain 945 Email: Hannes.tschofenig@gmx.net 946 URI: http://www.tschofenig.priv.at