idnits 2.17.1 draft-ietf-kitten-sasl-oauth-18.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 (November 25, 2014) is 3433 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 753, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 765, but no explicit reference was found in the text ** Downref: Normative reference to an Informational RFC: RFC 3174 ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 5849 (Obsoleted by RFC 6749) ** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259) == Outdated reference: A later version (-30) exists of draft-ietf-oauth-dyn-reg-20 == Outdated reference: A later version (-32) exists of draft-ietf-oauth-json-web-token-31 -- 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 (~~), 6 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 KITTEN W. Mills 3 Internet-Draft Microsoft 4 Intended status: Standards Track T. Showalter 5 Expires: May 29, 2015 6 H. Tschofenig 7 ARM Ltd. 8 November 25, 2014 10 A set of SASL Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-18.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 May 29, 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 . . . . . . . . 10 76 3.3. OAuth Access Token Types using Keyed Message Digests . . 10 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 . . . . . . . . . . 14 82 5. Security Considerations . . . . . . . . . . . . . . . . . . . 15 83 6. Internationalization Considerations . . . . . . . . . . . . . 16 84 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 85 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 16 86 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 17 87 8.1. Normative References . . . . . . . . . . . . . . . . . . 17 88 8.2. Informative References . . . . . . . . . . . . . . . . . 18 89 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . 19 90 Appendix B. Document History . . . . . . . . . . . . . . . . . . 19 91 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 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]. OAuth 1.0a included the protocol specification for the 108 communication between the OAuth client and the resource server in 109 [RFC5849]. 111 The main use cases for OAuth 2.0 and OAuth 1.0a have so far focused 112 on an HTTP-based [RFC2616] environment only. This document 113 integrates OAuth 1.0a and OAuth 2.0 into non-HTTP-based applications 114 using the integration into SASL. Hence, this document takes 115 advantage of the OAuth protocol and its deployment base to provide a 116 way to use the Simple Authentication and Security Layer (SASL) 117 [RFC4422] to gain access to resources when using non-HTTP-based 118 protocols, such as the Internet Message Access Protocol (IMAP) 119 [RFC3501] and the Simple Mail Transfer Protocol (SMTP) [RFC5321], 120 which is what this memo uses in the examples. 122 To illustrate the impact of integrating this specification into an 123 OAuth-enabled application environment, Figure 1 shows the abstract 124 message flow of OAuth 2.0 [RFC6749]. As indicated in the figure, 125 this document impacts the exchange of messages (E) and (F) since SASL 126 is used for interaction between the client and the resource server 127 instead of HTTP. 129 ----+ 130 +--------+ +---------------+ | 131 | |--(A)-- Authorization Request --->| Resource | | 132 | | | Owner | |Plain 133 | |<-(B)------ Access Grant ---------| | |OAuth 134 | | +---------------+ |2.0 135 | | | 136 | | Client Credentials & +---------------+ | 137 | |--(C)------ Access Grant -------->| Authorization | | 138 | Client | | Server | | 139 | |<-(D)------ Access Token ---------| | | 140 | | (w/ Optional Refresh Token) +---------------+ | 141 | | ----+ 142 | | ----+ 143 | | +---------------+ | 144 | | | | |OAuth 145 | |--(E)------ Access Token -------->| Resource | |over 146 | | | Server | |SASL 147 | |<-(F)---- Protected Resource -----| | | 148 | | | | | 149 +--------+ +---------------+ | 150 ----+ 152 Figure 1: OAuth 2.0 Protocol Flow 154 The Simple Authentication and Security Layer (SASL) is a framework 155 for providing authentication and data security services in 156 connection-oriented protocols via replaceable authentication 157 mechanisms. It provides a structured interface between protocols and 158 mechanisms. The resulting framework allows new protocols to reuse 159 existing authentication protocols and allows old protocols to make 160 use of new authentication mechanisms. The framework also provides a 161 protocol for securing subsequent exchanges within a data security 162 layer. 164 When OAuth is integrated into SASL the high-level steps are as 165 follows: 167 (A) The client requests authorization from the resource owner. 168 The authorization request can be made directly to the resource 169 owner (as shown), or preferably indirectly via the authorization 170 server as an intermediary. 172 (B) The client receives an authorization grant which is a 173 credential representing the resource owner's authorization, 174 expressed using one of the grant types defined in [RFC6749] or 175 [RFC5849] or using an extension grant type. The authorization 176 grant type depends on the method used by the client to request 177 authorization and the types supported by the authorization server. 179 (C) The client requests an access token by authenticating with the 180 authorization server and presenting the authorization grant. 182 (D) The authorization server authenticates the client and 183 validates the authorization grant, and if valid issues an access 184 token. 186 (E) The client requests the protected resource from the resource 187 server and authenticates by presenting the access token. 189 (F) The resource server validates the access token, and if valid, 190 indicates a successful authentication. 192 Again, steps (E) and (F) are not defined in [RFC6749] (but are 193 described in, for example, [RFC6750] for the OAuth Bearer Token 194 instead) and are the main functionality specified within this 195 document. Consequently, the message exchange shown in Figure 1 is 196 the result of this specification. The client will generally need to 197 determine the authentication endpoints (and perhaps the service 198 endpoints) before the OAuth 2.0 protocol exchange messages in steps 199 (A)-(D) are executed. The discovery of the resource owner, 200 authorization server endpoints, and client registration are outside 201 the scope of this specification. The client must discover the 202 authorization endpoints using a discovery mechanism such as OpenID 203 Connect Discovery [OpenID.Discovery] or Webfinger using host-meta 204 [RFC7033]. Once credentials are obtained the client proceeds to 205 steps (E) and (F) defined in this specification. Authorization 206 endpoints MAY require client registration and generic clients SHOULD 207 support the Dynamic Client Registration protocol 208 [I-D.ietf-oauth-dyn-reg]. 210 OAuth 1.0 follows a similar model but uses a different terminology 211 and does not separate the resource server from the authorization 212 server. 214 2. Terminology 216 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 217 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 218 document are to be interpreted as described in [RFC2119]. 220 The reader is assumed to be familiar with the terms used in the OAuth 221 2.0 specification [RFC6749] and SASL [RFC4422]. 223 In examples, "C:" and "S:" indicate lines sent by the client and 224 server respectively. Line breaks have been inserted for readability. 226 Note that the IMAP SASL specification requires base64 encoding, see 227 Section 4 of [RFC4648], not this memo. 229 3. OAuth SASL Mechanism Specifications 231 SASL is used as an authentication framework in a variety of 232 application layer protocols. This document defines the following 233 SASL mechanisms for usage with OAuth: 235 OAUTHBEARER: OAuth 2.0 bearer tokens, as described in [RFC6750]. 236 RFC 6750 uses Transport Layer Security (TLS) to secure the 237 protocol interaction between the client and the resource 238 server. 240 OAUTH10A: OAuth 1.0a MAC tokens (using the HMAC-SHA1 keyed 241 message digest), as described in Section 3.4.2 of [RFC5849]. 243 New extensions may be defined to add additional OAuth Access Token 244 Types. Such a new SASL OAuth mechanism can be added by simply 245 registering the new name(s) and citing this specification for the 246 further definition. 248 These mechanisms are client initiated and lock-step, the server 249 always replying to a client message. In the case where the client 250 has and correctly uses a valid token the flow is: 252 1. Client sends a valid and correct initial client response. 254 2. Server responds with a successful authentication. 256 In the case where authorization fails the server sends an error 257 result, then client MUST then send an additional message to the 258 server in order to allow the server to finish the exchange. Some 259 protocols and common SASL implementations do not support both sending 260 a SASL message and finalizing a SASL negotiation, the additional 261 client message in the error case deals with this problem. This 262 exchange is: 264 1. Client sends an invalid initial client response. 266 2. Server responds with an error message. 268 3. Client sends a dummy client response. 270 4. Server fails the authentication. 272 3.1. Initial Client Response 274 Client responses are a GS2 [RFC5801] header followed by zero or more 275 key/value pairs, or may be empty. The gs2-header is defined here for 276 compatibility with GS2 if a GS2 mechanism is formally defined, but 277 this document does not define one. These key/value pairs take the 278 place of the corresponding HTTP headers and values to convey the 279 information necessary to complete an OAuth style HTTP authorization. 280 Unknown key/value pairs MUST be ignored by the server. The ABNF 281 [RFC5234] syntax is: 283 kvsep = %x01 284 key = 1*(ALPHA / ",") 285 value = *(VCHAR / SP / HTAB / CR / LF ) 286 kvpair = key "=" value kvsep 287 ;;gs2-header = See RFC 5801 288 client_resp = (gs2-header kvsep 0*kvpair kvsep) / kvsep 290 The GS2 header MAY include the user name associated with the resource 291 being accessed, the "authzid". It is worth noting that application 292 protocols are allowed to require an authzid, as are specific server 293 implementations. 295 The following keys and corresponding values are defined in the client 296 response: 298 auth (REQUIRED): The payload that would be in the HTTP 299 Authorization header if this OAuth exchange was being carried 300 out over HTTP. 302 host: Contains the host name to which the client connected. In 303 an HTTP context this is the value of the HTTP Host header. 305 port: Contains the port number represented as a decimal positive 306 integer string without leading zeros to which the client 307 connected. 309 For OAuth token types such as OAuth 1.0a that use keyed message 310 digests the client MUST send host and port number key/values, and the 311 server MUST fail an authorization request requiring keyed message 312 digests that are not accompanied by host and port values. In OAuth 313 1.0a for example, the so-called "signature base string calculation" 314 includes the reconstructed HTTP URL. 316 3.1.1. Reserved Key/Values 318 In these mechanisms values for path, query string and post body are 319 assigned default values. OAuth authorization schemes MAY define 320 usage of these in the SASL context and extend this specification. 321 For OAuth Access Token Types that use request keyed message digest 322 the default values MUST be used unless explicit values are provided 323 in the client response. The following key values are reserved for 324 future use: 326 mthd (RESERVED): HTTP method, the default value is "POST". 328 path (RESERVED): HTTP path data, the default value is "/". 330 post (RESERVED): HTTP post data, the default value is "". 332 qs (RESERVED): The HTTP query string, the default value is "". 334 3.2. Server's Response 336 The server validates the response according the specification for the 337 OAuth Access Token Types used. If the OAuth Access Token Type 338 utilizes a keyed message digest of the request parameters then the 339 client must provide a client response that satisfies the data 340 requirements for the scheme in use. 342 The server responds to a successfully verified client message by 343 completing the SASL negotiation. The authenticated identity reported 344 by the SASL mechanism is the identity securely established for the 345 client with the OAuth credential. The application, not the SASL 346 mechanism, based on local access policy determines whether the 347 identity reported by the mechanism is allowed access to the requested 348 resource. Note that the semantics of the authz-id is specified by 349 the SASL framework [RFC4422]. 351 3.2.1. OAuth Identifiers in the SASL Context 353 In the OAuth framework the client may be authenticated by the 354 authorization server and the resource owner is authenticated to the 355 authorization server. OAuth access tokens may contain information 356 about the authentication of the resource owner and about the client 357 and may therefore make this information accessible to the resource 358 server. 360 If both identifiers are needed by an application the developer will 361 need to provide a way to communicate that from the SASL mechanism 362 back to the application. 364 3.2.2. Server Response to Failed Authentication 366 For a failed authentication the server returns a JSON [RFC7159] 367 formatted error result, and fails the authentication. The error 368 result consists of the following values: 370 status (REQUIRED): The authorization error code. Valid error 371 codes are defined in the IANA "OAuth Extensions Error Registry" 372 specified in the OAuth 2 core specification. 374 scope (OPTIONAL): An OAuth scope which is valid to access the 375 service. This may be empty which implies that unscoped tokens 376 are required, or a scope value. If a scope is specified then a 377 single scope is preferred, use of a space separated list of 378 scopes is NOT RECOMMENDED. 380 oauth-configuration (OPTIONAL): The URL for for a document 381 following the OpenID Provider Configuration Information schema 382 as described in OpenID Connect Discovery [OpenID.Discovery] 383 section 3 that is appropriate for the user. This document MUST 384 have all OAuth related data elements populated. The server MAY 385 return different URLs for users in different domains and the 386 client SHOULD NOT cache a single returned value and assume it 387 applies for all users/domains that the server suports. The 388 returned discovery document SHOULD have all data elements 389 required by the OpenID Connect Discovery specification 390 populated. In addition, the discovery document SHOULD contain 391 the 'registration_endpoint' element to learn about the endpoint 392 to be used with the Dynamic Client Registration protocol 393 [I-D.ietf-oauth-dyn-reg] to obtain the minimum number of 394 parameters necessary for the OAuth protocol exchange to 395 function. Another comparable discovery or client registration 396 mechanism MAY be used if available. 398 The use of the 'offline_access' scope, as defined in 399 [OpenID.Core] is RECOMMENDED to give clients the capability to 400 explicitly request a refresh token. 402 If the resource server provides a scope then the client MUST always 403 request scoped tokens from the token endpoint. If the resource 404 server provides no scope to the client then the client SHOULD presume 405 an empty scope (unscoped token) is required to access the resource. 407 Since clients may interact with a number of application servers, such 408 as email servers and XMPP servers, they need to have a way to 409 determine whether dynamic client registration has been performed 410 already and whether an already available refresh token can be re-used 411 to obtain an access token for the desired resource server. This 412 specification RECOMMENDs that a client uses the information in the 413 'iss' element defined in OpenID Connect Core [OpenID.Core] to make 414 this determination. 416 3.2.3. Completing an Error Message Sequence 418 Section 3.6 of [RFC4422] explicitly prohibits additional information 419 in an unsuccessful authentication outcome. Therefore, the error 420 message is sent in a normal message. The client MUST then send an 421 additional client response consisting of a single %x01 (control A) 422 character to the server in order to allow the server to finish the 423 exchange. 425 3.3. OAuth Access Token Types using Keyed Message Digests 427 OAuth Access Token Types may use keyed message digests and the client 428 and the resource server may need to perform a cryptographic 429 computation for integrity protection and data origin authentication. 431 OAuth is designed for access to resources identified by URIs. SASL 432 is designed for user authentication, and has no facility for more 433 fine-grained access control. In this specification we require or 434 define default values for the data elements from an HTTP request 435 which allow the signature base string to be constructed properly. 436 The default HTTP path is "/" and the default post body is empty. 437 These atoms are defined as extension points so that no changes are 438 needed if there is a revision of SASL which supports more specific 439 resource authorization, e.g., IMAP access to a specific folder or FTP 440 access limited to a specific directory. 442 Using the example in the OAuth 1.0a specification as a starting 443 point, on an IMAP server running on port 143 and given the OAuth 1.0a 444 style authorization request (with %x01 shown as ^A and line breaks 445 added for readability) below: 447 n,a=user@example.com,^A 448 host=example.com^A 449 port=143^A 450 auth=OAuth realm="Example", 451 oauth_consumer_key="9djdj82h48djs9d2", 452 oauth_token="kkk9d7dh3k39sjv7", 453 oauth_signature_method="HMAC-SHA1", 454 oauth_timestamp="137131201", 455 oauth_nonce="7d8f3e4a", 456 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU"^A^A 458 The signature base string would be constructed per the OAuth 1.0 459 specification [RFC5849] with the following things noted: 461 o The method value is defaulted to POST. 463 o The scheme defaults to be "http", and any port number other than 464 80 is included. 466 o The path defaults to "/". 468 o The query string defaults to "". 470 In this example the signature base string with line breaks added for 471 readability would be: 473 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 474 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 475 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 477 4. Examples 479 These examples illustrate exchanges between IMAP and SMTP clients and 480 servers. 482 Note to implementers: The SASL OAuth method names are case 483 insensitive. One example uses "Bearer" but that could as easily be 484 "bearer", "BEARER", or "BeArEr". 486 4.1. Successful Bearer Token Exchange 488 This example shows a successful OAuth 2.0 bearer token exchange in 489 IMAP. Note that line breaks are inserted for readability and the 490 underlying TLS establishment is not shown either. 492 S: * OK IMAP4rev1 Server Ready 493 C: t0 CAPABILITY 494 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 495 S: t0 OK Completed 496 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9c2 497 VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyIHZGOWRmdDRxb 498 VRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQEB 499 S: t1 OK SASL authentication succeeded 501 As required by IMAP [RFC3501], the payloads are base64-encoded. The 502 decoded initial client response (with %x01 represented as ^A and long 503 lines wrapped for readability) is: 505 n,a=user@example.com,^Ahost=server.example.com^Aport=143^A 506 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 508 The same credential used in an SMTP exchange is shown below. Note 509 that line breaks are inserted for readability, and that the SMTP 510 protocol terminates lines with CR and LF characters (ASCII values 511 0x0D and 0x0A), these are not displayed explicitly in the example. 513 [connection begins] 514 S: 220 mx.example.com ESMTP 12sm2095603fks.9 515 C: EHLO sender.example.com 516 S: 250-mx.example.com at your service,[172.31.135.47] 517 S: 250-SIZE 35651584 518 S: 250-8BITMIME 519 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 520 S: 250-ENHANCEDSTATUSCODES 521 S: 250 PIPELINING 522 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9c 523 2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyIHZGOWRmdDR 524 xbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQEB 525 S: 235 Authentication successful. 526 [connection continues...] 528 4.2. Successful OAuth 1.0a Token Exchange 530 This IMAP example shows a successful OAuth 1.0a token exchange. Note 531 that line breaks are inserted for readability and the underlying TLS 532 establishment is not shown. Signature computation is discussed in 533 Section 3.3. 535 S: * OK IMAP4rev1 Server Ready 536 C: t0 CAPABILITY 537 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER OAUTH10A SASL-IR 538 S: t0 OK Completed 539 C: t1 AUTHENTICATE OAUTH10A bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9ZXhhb 540 XBsZS5jb20BcG9ydD0xNDMBYXV0aD1PQXV0aCByZWFsbT0iRXhhbXBsZSIsb2F1 541 dGhfY29uc3VtZXJfa2V5PSI5ZGpkajgyaDQ4ZGpzOWQyIixvYXV0aF90b2tlbj0 542 ia2trOWQ3ZGgzazM5c2p2NyIsb2F1dGhfc2lnbmF0dXJlX21ldGhvZD0iSE1BQy 543 1TSEExIixvYXV0aF90aW1lc3RhbXA9IjEzNzEzMTIwMSIsb2F1dGhfbm9uY2U9I 544 jdkOGYzZTRhIixvYXV0aF9zaWduYXR1cmU9IlRtOTBJR0VnY21WaGJDQnphV2R1 545 WVhSMWNtVSUzRCIBAQ== 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 n,a=user@example.com,^A 553 host=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^A 563 4.3. Failed Exchange 565 This IMAP example shows a failed exchange because of the empty 566 Authorization header, which is how a client can query for the needed 567 scope. Note that line breaks are inserted for readability. 569 S: * OK IMAP4rev1 Server Ready 570 C: t0 CAPABILITY 571 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 572 Ready 573 S: t0 OK Completed 574 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAW 575 hvc3Q9c2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9AQE= 576 S: + eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxl 577 X3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4 578 YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9u 579 In0= 580 C: + AQ== 581 S: t1 NO SASL authentication failed 582 The decoded initial client response is: 584 n,a=user@example.com,^Ahost=server.example.com^A 585 port=143^Aauth=^A^A 587 The decoded server error response is: 589 { 590 "status":"invalid_token", 591 "scope":"example_scope", 592 "openid-configuration":"https://example.com/.well-known/openid-configuration" 593 } 595 The client responds with the required dummy response, "AQ==" is the 596 base64 encoding of the ASCII value 0x01. 598 4.4. SMTP Example of a Failed Negotiation 600 This example shows an authorization failure in an SMTP exchange. 601 Note that line breaks are inserted for readability, and that the SMTP 602 protocol terminates lines with CR and LF characters (ASCII values 603 0x0D and 0x0A), these are not displayed explicitly in the example. 605 [connection begins] 606 S: 220 mx.example.com ESMTP 12sm2095603fks.9 607 C: EHLO sender.example.com 608 S: 250-mx.example.com at your service,[172.31.135.47] 609 S: 250-SIZE 35651584 610 S: 250-8BITMIME 611 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 612 S: 250-ENHANCEDSTATUSCODES 613 S: 250 PIPELINING 614 C: AUTH OAUTHBEARER bix1c2VyPXNvbWV1c2VyQGV4YW1wbGUuY29tLAFhdXRoPUJlYXJl 615 ciB2RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 616 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 617 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 618 C: AQ== 619 S: 535-5.7.1 Username and Password not accepted. Learn more at 620 S: 535 5.7.1 http://support.example.com/mail/oauth 621 [connection continues...] 623 The server returned an error message in the 334 SASL message, the 624 client responds with the required dummy response, and the server 625 finalizes the negotiation. 627 5. Security Considerations 629 OAuth 1.0a and OAuth 2 allows for a variety of deployment scenarios, 630 and the security properties of these profiles vary. As shown in 631 Figure 1 this specification is aimed to be integrated into a larger 632 OAuth deployment. Application developers therefore need to 633 understand the needs of their security requirements based on a threat 634 assessment before selecting a specific SASL OAuth mechanism. For 635 OAuth 2.0 a detailed security document [RFC6819] provides guidance to 636 select those OAuth 2.0 components that help to mitigate threats for a 637 given deployment. For OAuth 1.0a Section 4 of RFC 5849 [RFC5849] 638 provides guidance specific to OAuth 1.0. 640 This document specifies two SASL Mechanisms for OAuth and each comes 641 with different security properties. 643 OAUTHBEARER: This mechanism borrows from OAuth 2.0 bearer tokens 644 [RFC6750]. It relies on the application using TLS to protect the 645 OAuth 2.0 Bearer Token exchange; without TLS usage at the 646 application layer this method is completely insecure. 647 Consequently, TLS MUST be provided by the application when 648 choosing this authentication mechanism. 650 OAUTH10A: This mechanism re-uses OAuth 1.0a MAC tokens (using the 651 HMAC-SHA1 keyed message digest), as described in Section 3.4.2 of 652 [RFC5849]. To compute the keyed message digest in the same way 653 was in RFC 5839 this specification conveys additional parameters 654 between the client and the server. This SASL mechanism only 655 supports client authentication. If server-side authentication is 656 desireable then it must be provided by the application underneath 657 the SASL layer. The use of TLS is strongly RECOMMENDED. 659 Additionally, the following aspects are worth pointing out: 661 An access token is not equivalent to the user's long term password. 663 Care has to be taken when these OAuth credentials are used for 664 actions like changing passwords (as it is possible with some 665 protocols, e.g., XMPP [RFC6120]). The resource server should 666 ensure that actions taken in the authenticated channel are 667 appropriate to the strength of the presented credential. 669 Lifetime of the appliation sessions. 671 It is possible that SASL will be authenticating a connection and 672 the life of that connection may outlast the life of the access 673 token used to establish it. This is a common problem in 674 application protocols where connections are long-lived, and not a 675 problem with this mechanism per se. Resource servers may 676 unilaterally disconnect clients in accordance with the application 677 protocol. 679 Access tokens have a lifetime. 681 Reducing the lifetime of an access token provides security 682 benefits and OAuth 2.0 introduces refresh tokens to obtain new 683 access token on the fly without any need for a human interaction. 684 Additionally, a previously obtained access token might be revoked 685 or rendered invalid at any time. The client MAY request a new 686 access token for each connection to a resource server, but it 687 SHOULD cache and re-use valid credentials. 689 6. Internationalization Considerations 691 The identifer asserted by the OAuth authorization server about the 692 resource owner inside the access token may be displayed to a human. 693 For example, when SASL is used in the context of IMAP the client may 694 assert the resource owner's email address to the IMAP server for 695 usage in an email-based application. The identifier may therefore 696 contain internationalized characters and an application needs to 697 ensure that the mapping between the identifier provided by OAuth is 698 suitable for use with the application layer protocol SASL is 699 incorporated into. 701 At the time of writing the standardization of the various claims in 702 the access token (in JSON format) is still ongoing, see 703 [I-D.ietf-oauth-json-web-token]. Once completed it will provide a 704 standardized format for exchanging identity information between the 705 authorization server and the resource server. 707 7. IANA Considerations 709 7.1. SASL Registration 711 The IANA is requested to register the following SASL profile: 713 SASL mechanism profile: OAUTHBEARER 715 Security Considerations: See this document 717 Published Specification: See this document 719 For further information: Contact the authors of this document. 721 Owner/Change controller: the IETF 722 Note: None 724 The IANA is requested to register the following SASL profile: 726 SASL mechanism profile: OAUTH10A 728 Security Considerations: See this document 730 Published Specification: See this document 732 For further information: Contact the authors of this document. 734 Owner/Change controller: the IETF 736 Note: None 738 8. References 740 8.1. Normative References 742 [OpenID.Core] 743 Sakimura, N., Bradley, J., Jones, M., de Medeiros, B., and 744 C. Mortimore, "OpenID Connect Core 1.0", February 2014. 746 [OpenID.Discovery] 747 Sakimura, N., Bradley, J., Jones, M., and E. Jay, "OpenID 748 Connect Discovery 1.0", July 2011. 750 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 751 Requirement Levels", BCP 14, RFC 2119, March 1997. 753 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 754 (SHA1)", RFC 3174, September 2001. 756 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 757 Security Layer (SASL)", RFC 4422, June 2006. 759 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 760 Encodings", RFC 4648, October 2006. 762 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 763 Specifications: ABNF", STD 68, RFC 5234, January 2008. 765 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 766 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 768 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 769 Service Application Program Interface (GSS-API) Mechanisms 770 in Simple Authentication and Security Layer (SASL): The 771 GS2 Mechanism Family", RFC 5801, July 2010. 773 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 774 April 2010. 776 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", RFC 777 6749, October 2012. 779 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 780 Framework: Bearer Token Usage", RFC 6750, October 2012. 782 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 783 Interchange Format", RFC 7159, March 2014. 785 8.2. Informative References 787 [I-D.ietf-oauth-dyn-reg] 788 Richer, J., Jones, M., Bradley, J., Machulak, M., and P. 789 Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", 790 draft-ietf-oauth-dyn-reg-20 (work in progress), August 791 2014. 793 [I-D.ietf-oauth-json-web-token] 794 Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 795 (JWT)", draft-ietf-oauth-json-web-token-31 (work in 796 progress), November 2014. 798 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 799 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 800 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 802 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 803 4rev1", RFC 3501, March 2003. 805 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 806 October 2008. 808 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 809 Protocol (XMPP): Core", RFC 6120, March 2011. 811 [RFC6819] Lodderstedt, T., McGloin, M., and P. Hunt, "OAuth 2.0 812 Threat Model and Security Considerations", RFC 6819, 813 January 2013. 815 [RFC7033] Jones, P., Salgueiro, G., Jones, M., and J. Smarr, 816 "WebFinger", RFC 7033, September 2013. 818 Appendix A. Acknowlegements 820 The authors would like to thank the members of the Kitten working 821 group, and in addition and specifically: Simon Josefson, Torsten 822 Lodderstadt, Ryan Troll, Alexey Melnikov, Jeffrey Hutzelman, Nico 823 Williams, Matt Miller, and Benjamin Kaduk. 825 This document was produced under the chairmanship of Alexey Melnikov, 826 Tom Yu, Shawn Emery, Josh Howlett, Sam Hartman. The supervising area 827 director was Stephen Farrell. 829 Appendix B. Document History 831 [[ to be removed by RFC editor before publication as an RFC ]] 833 -18 835 o Last call feedback round #5. Fixed -17 change log. 837 o Corrected "issue" to "iss", other minor changes. 839 -17 841 o Last call feedback again (WGLC #4). eradicated comma splicing. 842 Removed extra server message in example 4.3. 844 o Added recommendations for discovery and dynamic client 845 registration support. 847 -16 849 o Last call feedback again. Primarily editorial changes. Corrected 850 examples. 852 -15 854 o Last call feedack on the GS2 stuff being ripped out completely. 856 o Removed the "user" parameter and put stuff back into the 857 gs2-header. Call out that the authzid goes in the gs2-header with 858 some prose about when it might be required. Very comparable to 859 -10. 861 o Added an OAuth 1.0A example explicitly. 863 -14 865 o Last call feedack on RFC citations needed, small editorial. 867 o Added the "user" parameter back, which was pulled when we started 868 down the GS2 path. Same language as -03. 870 o Defined a stub GS2 header to make sure that when the GS2 bride is 871 defined for this that nothing will break when it actually starts 872 to get populated. 874 -13 876 o Changed affiliation. 878 -12 880 o Removed -PLUS components from the specification. 882 -11 884 o Removed GSS-API components from the specification. 886 o Updated security consideration section. 888 -10 890 o Clarifications throughout the document in response to the feedback 891 from Jeffrey Hutzelman. 893 -09 895 o Incorporated review by Alexey and Hannes. 897 o Clarified the three OAuth SASL mechanisms. 899 o Updated references 901 o Extended acknowledgements 903 -08 905 o Fixed the channel binding examples for p=$cbtype 907 o More tuning of the authcid language and edited and renamed 3.2.1. 909 -07 910 o Struck the MUST langiage from authzid. 912 o 914 -06 916 o Removed the user field. Fixed the examples again. 918 o Added canonicalization language. 920 o 922 -05 924 o Fixed the GS2 header language again. 926 o Separated out different OAuth schemes into different SASL 927 mechanisms. Took out the scheme in the error return. Tuned up 928 the IANA registrations. 930 o Added the user field back into the SASL message. 932 o Fixed the examples (again). 934 o 936 -04 938 o Changed user field to be carried in the gs2-header, and made gs2 939 header explicit in all cases. 941 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 942 reference. 944 o Changed to sending an empty client response (single control-A) as 945 the second message of a failed sequence. 947 o Fixed channel binding prose to refer to the normative specs and 948 removed the hashing of large channel binding data, which brought 949 mroe problems than it solved. 951 o Added a SMTP examples for Bearer use case. 953 -03 955 o Added user field into examples and fixed egregious errors there as 956 well. 958 o Added text reminding developers that Authorization scheme names 959 are case insensitive. 961 -02 963 o Added the user data element back in. 965 o Minor editorial changes. 967 -01 969 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 970 webfinger instead of WF and SWD older drafts. 972 o Replacing HTTP as the message format and adjusted all examples. 974 -00 976 o Renamed draft into proper IETF naming format now that it's 977 adopted. 979 o Minor fixes. 981 Authors' Addresses 983 William Mills 984 Microsoft 986 Email: wimills@microsoft.com 988 Tim Showalter 990 Email: tjs@psaux.com 992 Hannes Tschofenig 993 ARM Ltd. 994 110 Fulbourn Rd 995 Cambridge CB1 9NJ 996 Great Britain 998 Email: Hannes.tschofenig@gmx.net 999 URI: http://www.tschofenig.priv.at