idnits 2.17.00 (12 Aug 2021) /tmp/idnits62990/draft-ietf-kitten-sasl-oauth-23.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 29, 2015) is 2542 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) == Outdated reference: draft-ietf-oauth-dyn-reg has been published as RFC 7591 ** 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: draft-ietf-oauth-json-web-token has been published as RFC 7519 -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 3 errors (**), 0 flaws (~~), 3 warnings (==), 2 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: November 30, 2015 6 H. Tschofenig 7 ARM Ltd. 8 May 29, 2015 10 A set of SASL Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-23.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 November 30, 2015. 50 Copyright Notice 52 Copyright (c) 2015 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 . . . . . . . . 9 74 3.2.2. Server Response to Failed Authentication . . . . . . 9 75 3.2.3. Completing an Error Message Sequence . . . . . . . . 11 76 3.3. OAuth Access Token Types using Keyed Message Digests . . 11 77 4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 12 78 4.1. Successful Bearer Token Exchange . . . . . . . . . . . . 12 79 4.2. Successful OAuth 1.0a Token Exchange . . . . . . . . . . 13 80 4.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 14 81 4.4. SMTP Example of a Failed Negotiation . . . . . . . . . . 15 82 5. Security Considerations . . . . . . . . . . . . . . . . . . . 16 83 6. Internationalization Considerations . . . . . . . . . . . . . 17 84 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 85 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 18 86 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 18 87 8.1. Normative References . . . . . . . . . . . . . . . . . . 18 88 8.2. Informative References . . . . . . . . . . . . . . . . . 19 89 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . 20 90 Appendix B. Document History . . . . . . . . . . . . . . . . . . 20 91 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 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 [RFC7230] 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 This document gives examples of use in IMAP and SMTP. 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 mechanisms 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 indirectly via the authorization server as an 170 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", "NOT RECOMMENDED", "MAY", and 218 "OPTIONAL" in this document are to be interpreted as described in 219 [RFC2119]. 221 The reader is assumed to be familiar with the terms used in the OAuth 222 2.0 specification [RFC6749] and SASL [RFC4422]. 224 In examples, "C:" and "S:" indicate lines sent by the client and 225 server respectively. Line breaks have been inserted for readability. 227 Note that the IMAP SASL specification requires base64 encoding, as 228 specified in Section 4 of [RFC4648]. 230 3. OAuth SASL Mechanism Specifications 232 SASL is used as an authentication framework in a variety of 233 application layer protocols. This document defines the following 234 SASL mechanisms for usage with OAuth: 236 OAUTHBEARER: OAuth 2.0 bearer tokens, as described in [RFC6750]. 237 RFC 6750 uses Transport Layer Security (TLS) [RFC5246] to 238 secure the protocol interaction between the client and the 239 resource server. 241 OAUTH10A: OAuth 1.0a MAC tokens (using the HMAC-SHA1 keyed 242 message digest), as described in Section 3.4.2 of [RFC5849]. 244 New extensions may be defined to add additional OAuth Access Token 245 Types. Such a new SASL OAuth mechanism can be added by registering 246 the new name(s) with IANA in the SASL Mechanisms registry and citing 247 this specification for the further definition. 249 SASL mechanisms using this document as their definition do not 250 provide a data security layer; that is, they cannot provide integrity 251 or confidentiality protection for application messages after the 252 initial authentication. If such protection is needed, TLS or some 253 similar solution should be used. Additionally, for the two 254 mechanisms specified in this document, TLS MUST be used for 255 OAUTHBEARER to protect the bearer token; for OAUTH10A the use of TLS 256 is RECOMMENDED. 258 These mechanisms are client initiated and lock-step, the server 259 always replying to a client message. In the case where the client 260 has and correctly uses a valid token the flow is: 262 1. Client sends a valid and correct initial client response. 264 2. Server responds with a successful authentication. 266 In the case where authentication fails the server sends an error 267 result, then client MUST then send an additional message to the 268 server in order to allow the server to finish the exchange. Some 269 protocols and common SASL implementations do not support both sending 270 a SASL message and finalizing a SASL negotiation. The additional 271 client message in the error case deals with this problem. This 272 exchange is: 274 1. Client sends an invalid initial client response. 276 2. Server responds with an error message. 278 3. Client sends a dummy client response. 280 4. Server fails the authentication. 282 3.1. Initial Client Response 284 Client responses are a GS2 [RFC5801] header followed by zero or more 285 key/value pairs, or may be empty. The gs2-header is defined here for 286 compatibility with GS2 if a GS2 mechanism is formally defined, but 287 this document does not define one. The key/value pairs take the 288 place of the corresponding HTTP headers and values to convey the 289 information necessary to complete an OAuth style HTTP authorization. 290 Unknown key/value pairs MUST be ignored by the server. The ABNF 291 [RFC5234] syntax is: 293 kvsep = %x01 294 key = 1*(ALPHA) 295 value = *(VCHAR / SP / HTAB / CR / LF ) 296 kvpair = key "=" value kvsep 297 ;;gs2-header = See RFC 5801 298 client_resp = (gs2-header kvsep *kvpair kvsep) / kvsep 300 The GS2 header MAY include the user name associated with the resource 301 being accessed, the "authzid". It is worth noting that application 302 protocols are allowed to require an authzid, as are specific server 303 implementations. 305 The client response consisting of only a single kvsep is used only 306 when authentication fails, and is only valid in that context. If 307 sent as the first message from the client the server MAY simply fail 308 the authentication without returning discovery information since 309 there is no user or server name indication. 311 The following keys and corresponding values are defined in the client 312 response: 314 auth (REQUIRED): The payload that would be in the HTTP 315 Authorization header if this OAuth exchange was being carried 316 out over HTTP. 318 host: Contains the host name to which the client connected. In 319 an HTTP context this is the value of the HTTP Host header. 321 port: Contains the destination port that the client connected to, 322 represented as a decimal positive integer string without 323 leading zeros. 325 For OAuth token types such as OAuth 1.0a that use keyed message 326 digests the client MUST send host and port number key/values, and the 327 server MUST fail an authorization request requiring keyed message 328 digests that are not accompanied by host and port values. In OAuth 329 1.0a for example, the so-called "signature base string calculation" 330 includes the reconstructed HTTP URL. 332 3.1.1. Reserved Key/Values 334 In these mechanisms values for path, query string and post body are 335 assigned default values. OAuth authorization schemes MAY define 336 usage of these in the SASL context and extend this specification. 337 For OAuth Access Token Types that include a keyed message digest of 338 the request the default values MUST be used unless explicit values 339 are provided in the client response. The following key values are 340 reserved for future use: 342 mthd (RESERVED): HTTP method, the default value is "POST". 344 path (RESERVED): HTTP path data, the default value is "/". 346 post (RESERVED): HTTP post data, the default value is the empty 347 string (""). 349 qs (RESERVED): The HTTP query string, the default value is the 350 empty string (""). 352 3.2. Server's Response 354 The server validates the response according to the specification for 355 the OAuth Access Token Types used. If the OAuth Access Token Type 356 utilizes a keyed message digest of the request parameters then the 357 client must provide a client response that satisfies the data 358 requirements for the scheme in use. 360 The server fully validates the client response before generating a 361 server response; this will necessarily include the validation steps 362 listed in the specification for the OAuth Access Token Type used. 363 However, additional validation steps may be needed, depending on the 364 particular application protocol making use of SASL. In particular, 365 values included as kvpairs in the client response (such as host and 366 port) which correspond to values known to the application server by 367 some other mechanism (such as an application protocol data unit or 368 pre-configured values) MUST be validated to match between the initial 369 client response and the the other source(s) of such information. As 370 a concrete example, when SASL is used over IMAP to an IMAP server for 371 a single domain the hostname can be available via configuration; this 372 hostname must be validated to match the value sent in the 'host' 373 kvpair. 375 The server responds to a successfully verified client message by 376 completing the SASL negotiation. The authenticated identity reported 377 by the SASL mechanism is the identity securely established for the 378 client with the OAuth credential. The application, not the SASL 379 mechanism, based on local access policy determines whether the 380 identity reported by the mechanism is allowed access to the requested 381 resource. Note that the semantics of the authzid is specified by the 382 SASL framework [RFC4422]. 384 3.2.1. OAuth Identifiers in the SASL Context 386 In the OAuth framework the client may be authenticated by the 387 authorization server and the resource owner is authenticated to the 388 authorization server. OAuth access tokens may contain information 389 about the authentication of the resource owner and about the client 390 and may therefore make this information accessible to the resource 391 server. 393 If both identifiers are needed by an application the developer will 394 need to provide a way to communicate that from the SASL mechanism 395 back to the application. 397 3.2.2. Server Response to Failed Authentication 399 For a failed authentication the server returns a JSON [RFC7159] 400 formatted error result, and fails the authentication. The error 401 result consists of the following values: 403 status (REQUIRED): The authorization error code. Valid error 404 codes are defined in the IANA "OAuth Extensions Error Registry" 405 specified in the OAuth 2 core specification. 407 scope (OPTIONAL): An OAuth scope which is valid to access the 408 service. This may be omitted which implies that unscoped 409 tokens are required. If a scope is specified then a single 410 scope is preferred. At the time this document was written 411 there are several implementations that do not properly support 412 space separated lists of scopes, so the use of a space 413 separated list of scopes is NOT RECOMMENDED. 415 openid-configuration (OPTIONAL): The URL for a document following 416 the OpenID Provider Configuration Information schema as 417 described in OpenID Connect Discovery (OIDCD) 418 [OpenID.Discovery] section 3 that is appropriate for the user. 419 As specified in OIDCD this will have the "https" URL scheme. 420 This document MUST have all OAuth related data elements 421 populated. The server MAY return different URLs for users in 422 different domains and the client SHOULD NOT cache a single 423 returned value and assume it applies for all users/domains that 424 the server suports. The returned discovery document SHOULD 425 have all data elements required by the OpenID Connect Discovery 426 specification populated. In addition, the discovery document 427 SHOULD contain the 'registration_endpoint' element to identify 428 the endpoint to be used with the Dynamic Client Registration 429 protocol [I-D.ietf-oauth-dyn-reg] to obtain the minimum number 430 of parameters necessary for the OAuth protocol exchange to 431 function. Another comparable discovery or client registration 432 mechanism MAY be used if available. 434 The use of the 'offline_access' scope, as defined in 435 [OpenID.Core] is RECOMMENDED to give clients the capability to 436 explicitly request a refresh token. 438 If the resource server provides a scope then the client MUST always 439 request scoped tokens from the token endpoint. If the resource 440 server does not return a scope the client SHOULD presume an unscoped 441 token is required to access the resource. 443 Since clients may interact with a number of application servers, such 444 as email servers and XMPP [RFC6120] servers, they need to have a way 445 to determine whether dynamic client registration has been performed 446 already and whether an already available refresh token can be re-used 447 to obtain an access token for the desired resource server. This 448 specification RECOMMENDs that a client uses the information in the 449 'iss' element defined in OpenID Connect Core [OpenID.Core] to make 450 this determination. 452 3.2.3. Completing an Error Message Sequence 454 Section 3.6 of SASL [RFC4422] explicitly prohibits additional 455 information in an unsuccessful authentication outcome. Therefore, 456 the error message is sent in a normal message. The client MUST then 457 send either an additional client response consisting of a single %x01 458 (control A) character to the server in order to allow the server to 459 finish the exchange or send a SASL cancellation token as generally 460 defined in section 3.5 of SASL [RFC4422]. A specific example of a 461 cancellation token can be found in IMAP [RFC3501] section 6.2.2. 463 3.3. OAuth Access Token Types using Keyed Message Digests 465 OAuth Access Token Types may use keyed message digests and the client 466 and the resource server may need to perform a cryptographic 467 computation for integrity protection and data origin authentication. 469 OAuth is designed for access to resources identified by URIs. SASL 470 is designed for user authentication, and has no facility for more 471 fine-grained access control. In this specification we require or 472 define default values for the data elements from an HTTP request 473 which allow the signature base string to be constructed properly. 474 The default HTTP path is "/" and the default post body is empty. 475 These atoms are defined as extension points so that no changes are 476 needed if there is a revision of SASL which supports more specific 477 resource authorization, e.g., IMAP access to a specific folder or FTP 478 access limited to a specific directory. 480 Using the example in the OAuth 1.0a specification as a starting 481 point, on an IMAP server running on port 143 and given the OAuth 1.0a 482 style authorization request (with %x01 shown as ^A and line breaks 483 added for readability) below: 485 n,a=user@example.com,^A 486 host=example.com^A 487 port=143^A 488 auth=OAuth realm="Example", 489 oauth_consumer_key="9djdj82h48djs9d2", 490 oauth_token="kkk9d7dh3k39sjv7", 491 oauth_signature_method="HMAC-SHA1", 492 oauth_timestamp="137131201", 493 oauth_nonce="7d8f3e4a", 494 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU"^A^A 496 The signature base string would be constructed per the OAuth 1.0 497 specification [RFC5849] with the following things noted: 499 o The method value is defaulted to POST. 501 o The scheme defaults to be "http", and any port number other than 502 80 is included. 504 o The path defaults to "/". 506 o The query string defaults to "". 508 In this example the signature base string with line breaks added for 509 readability would be: 511 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 512 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 513 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 515 4. Examples 517 These examples illustrate exchanges between IMAP and SMTP clients and 518 servers. All IMAP examples use SASL-IR [RFC4959] and send payload in 519 the initial client response. The Bearer Token examples assume 520 encrypted transport; if the underlying connection is not already TLS 521 then STARTTLS MUST be used as TLS is required in the Bearer Token 522 specification. 524 Note to implementers: The SASL OAuth method names are case 525 insensitive. One example uses "Bearer" but that could as easily be 526 "bearer", "BEARER", or "BeArEr". 528 4.1. Successful Bearer Token Exchange 530 This example shows a successful OAuth 2.0 bearer token exchange in 531 IMAP. Note that line breaks are inserted for readability. 533 [Initial connection and TLS establishment...] 534 S: * OK IMAP4rev1 Server Ready 535 C: t0 CAPABILITY 536 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 537 S: t0 OK Completed 538 C: t1 AUTH OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9c2Vy 539 dmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyIHZGOWRmd 540 DRxbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQEB 541 S: t1 OK SASL authentication succeeded 543 As required by IMAP [RFC3501], the payloads are base64-encoded. The 544 decoded initial client response (with %x01 represented as ^A and long 545 lines wrapped for readability) is: 547 n,a=user@example.com,^Ahost=server.example.com^Aport=143^A 548 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 549 The same credential used in an SMTP exchange is shown below. Again 550 this example assumes that TLS is already established per the Bearer 551 Token specification requirements. 553 [connection begins] 554 S: 220 mx.example.com ESMTP 12sm2095603fks.9 555 C: EHLO sender.example.com 556 S: 250-mx.example.com at your service,[172.31.135.47] 557 S: 250-SIZE 35651584 558 S: 250-8BITMIME 559 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 560 S: 250-ENHANCEDSTATUSCODES 561 S: 250-STARTTLS 562 S: 250 PIPELINING 563 [Negotiate TLS...] 564 C: t1 AUTH OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9c2Vy 565 dmVyLmV4YW1wbGUuY29tAXBvcnQ9NTg3AWF1dGg9QmVhcmVyIHZGOWRmd 566 DRxbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQEB 567 S: 235 Authentication successful. 568 [connection continues...] 570 The decoded initial client response is: 572 n,a=user@example.com,^Ahost=server.example.com^Aport=587^A 573 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 575 4.2. Successful OAuth 1.0a Token Exchange 577 This IMAP example shows a successful OAuth 1.0a token exchange. Note 578 that line breaks are inserted for readability. This example assumes 579 that TLS is already established. Signature computation is discussed 580 in Section 3.3. 582 S: * OK IMAP4rev1 Server Ready 583 C: t0 CAPABILITY 584 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER OAUTH10A SASL-IR 585 S: t0 OK Completed 586 C: t1 AUTH OAUTH10A bixhPXVzZXJAZXhhbXBsZS5jb20sAWhvc3Q9ZXhhb 587 XBsZS5jb20BcG9ydD0xNDMBYXV0aD1PQXV0aCByZWFsbT0iRXhhbXBsZSIsb2F1 588 dGhfY29uc3VtZXJfa2V5PSI5ZGpkajgyaDQ4ZGpzOWQyIixvYXV0aF90b2tlbj0 589 ia2trOWQ3ZGgzazM5c2p2NyIsb2F1dGhfc2lnbmF0dXJlX21ldGhvZD0iSE1BQy 590 1TSEExIixvYXV0aF90aW1lc3RhbXA9IjEzNzEzMTIwMSIsb2F1dGhfbm9uY2U9I 591 jdkOGYzZTRhIixvYXV0aF9zaWduYXR1cmU9IlRtOTBJR0VnY21WaGJDQnphV2R1 592 WVhSMWNtVSUzRCIBAQ== 593 S: t1 OK SASL authentication succeeded 594 As required by IMAP [RFC3501], the payloads are base64-encoded. The 595 decoded initial client response (with %x01 represented as ^A and 596 lines wrapped for readability) is: 598 n,a=user@example.com,^A 599 host=example.com^A 600 port=143^A 601 auth=OAuth realm="Example", 602 oauth_consumer_key="9djdj82h48djs9d2", 603 oauth_token="kkk9d7dh3k39sjv7", 604 oauth_signature_method="HMAC-SHA1", 605 oauth_timestamp="137131201", 606 oauth_nonce="7d8f3e4a", 607 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A^A 609 4.3. Failed Exchange 611 This IMAP example shows a failed exchange because of the empty 612 Authorization header, which is how a client can query for the needed 613 scope. Note that line breaks are inserted for readability. 615 S: * OK IMAP4rev1 Server Ready 616 C: t0 CAPABILITY 617 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 618 S: t0 OK Completed 619 C: t1 AUTH OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAW 620 hvc3Q9c2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9AQE= 621 S: + eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxl 622 X3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4 623 YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWcifQ== 624 C: AQ== 625 S: t1 NO SASL authentication failed 627 The decoded initial client response is: 629 n,a=user@example.com,^Ahost=server.example.com^A 630 port=143^Aauth=^A^A 632 The decoded server error response is: 634 { 635 "status":"invalid_token", 636 "scope":"example_scope", 637 "openid-configuration":"https://example.com/.well-known/openid-config" 638 } 640 The client responds with the required dummy response, "AQ==" is the 641 base64 encoding of the ASCII value 0x01. The same exchange using the 642 IMAP specific method of cancelling an AUTHENTICATE command sends "*" 643 and is shown below. 645 S: * OK IMAP4rev1 Server Ready 646 C: t0 CAPABILITY 647 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 648 S: t0 OK Completed 649 C: t1 AUTH OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20sAW 650 hvc3Q9c2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9AQE= 651 S: + eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NvcGUiOiJleGFtcGxl 652 X3Njb3BlIiwib3BlbmlkLWNvbmZpZ3VyYXRpb24iOiJodHRwczovL2V4 653 YW1wbGUuY29tLy53ZWxsLWtub3duL29wZW5pZC1jb25maWd1cmF0aW9u 654 In0= 655 C: * 656 S: t1 NO SASL authentication failed 658 4.4. SMTP Example of a Failed Negotiation 660 This example shows an authorization failure in an SMTP exchange. TLS 661 negotiation is not shown but as noted above it is required for the 662 use of Bearer Tokens. 664 [connection begins] 665 S: 220 mx.example.com ESMTP 12sm2095603fks.9 666 C: EHLO sender.example.com 667 S: 250-mx.example.com at your service,[172.31.135.47] 668 S: 250-SIZE 35651584 669 S: 250-8BITMIME 670 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 671 S: 250-ENHANCEDSTATUSCODES 672 S: 250 PIPELINING 673 [Negotiate TLS...] 674 C: AUTH OAUTHBEARER bix1c2VyPXNvbWV1c2VyQGV4YW1wbGUuY29tLAFhdXRoPUJlYXJl 675 ciB2RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 676 S: 334 eyJzdGF0dXMiOiJpbnZhbGlkX3Rva2VuIiwic2NoZW1lcyI6ImJlYXJlciBtYWMiL 677 CJzY29wZSI6Imh0dHBzOi8vbWFpbC5leGFtcGxlLmNvbS8ifQ== 678 C: AQ== 679 S: 535-5.7.1 Username and Password not accepted. Learn more at 680 S: 535 5.7.1 http://support.example.com/mail/oauth 681 [connection continues...] 683 The initial client response is: 685 n,user=someuser@example.com,^A 686 auth=Bearer vF9dft4qmTc2Nvb3RlckBhdHRhdmlzdGEuY29tCg==^A^A 687 The server returned an error message in the 334 SASL message, the 688 client responds with the required dummy response, and the server 689 finalizes the negotiation. 691 { 692 "status":"invalid_token", 693 "schemes":"bearer mac", 694 "scope":"https://mail.example.com/" 695 } 697 5. Security Considerations 699 OAuth 1.0a and OAuth 2 allow for a variety of deployment scenarios, 700 and the security properties of these profiles vary. As shown in 701 Figure 1 this specification is aimed to be integrated into a larger 702 OAuth deployment. Application developers therefore need to 703 understand their security requirements based on a threat assessment 704 before selecting a specific SASL OAuth mechanism. For OAuth 2.0 a 705 detailed security document [RFC6819] provides guidance to select 706 those OAuth 2.0 components that help to mitigate threats for a given 707 deployment. For OAuth 1.0a Section 4 of RFC 5849 [RFC5849] provides 708 guidance specific to OAuth 1.0. 710 This document specifies two SASL Mechanisms for OAuth and each comes 711 with different security properties. 713 OAUTHBEARER: This mechanism borrows from OAuth 2.0 bearer tokens 714 [RFC6750]. It relies on the application using TLS to protect the 715 OAuth 2.0 Bearer Token exchange; without TLS usage at the 716 application layer this method is completely insecure. 717 Consequently, TLS MUST be provided by the application when 718 choosing this authentication mechanism. 720 OAUTH10A: This mechanism re-uses OAuth 1.0a MAC tokens (using the 721 HMAC-SHA1 keyed message digest), as described in Section 3.4.2 of 722 [RFC5849]. To compute the keyed message digest in the same way as 723 in RFC 5839 this specification conveys additional parameters 724 between the client and the server. This SASL mechanism only 725 supports client authentication. If server-side authentication is 726 desireable then it must be provided by the application underneath 727 the SASL layer. The use of TLS is strongly RECOMMENDED. 729 Additionally, the following aspects are worth pointing out: 731 An access token is not equivalent to the user's long term password. 733 Care has to be taken when these OAuth credentials are used for 734 actions like changing passwords (as it is possible with some 735 protocols, e.g., XMPP [RFC6120]). The resource server should 736 ensure that actions taken in the authenticated channel are 737 appropriate to the strength of the presented credential. 739 Lifetime of the application sessions. 741 It is possible that SASL will be used to authenticate a connection 742 and the life of that connection may outlast the life of the access 743 token used to establish it. This is a common problem in 744 application protocols where connections are long-lived, and not a 745 problem with this mechanism per se. Resource servers may 746 unilaterally disconnect clients in accordance with the application 747 protocol. 749 Access tokens have a lifetime. 751 Reducing the lifetime of an access token provides security 752 benefits and OAuth 2.0 introduces refresh tokens to obtain new 753 access token on the fly without any need for a human interaction. 754 Additionally, a previously obtained access token might be revoked 755 or rendered invalid at any time. The client MAY request a new 756 access token for each connection to a resource server, but it 757 SHOULD cache and re-use valid credentials. 759 6. Internationalization Considerations 761 The identifer asserted by the OAuth authorization server about the 762 resource owner inside the access token may be displayed to a human. 763 For example, when SASL is used in the context of IMAP the client may 764 assert the resource owner's email address to the IMAP server for 765 usage in an email-based application. The identifier may therefore 766 contain internationalized characters and an application needs to 767 ensure that the mapping between the identifier provided by OAuth is 768 suitable for use with the application layer protocol SASL is 769 incorporated into. 771 At the time of writing the standardization of the various claims in 772 the access token (in JSON format) is still ongoing, see 773 [I-D.ietf-oauth-json-web-token]. Once completed it will provide a 774 standardized format for exchanging identity information between the 775 authorization server and the resource server. 777 7. IANA Considerations 778 7.1. SASL Registration 780 The IANA is requested to register the following entry in the SASL 781 Mechanisms registry: 783 SASL mechanism name: OAUTHBEARER 785 Security Considerations: See this document 787 Published Specification: See this document 789 For further information: Contact the authors of this document. 791 Intended usage: common 793 Owner/Change controller: the IESG 795 Note: None 797 The IANA is requested to register the following entry in the SASL 798 Mechanisms registry: 800 SASL mechanism name: OAUTH10A 802 Security Considerations: See this document 804 Published Specification: See this document 806 For further information: Contact the authors of this document. 808 Intended usage: common 810 Owner/Change controller: the IESG 812 Note: None 814 8. References 816 8.1. Normative References 818 [I-D.ietf-oauth-dyn-reg] 819 Richer, J., Jones, M., Bradley, J., Machulak, M., and P. 820 Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", 821 draft-ietf-oauth-dyn-reg-27 (work in progress), March 822 2015. 824 [OpenID.Core] 825 Sakimura, N., Bradley, J., Jones, M., de Medeiros, B., and 826 C. Mortimore, "OpenID Connect Core 1.0", February 2014. 828 [OpenID.Discovery] 829 Sakimura, N., Bradley, J., Jones, M., and E. Jay, "OpenID 830 Connect Discovery 1.0", July 2011. 832 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 833 Requirement Levels", BCP 14, RFC 2119, March 1997. 835 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 836 Security Layer (SASL)", RFC 4422, June 2006. 838 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 839 Encodings", RFC 4648, October 2006. 841 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 842 Specifications: ABNF", STD 68, RFC 5234, January 2008. 844 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 845 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 847 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 848 Service Application Program Interface (GSS-API) Mechanisms 849 in Simple Authentication and Security Layer (SASL): The 850 GS2 Mechanism Family", RFC 5801, July 2010. 852 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 853 April 2010. 855 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", RFC 856 6749, October 2012. 858 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 859 Framework: Bearer Token Usage", RFC 6750, October 2012. 861 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 862 Interchange Format", RFC 7159, March 2014. 864 8.2. Informative References 866 [I-D.ietf-oauth-json-web-token] 867 Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 868 (JWT)", draft-ietf-oauth-json-web-token-32 (work in 869 progress), December 2014. 871 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 872 4rev1", RFC 3501, March 2003. 874 [RFC4959] Siemborski, R. and A. Gulbrandsen, "IMAP Extension for 875 Simple Authentication and Security Layer (SASL) Initial 876 Client Response", RFC 4959, September 2007. 878 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 879 October 2008. 881 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 882 Protocol (XMPP): Core", RFC 6120, March 2011. 884 [RFC6819] Lodderstedt, T., McGloin, M., and P. Hunt, "OAuth 2.0 885 Threat Model and Security Considerations", RFC 6819, 886 January 2013. 888 [RFC7033] Jones, P., Salgueiro, G., Jones, M., and J. Smarr, 889 "WebFinger", RFC 7033, September 2013. 891 [RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol 892 (HTTP/1.1): Message Syntax and Routing", RFC 7230, June 893 2014. 895 Appendix A. Acknowlegements 897 The authors would like to thank the members of the Kitten working 898 group, and in addition and specifically: Simon Josefson, Torsten 899 Lodderstadt, Ryan Troll, Alexey Melnikov, Jeffrey Hutzelman, Nico 900 Williams, Matt Miller, and Benjamin Kaduk. 902 This document was produced under the chairmanship of Alexey Melnikov, 903 Tom Yu, Shawn Emery, Josh Howlett, Sam Hartman. The supervising area 904 director was Stephen Farrell. 906 Appendix B. Document History 908 [[ to be removed by RFC editor before publication as an RFC ]] 910 -23 912 o AD feedback from IESG review and comments. 914 o Fixed port number in SMTP examples. 916 o Minor editorial changes. 918 o Dyn-Reg draft becomes normative. 920 o Added explicit TLS start indicator in all examples, removed text 921 that said we assume that. 923 -19 925 o Last call feedback agaiun. 927 o Clarified usage of TLS in examples and fixed them some more. 928 Adding reference to RFC4422 and cancellation token and an example 929 for that. 931 -18 933 o Last call feedback round #5. Fixed -17 change log. 935 o Corrected "issue" to "iss", other minor changes. 937 -17 939 o Last call feedback again (WGLC #4). eradicated comma splicing. 940 Removed extra server message in example 4.3. 942 o Added recommendations for discovery and dynamic client 943 registration support. 945 -16 947 o Last call feedback again. Primarily editorial changes. Corrected 948 examples. 950 -15 952 o Last call feedack on the GS2 stuff being ripped out completely. 954 o Removed the "user" parameter and put stuff back into the 955 gs2-header. Call out that the authzid goes in the gs2-header with 956 some prose about when it might be required. Very comparable to 957 -10. 959 o Added an OAuth 1.0A example explicitly. 961 -14 963 o Last call feedack on RFC citations needed, small editorial. 965 o Added the "user" parameter back, which was pulled when we started 966 down the GS2 path. Same language as -03. 968 o Defined a stub GS2 header to make sure that when the GS2 bride is 969 defined for this that nothing will break when it actually starts 970 to get populated. 972 -13 974 o Changed affiliation. 976 -12 978 o Removed -PLUS components from the specification. 980 -11 982 o Removed GSS-API components from the specification. 984 o Updated security consideration section. 986 -10 988 o Clarifications throughout the document in response to the feedback 989 from Jeffrey Hutzelman. 991 -09 993 o Incorporated review by Alexey and Hannes. 995 o Clarified the three OAuth SASL mechanisms. 997 o Updated references 999 o Extended acknowledgements 1001 -08 1003 o Fixed the channel binding examples for p=$cbtype 1005 o More tuning of the authcid language and edited and renamed 3.2.1. 1007 -07 1009 o Struck the MUST langiage from authzid. 1011 o 1013 -06 1015 o Removed the user field. Fixed the examples again. 1017 o Added canonicalization language. 1019 o 1021 -05 1023 o Fixed the GS2 header language again. 1025 o Separated out different OAuth schemes into different SASL 1026 mechanisms. Took out the scheme in the error return. Tuned up 1027 the IANA registrations. 1029 o Added the user field back into the SASL message. 1031 o Fixed the examples (again). 1033 o 1035 -04 1037 o Changed user field to be carried in the gs2-header, and made gs2 1038 header explicit in all cases. 1040 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 1041 reference. 1043 o Changed to sending an empty client response (single control-A) as 1044 the second message of a failed sequence. 1046 o Fixed channel binding prose to refer to the normative specs and 1047 removed the hashing of large channel binding data, which brought 1048 mroe problems than it solved. 1050 o Added a SMTP examples for Bearer use case. 1052 -03 1054 o Added user field into examples and fixed egregious errors there as 1055 well. 1057 o Added text reminding developers that Authorization scheme names 1058 are case insensitive. 1060 -02 1062 o Added the user data element back in. 1064 o Minor editorial changes. 1066 -01 1068 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 1069 webfinger instead of WF and SWD older drafts. 1071 o Replacing HTTP as the message format and adjusted all examples. 1073 -00 1075 o Renamed draft into proper IETF naming format now that it's 1076 adopted. 1078 o Minor fixes. 1080 Authors' Addresses 1082 William Mills 1083 Microsoft 1085 Email: wimills@microsoft.com 1087 Tim Showalter 1089 Email: tjs@psaux.com 1091 Hannes Tschofenig 1092 ARM Ltd. 1093 110 Fulbourn Rd 1094 Cambridge CB1 9NJ 1095 Great Britain 1097 Email: Hannes.tschofenig@gmx.net 1098 URI: http://www.tschofenig.priv.at