idnits 2.17.1 draft-ietf-kitten-sasl-oauth-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 1 instance of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. -- The document date (February 24, 2013) is 4051 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC2473' is defined on line 884, but no explicit reference was found in the text == Unused Reference: 'RFC2616' is defined on line 887, but no explicit reference was found in the text == Unused Reference: 'RFC2617' is defined on line 891, but no explicit reference was found in the text == Unused Reference: 'RFC3174' is defined on line 899, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 917, but no explicit reference was found in the text == Unused Reference: 'RFC5988' is defined on line 934, but no explicit reference was found in the text == Unused Reference: 'I-D.ietf-oauth-v2-http-mac' is defined on line 965, but no explicit reference was found in the text ** Obsolete normative reference: RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) ** Obsolete normative reference: RFC 2617 (Obsoleted by RFC 7235, RFC 7615, RFC 7616, RFC 7617) ** Downref: Normative reference to an Informational RFC: RFC 3174 ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 5849 (Obsoleted by RFC 6749) ** Obsolete normative reference: RFC 5988 (Obsoleted by RFC 8288) ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) == Outdated reference: A later version (-18) exists of draft-ietf-appsawg-webfinger-10 == Outdated reference: A later version (-32) exists of draft-ietf-oauth-json-web-token-06 == Outdated reference: A later version (-05) exists of draft-ietf-oauth-v2-http-mac-02 -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 8 errors (**), 0 flaws (~~), 13 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 KITTEN W. Mills 3 Internet-Draft Yahoo! Inc. 4 Intended status: Standards Track T. Showalter 5 Expires: August 28, 2013 6 H. Tschofenig 7 Nokia Siemens Networks 8 February 24, 2013 10 A set of SASL and GSS-API Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-10.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) or the Generic Security Service Application Program Interface 23 (GSS-API) to access a protected resource at a resource serve. 24 Thereby, it enables schemes defined within the OAuth framework for 25 non-HTTP-based application protocols. 27 Clients typically store the user's long-term credential. This does, 28 however, lead to significant security vulnerabilities, for example, 29 when such a credential leaks. A significant benefit of OAuth for 30 usage in those clients is that the password is replaced by a token. 31 Tokens typically provided limited access rights and can be managed 32 and revoked separately from the user's long-term credential 33 (password). 35 Status of this Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at http://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on August 28, 2013. 51 Copyright Notice 53 Copyright (c) 2013 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (http://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 Table of Contents 68 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 69 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 7 70 3. OAuth SASL Mechanism Specifications . . . . . . . . . . . . . 8 71 3.1. Initial Client Response . . . . . . . . . . . . . . . . . 9 72 3.1.1. Reserved Key/Values . . . . . . . . . . . . . . . . . 10 73 3.1.2. Use of the gs2-header . . . . . . . . . . . . . . . . 10 74 3.2. Server's Response . . . . . . . . . . . . . . . . . . . . 10 75 3.2.1. OAuth Identifiers in the SASL Context . . . . . . . . 11 76 3.2.2. Server Response to Failed Authentication . . . . . . . 11 77 3.2.3. Completing an Error Message Sequence . . . . . . . . . 12 78 3.3. OAuth Access Token Types using Keyed Message Digests . . . 12 79 3.4. Channel Binding . . . . . . . . . . . . . . . . . . . . . 13 80 4. GSS-API OAuth Mechanism Specification . . . . . . . . . . . . 14 81 5. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 82 5.1. Successful Bearer Token Exchange . . . . . . . . . . . . . 16 83 5.2. OAuth 1.0a Authorization with Channel Binding . . . . . . 17 84 5.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 18 85 5.4. Failed Channel Binding . . . . . . . . . . . . . . . . . . 19 86 5.5. SMTP Example of a Failed Negotiation . . . . . . . . . . . 19 87 6. Security Considerations . . . . . . . . . . . . . . . . . . . 21 88 7. Internationalization Considerations . . . . . . . . . . . . . 22 89 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23 90 8.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 23 91 8.2. GSS-API Registration . . . . . . . . . . . . . . . . . . . 24 92 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 25 93 9.1. Normative References . . . . . . . . . . . . . . . . . . . 25 94 9.2. Informative References . . . . . . . . . . . . . . . . . . 26 95 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . . 28 96 Appendix B. Document History . . . . . . . . . . . . . . . . . . 29 97 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 32 99 1. Introduction 101 OAuth 1.0a [RFC5849] and OAuth 2.0 [RFC6749] are protocol frameworks 102 that enable a third-party application to obtain limited access to a 103 protected resource, either on behalf of a resource owner by 104 orchestrating an approval interaction, or by allowing the third-party 105 application to obtain access on its own behalf. 107 The core OAuth 2.0 specification [RFC6749] does not define the 108 interaction between the OAuth client and the resource server for the 109 access to a protected resource using an Access Token. Instead, this 110 functionality is described in separate specifications, such as the 111 bearer token specification [RFC6750]. OAuth 1.0a included the 112 communication between the OAuth client and the resource server in 113 [RFC5849]. 115 The main use cases for OAuth 2.0 and OAuth 1.0a have so far focused 116 on an HTTP-based environment only. This document integrates OAuth 117 1.0a and OAuth 2.0 into non-HTTP-based applications using the 118 integration into SASL and the GSS-API. Hence, this document takes 119 advantage of the OAuth protocol and its deployment base to provide a 120 way to use SASL [RFC4422] and the GSS-API [RFC2743] to gain access to 121 resources when using non-HTTP-based protocols, such as the Internet 122 Message Access Protocol (IMAP) [RFC3501] and SMTP [RFC5321], which is 123 what this memo uses in the examples. 125 To illustrate the impact of integrating this specification into an 126 OAuth-enabled application environment Figure 1 shows the abstract 127 message flow of OAuth 2.0 [RFC6749]. As indicated in the figure, 128 this document impacts the exchange of messages (E) and (F) since SASL 129 or the GSS-API is used for interaction between the client and the 130 resource server instead of HTTP. 132 ----+ 133 +--------+ +---------------+ | 134 | |--(A)-- Authorization Request --->| Resource | | 135 | | | Owner | |Plain 136 | |<-(B)------ Access Grant ---------| | |OAuth 137 | | +---------------+ |2.0 138 | | | 139 | | Client Credentials & +---------------+ | 140 | |--(C)------ Access Grant -------->| Authorization | | 141 | Client | | Server | | 142 | |<-(D)------ Access Token ---------| | | 143 | | (w/ Optional Refresh Token) +---------------+ | 144 | | ----+ 145 | | ----+ 146 | | +---------------+ | 147 | | | | |OAuth 148 | |--(E)------ Access Token -------->| Resource | |over 149 | | | Server | |SASL/ 150 | |<-(F)---- Protected Resource -----| | |GSS- 151 | | | | |API 152 +--------+ +---------------+ | 153 ----+ 155 Figure 1: OAuth 2.0 Protocol Flow 157 The Simple Authentication and Security Layer (SASL) is a framework 158 for providing authentication and data security services in 159 connection-oriented protocols via replaceable mechanisms. It 160 provides a structured interface between protocols and mechanisms. 161 The resulting framework allows new protocols to reuse existing 162 mechanisms and allows old protocols to make use of new mechanisms. 163 The framework also provides a protocol for securing subsequent 164 protocol exchanges within a data security layer. 166 The Generic Security Service Application Program Interface (GSS-API) 167 [RFC2743] provides a framework for applications to support multiple 168 authentication mechanisms through a unified interface. 170 This document defines SASL mechanisms for OAuth, and it conforms to 171 the new bridge between SASL and the GSS-API called GS2 [RFC5801]. 172 This means that this document defines both SASL and GSS-API 173 mechanisms. Implementers may be interested in either the SASL, the 174 GSS-API, or even both mechanisms. To facilitate these two variants, 175 the description has been split into two parts, one part that provides 176 normative references for those interested in the SASL OAuth mechanism 177 (see Section 3), and a second part for those implementers that wish 178 to implement the GSS-API portion (see Section 4). 180 When OAuth is integrated into SASL and the GSS-API the high-level 181 steps are as follows: 183 (A) The client requests authorization from the resource owner. 184 The authorization request can be made directly to the resource 185 owner (as shown), or preferably indirectly via the authorization 186 server as an intermediary. 188 (B) The client receives an authorization grant which is a 189 credential representing the resource owner's authorization, 190 expressed using one of four grant types defined in this 191 specification or using an extension grant type. The authorization 192 grant type depends on the method used by the client to request 193 authorization and the types supported by the authorization server. 195 (C) The client requests an access token by authenticating with the 196 authorization server and presenting the authorization grant. 198 (D) The authorization server authenticates the client and 199 validates the authorization grant, and if valid issues an access 200 token. 202 (E) The client requests the protected resource from the resource 203 server and authenticates by presenting the access token. 205 (F) The resource server validates the access token, and if valid, 206 indicates a successful authentication. 208 Again, steps (E) and (F) are not defined in [RFC6749] (but are 209 described in [RFC6750] instead) and are the main functionality 210 specified within this document. Consequently, the message exchange 211 shown in Figure 1 is the result of this specification. The client 212 will generally need to determine the authentication endpoints (and 213 perhaps the service endpoints) before the OAuth 2.0 protocol exchange 214 messages in steps (A)-(D) are executed. The discovery of the 215 resource owner and authorization server endpoints is outside the 216 scope of this specification. The client must discover those 217 endpoints using a discovery mechanisms, such as Webfinger using host- 218 meta [I-D.ietf-appsawg-webfinger]. In band discovery is not tenable 219 if clients support the OAuth 2.0 password grant. Once credentials 220 are obtained the client proceeds to steps (E) and (F) defined in this 221 specification. 223 OAuth 1.0 follows a similar model but uses a different terminology 224 and does not separate the resource server from the authorization 225 server. 227 2. Terminology 229 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 230 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 231 document are to be interpreted as described in [RFC2119]. 233 The reader is assumed to be familiar with the terms used in the OAuth 234 2.0 specification [RFC6749]. 236 In examples, "C:" and "S:" indicate lines sent by the client and 237 server respectively. Line breaks have been inserted for readability. 239 Note that the IMAP SASL specification requires base64 encoding, see 240 Section 4 of [RFC4648], not this memo. 242 3. OAuth SASL Mechanism Specifications 244 SASL is used as an authentication framework in a variety of 245 application layer protocols. This document defines the following 246 SASL mechanisms for usage with OAuth: 248 OAUTHBEARER: OAuth 2.0 bearer tokens, as described in [RFC6750]. 249 RFC 6750 uses Transport Layer Security (TLS) to secure the 250 protocol interaction between the client and the resource 251 server. 253 OAUTH10A: OAuth 1.0a MAC tokens (using the HMAC-SHA1 keyed 254 message digest), as described in Section 3.4.2 of [RFC5849]. 256 OAUTH10A-PLUS: Adds channel binding [RFC5056] capability to 257 OAUTH10A for protection against man-in-the-middle attacks. 258 OAUTH10A-PLUS mandates the usage of Transport Layer Security 259 (TLS). 261 New extensions may be defined to add additional OAuth Access Token 262 Types. Such a new SASL OAuth mechanism can be added by simply 263 registering the new name(s) and citing this specification for the 264 further definition. New channel binding enabled "-PLUS" mechanisms 265 defined in this way MUST include message integrity protection. A 266 newly defined mechanism would also need to register a new GS2 OID. 268 These mechanisms are client initiated and lock-step, the server 269 always replying to a client message. In the case where the client 270 has and correctly uses a valid token the flow is: 272 o Client sends a valid and correct initial client response. 274 o Server responds with a successful authentication. 276 In the case where authorization fails the server sends an error 277 result, then client MUST then send an additional message to the 278 server in order to allow the server to finish the exchange. Some 279 protocols and common SASL implementations do not support both sending 280 a SASL message and finalizing a SASL negotiation, the additional 281 client message in the error case deals with this problem. This 282 exchange is: 284 o Client sends an invalid initial client response. 286 o Server responds with an error message. 288 o Client sends a dummy client response. 290 o Server fails the authentication. 292 3.1. Initial Client Response 294 Client responses are a key/value pair sequence. The initial client 295 response includes a gs2-header as defined in GS2 [RFC5801], which 296 carries the authorization ID. These key/value pairs carry the 297 equivalent values from an HTTP context in order to be able to 298 complete an OAuth style HTTP authorization. Unknown key/value pairs 299 MUST be ignored by the server. The ABNF [RFC5234] syntax is: 301 kvsep = %x01 302 key = 1*ALPHA 303 value = *(VCHAR / SP / HTAB / CR / LF ) 304 kvpair = key "=" value kvsep 305 client_resp = 0*kvpair kvsep 306 ;; gs2-header = As defined in GSS-API 307 initial_client_resp = gs2-header kvsep client_resp 309 The following key/value pairs are defined in the client response: 311 auth (REQUIRED): The payload of the HTTP Authorization header for 312 an equivalent HTTP OAuth authorization. 314 host: Contains the host name to which the client connected. 316 port: Contains the port number represented as a decimal positive 317 integer string without leading zeros to which the client 318 connected. 320 qs: The HTTP query string. In non-channel binding mechanisms 321 this is reserved, the client SHOUD NOT send it, and has the 322 default value of "". In "-PLUS" variants this carries a single 323 key value pair "cbdata" for the channel binding data payload 324 formatted as an HTTP query string. 326 For OAuth token types that use keyed message digests the client MUST 327 send host and port number key/values, and the server MUST fail an 328 authorization request requiring keyed message digests that do not 329 have host and port values. In OAuth 1.0a for example, the so-called 330 "signature base string calculation" includes the reconstructed HTTP 331 URL. 333 3.1.1. Reserved Key/Values 335 In these mechanisms values for path, query string and post body are 336 assigned default values. OAuth authorization schemes MAY define 337 usage of these in the SASL context and extend this specification. 338 For OAuth Access Token Types that use request keyed message digest 339 the default values MUST be used unless explicit values are provided 340 in the client response. The following key values are reserved for 341 future use: 343 mthd (RESERVED): HTTP method, the default value is "POST". 345 path (RESERVED): HTTP path data, the default value is "/". 347 post (RESERVED): HTTP post data, the default value is "". 349 3.1.2. Use of the gs2-header 351 The OAuth scheme related mechanisms are also GSS-API mechanisms, see 352 Section 4 for further detail. The gs2-header is used as follows: 354 o The "gs2-nonstd-flag" MUST NOT be present. 356 o The "gs2-authzid" carries the authorization identity as specified 357 in [RFC5801]. If present the application MUST determine whether 358 access is granted for the identity asserted in the OAuth 359 credential, if it does not the server MUST fail the negotiation. 361 In the non "-PLUS" mechanisms the "gs2-cb-flag" MUST be set to "n" 362 because channel-binding [RFC5056] data is not expected. In the 363 OAUTH10A-PLUS mechanism (or other -PLUS variants based on this 364 specification) the "gs2-cb-flag" MUST be set appropriately by the 365 client. 367 3.2. Server's Response 369 The server validates the response per the specification for the OAuth 370 Access Token Types used. If the OAuth Access Token Type utilizes a 371 keyed message digest of the request parameters then the client must 372 provide a client response that satisfies the data requirements for 373 the scheme in use. 375 In a "-PLUS" mechanism the server examines the channel binding data, 376 extracts the channel binding unique prefix, and extracts the raw 377 channel biding data based on the channel binding type used. It then 378 computes it's own copy of the channel binding payload and compares 379 that to the payload sent by the client in the cbdata key/value. 380 Those two must be equal for channel binding to succeed. 382 The server responds to a successfully verified client message by 383 completing the SASL negotiation. The authenticated identity reported 384 by the SASL mechanism is the identity securely established for the 385 client with the OAuth credential. The application, not the SASL 386 mechanism, based on local access policy determines whether the 387 identity reported by the mechanism is allowed access to the requested 388 resource. Note that the semantics of the authz-id is specified by 389 the SASL framework [RFC4422]. 391 3.2.1. OAuth Identifiers in the SASL Context 393 In the OAuth framework the client may be authenticated by the 394 authorization server and the resource owner is authenticated to the 395 authorization server. OAuth access tokens may contain information 396 about the authentication of the resource owner and about the client 397 and may therefore make this information accessible to the resource 398 server. 400 If both identifiers are needed by an application the developer will 401 need to provide a way to communicate that from the SASL mechanism 402 back to the application, such as a GSS-API [RFC2743] named type like 403 GSS_C_NT_USER_NAME or a comparable newly defined GSS-API name type or 404 name attribute [RFC6680]. 406 3.2.2. Server Response to Failed Authentication 408 For a failed authentication the server returns a JSON [RFC4627] 409 formatted error result, and fails the authentication. The error 410 result consists of the following values: 412 status (REQUIRED): The authorization error code. Valid error 413 codes are defined in the IANA [[need registry name]] registry 414 specified in the OAuth 2 core specification. 416 scope (OPTIONAL): An OAuth scope which is valid to access the 417 service. This may be empty which implies that unscoped tokens 418 are required, or a space separated list. Use of a space 419 separated list is NOT RECOMMENDED. 421 If the resource server provides a scope then the client MUST always 422 request scoped tokens from the token endpoint. If the resource 423 server provides no scope to the client then the client SHOULD presume 424 an empty scope (unscoped token) is needed. 426 If channel binding is in use and the channel binding fails the server 427 responds with a status code set to 412 to indicate that the channel 428 binding precondition failed. If the authentication scheme in use 429 does not include signing the server SHOULD revoke the presented 430 credential and the client SHOULD discard that credential. 432 3.2.3. Completing an Error Message Sequence 434 Section 3.6 of [RFC4422] explicitly prohibits additional information 435 in an unsuccessful authentication outcome. Therefore, the error 436 message is sent in a normal message. The client MUST then send an 437 additional client response consisting of a single %x01 (control A) 438 character to the server in order to allow the server to finish the 439 exchange. 441 3.3. OAuth Access Token Types using Keyed Message Digests 443 OAuth Access Token Types may use keyed message digests and the client 444 and the resource server may need to perform a cryptographic 445 computation for integrity protection and data origin authentication. 447 OAuth is designed for access to resources identified by URIs. SASL 448 is designed for user authentication, and has no facility for more 449 fine-grained access control. In this specification we require or 450 define default values for the data elements from an HTTP request 451 which allow the signature base string to be constructed properly. 452 The default HTTP path is "/" and the default post body is empty. 453 These atoms are defined as extension points so that no changes are 454 needed if there is a revision of SASL which supports more specific 455 resource authorization, e.g., IMAP access to a specific folder or FTP 456 access limited to a specific directory. 458 Using the example in the OAuth 1.0a specification as a starting 459 point, on an IMAP server running on port 143 and given the OAuth 1.0a 460 style authorization request (with %x01 shown as ^A and line breaks 461 added for readability) below: 463 n,a=user@example.com^A 464 host=example.com^A 465 user=user@example.com^A 466 port=143^A 467 auth=OAuth realm="Example", 468 oauth_consumer_key="9djdj82h48djs9d2", 469 oauth_token="kkk9d7dh3k39sjv7", 470 oauth_signature_method="HMAC-SHA1", 471 oauth_timestamp="137131201", 472 oauth_nonce="7d8f3e4a", 473 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU%3D"^A^A 475 The signature base string would be constructed per the OAuth 1.0 476 specification [RFC5849] with the following things noted: 478 o The method value is defaulted to POST. 480 o The scheme defaults to be "http", and any port number other than 481 80 is included. 483 o The path defaults to "/". 485 o The query string defaults to "". 487 In this example the signature base string with line breaks added for 488 readability would be: 490 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 491 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 492 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 494 3.4. Channel Binding 496 The channel binding data is carried in the "qs" (query string) key 497 value pair formatted as a standard HTTP query parameter with the name 498 "cbdata". Channel binding requires that the channel binding data be 499 integrity protected end-to-end in order to protect against man-in- 500 the-middle attacks. All SASL OAuth mechanisms with a "-PLUS" postfix 501 MUST provide integrity protection. It should be noted that while the 502 OAuth 2.0 Bearer Token mandates TLS it does not create keying 503 material at the application layer and is not suitable for use with 504 channel bindings. 506 The channel binding data is computed by the client based on it's 507 choice of preferred channel binding type. As specified in [RFC5056], 508 the channel binding information MUST start with the channel binding 509 unique prefix, followed by a colon (ASCII 0x3A), followed by a base64 510 encoded channel binding payload. The channel binding payload is the 511 raw data from the channel binding type. For example, if the client 512 is using tls-unique for channel binding then the raw channel binding 513 data is the TLS finished message as specified in Section 3.1 of 514 [RFC5929]. 516 4. GSS-API OAuth Mechanism Specification 518 Note: The normative references in this section are informational for 519 SASL implementers, but they are normative for GSS-API implementers. 521 A SASL OAuth mechanism is also a GSS-API mechanism and the messages 522 described in Section 3 are the same with the following changes to the 523 GS2 related elements: 525 1. the GS2 header on the client's first message is excluded when 526 used as a GSS-API mechanism. 528 2. the initial context token header is prefixed to the client's 529 first authentication message (context token), as described in 530 Section 3.1 of RFC 2743 [RFC2743], 532 The GSS-API mechanism OIDs are: 534 o OAUTHBEARER: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 536 o OAUTH10A: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 538 o OAUTH10A-PLUS: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 540 The setting of the security context flags depends on the selected 541 mechanism: 543 o OAUTHBEARER: The mutual_state flag (GSS_C_MUTUAL_FLAG) MUST be set 544 to FALSE since the TLS protocol execution happens outside the 545 SASL/GSS-API method. Server-side authentication is accomplished 546 via the mandatory use of TLS at the application layer utilizing 547 SASL. Without TLS usage at the application layer protecting the 548 by OAuth Bearer Token this SASL method is insecure. 550 o OAUTH10A: The mutual_state flag (GSS_C_MUTUAL_FLAG) MUST be set to 551 FALSE since server authentication is not provided by this SASL/ 552 GSS-API method. Since the TLS channel is managed by the 553 application outside of the GSS-API mechanism, the OAUTH10A 554 mechanism itself is unable to confirm the name while the 555 application is able to perform this comparison for the mechanism. 556 For this reason, applications MUST match the TLS server identity 557 with the target name using the appropriate application profile, as 558 discussed in [RFC6125]. For example, when SASL OAuth is run over 559 IMAP then the IMAP profile of RFC 6125 is used. 561 o OAUTH10A-PLUS: The mutual_state flag (GSS_C_MUTUAL_FLAG) MUST be 562 set to FALSE since only the client demonstrates possession of the 563 session key by applying a keyed message digest function over 564 various fields of the request. TLS-based server-side 565 authentication MUST be provided by the application using SASL. 567 Credential delegation is not supported by any of the SASL/GSS-API 568 mechanisms with this specification. Therefore, security contexts 569 MUST have the deleg_state flag (GSS_C_DELEG_FLAG) set to FALSE. 571 OAuth mechanisms do not support per-message tokens or 572 GSS_Pseudo_random. 574 OAuth supports a standard generic name syntax for acceptors, such as 575 GSS_C_NT_HOSTBASED_SERVICE (see Section 4.1 of [RFC2743]). These 576 service names MUST be associated with the "entityID" claimed by the 577 RP. 579 OAuth mechanisms support only a single name type for initiators: 580 GSS_C_NT_USER_NAME. GSS_C_NT_USER_NAME is the default name type. 582 The query, display, and exported name syntaxes for OAuth principal 583 names are all the same. There is no OAuth-specific name syntax; 584 applications SHOULD use generic GSS-API name types, such as 585 GSS_C_NT_USER_NAME and GSS_C_NT_HOSTBASED_SERVICE (see Section 4 of 586 [RFC2743]). The exported name token does, of course, conform to 587 Section 3.2 of [RFC2743], but the "NAME" part of the token should be 588 treated as a potential input string to the OAuth name normalization 589 rules. 591 5. Examples 593 These examples illustrate exchanges between an IMAP and SMTP clients 594 and servers. 596 Note to implementers: The SASL OAuth method names are case 597 insensitive. One example uses "Bearer" but that could as easily be 598 "bearer", "BEARER", or "BeArEr". 600 5.1. Successful Bearer Token Exchange 602 This example shows a successful OAuth 2.0 bearer token exchange. 603 Note that line breaks are inserted for readability and the underlying 604 TLS establishment is not shown either. 606 S: * OK IMAP4rev1 Server Ready 607 C: t0 CAPABILITY 608 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR 609 S: t0 OK Completed 610 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 611 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 612 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 613 S: t1 OK SASL authentication succeeded 615 As required by IMAP [RFC3501], the payloads are base64-encoded. The 616 decoded initial client response (with %x01 represented as ^A and long 617 lines wrapped for readability) is: 619 n,a=user@example.com^Ahost=server.example.com^Aport=143^A 620 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 622 The same credential used in an SMTP exchange is shown below. Note 623 that line breaks are inserted for readability, and that the SMTP 624 protocol terminates lines with CR and LF characters (ASCII values 625 0x0D and 0x0A), these are not displayed explicitly in the example. 627 [connection begins] 628 S: 220 mx.example.com ESMTP 12sm2095603fks.9 629 C: EHLO sender.example.com 630 S: 250-mx.example.com at your service,[172.31.135.47] 631 S: 250-SIZE 35651584 632 S: 250-8BITMIME 633 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 634 S: 250-ENHANCEDSTATUSCODES 635 S: 250 PIPELINING 636 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 637 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 638 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 639 S: 235 Authentication successful. 640 [connection continues...] 642 5.2. OAuth 1.0a Authorization with Channel Binding 644 This example shows channel binding in the context of an OAuth 1.0a 645 request using a keyed message digest. Note that line breaks are 646 inserted for readability. 648 S: * OK [CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR] 649 IMAP4rev1 Server Ready 650 C: t1 AUTHENTICATE OAUTH10A-PLUS cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcGxlL 651 mNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoPU9BdXRoI 652 HJlYWxtPSJFeGFtcGxlIixvYXV0aF9jb25zdW1lcl9rZXk9IjlkamRqODJoNDhka 653 nM5ZDIiLG9hdXRoX3Rva2VuPSJra2s5ZDdkaDNrMzlzanY3IixvYXV0aF9zaWduY 654 XR1cmVfbWV0aG9kPSJITUFDLVNIQTEiLG9hdXRoX3RpbWVzdGFtcD0iMTM3MTMxM 655 jAxIixvYXV0aF9ub25jZT0iN2Q4ZjNlNGEiLG9hdXRoX3NpZ25hdHVyZT0iU1Nkd 656 ElHRWdiR2wwZEd4bElIUmxZU0J3YjNRdSIBcXM9Y2JkYXRhPXRscy11bmlxdWU6U 657 0c5M0lHSnBaeUJwY3lCaElGUk1VeUJtYVc1aGJDQnRaWE56WVdkbFB3bz0BAQ== 658 S: t1 OK SASL authentication succeeded 660 As required by IMAP [RFC3501], the payloads are base64-encoded. The 661 decoded initial client response (with %x01 represented as ^A and 662 lines wrapped for readability) is: 664 p=tls-unique,a=user@example.com^A 665 host=server.example.com^A 666 port=143^A 667 auth=OAuth realm="Example", 668 oauth_consumer_key="9djdj82h48djs9d2", 669 oauth_token="kkk9d7dh3k39sjv7", 670 oauth_signature_method="HMAC-SHA1", 671 oauth_timestamp="137131201", 672 oauth_nonce="7d8f3e4a", 673 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A 674 qs=cbdata=tls-unique:SG93IGJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=^A^A 676 In this example the signature base string with line breaks added for 677 readability would be: 679 POST&http%3A%2F%2Fserver.example.com:143%2F&cbdata=tls-unique:SG93I 680 GJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=%26oauth_consumer_key%3D9djd 681 j82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHM 682 AC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39s 683 jv7 685 5.3. Failed Exchange 687 This example shows a failed exchange because of the empty 688 Authorization header, which is how a client can query for the needed 689 scope. Note that line breaks are inserted for readability. 691 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 692 Ready 693 S: t0 OK Completed 694 C: t1 AUTHENTICATE OAUTHBEARER cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcG 695 xlLmNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoP 696 QFjYmRhdGE9AQE= 697 S: + ewoic3RhdHVzIjoiNDAxIgoic2NvcGUiOiJleGFtcGxlX3Njb3BlIgp9 698 C: + AQ== 699 S: t1 NO SASL authentication failed 701 The decoded initial client response is: 703 n,a=user@example.com,^Ahost=server.example.com^A 704 port=143^Aauth=^A^A 706 The decoded server error response is: 708 { 709 "status":"401", 710 "scope":"example_scope" 711 } 713 The client responds with the required dummy response. 715 5.4. Failed Channel Binding 717 This example shows a channel binding failure in an empty request. 718 The channel binding information is empty. Note that line breaks are 719 inserted for readability. 721 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 722 Ready 723 S: t0 OK Completed 724 C: t1 AUTHENTICATE OAUTH10A-PLUS cCxhPXVzZXJAZXhhbXBsZS5jb20BaG9z 725 dD1zZXJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD0BY2JkYXRhPQEB 726 S: + ewoic3RhdHVzIjoiNDEyIiwKInNjb3BlIjoiZXhhbXBsZV9zY29wZSIKfQ== 727 C: + AQ== 728 S: t1 NO SASL authentication failed 730 The decoded initial client response is: 732 p=tls-unique,a=user@example.com,^Ahost=server.example.com^A 733 port=143^Aauth=^Acbdata=^A^A 735 The decoded server response is: 737 { 738 "status":"412", 739 "scope":"example_scope" 740 } 742 The client responds with the required dummy response. 744 5.5. SMTP Example of a Failed Negotiation 746 This example shows an authorization failure in an SMTP exchange. 747 Note that line breaks are inserted for readability, and that the SMTP 748 protocol terminates lines with CR and LF characters (ASCII values 749 0x0D and 0x0A), these are not displayed explicitly in the example. 751 [connection begins] 752 S: 220 mx.example.com ESMTP 12sm2095603fks.9 753 C: EHLO sender.example.com 754 S: 250-mx.example.com at your service,[172.31.135.47] 755 S: 250-SIZE 35651584 756 S: 250-8BITMIME 757 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 758 S: 250-ENHANCEDSTATUSCODES 759 S: 250 PIPELINING 760 C: AUTH OAUTHBEARER bixhPT1zb21ldXNlckBleGFtcGxlLmNvbQFhdXRoPUJlYXJlciB2 761 RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 762 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 763 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 764 C: AQ== 765 S: 535-5.7.1 Username and Password not accepted. Learn more at 766 S: 535 5.7.1 http://support.example.com/mail/oauth 767 [connection continues...] 769 The server returned an error message in the 334 SASL message, the 770 client responds with the required dummy response, and the server 771 finalizes the negotiation. 773 6. Security Considerations 775 OAuth 1.0a and OAuth 2 allows for a variety of deployment scenarios, 776 and the security properties of these profiles vary. As shown in 777 Figure 1 this specification is aimed to be integrated into a larger 778 OAuth deployment. Application developers therefore need to 779 understand the needs of their security requirements based on a threat 780 assessment before selecting a specific SASL OAuth mechanism. For 781 OAuth 2.0 a detailed security document [RFC6819] provides guidance to 782 select those OAuth 2.0 components that help to mitigate threats for a 783 given deployment. For OAuth 1.0a Section 4 of RFC 5849 [RFC5849] 784 provides guidance specific to OAuth 1.0. 786 This document specifies three SASL and GSS-API Mechanisms for OAuth 787 and each comes with different security properties. 789 OAUTHBEARER: This mechanism borrows from OAuth 2.0 bearer tokens 790 [RFC6750]. It relies on the application using TLS to protect the 791 OAuth 2.0 Bearer Token exchange; without TLS usage at the 792 application layer this method is completely insecure. 794 OAUTH10A: This mechanism re-uses OAuth 1.0a MAC tokens (using the 795 HMAC-SHA1 keyed message digest), as described in Section 3.4.2 of 796 [RFC5849]. To compute the keyed message digest in the same way 797 was in RFC 5839 this specification conveys additional parameters 798 between the client and the server. This SASL/GSS-API mechanism 799 only supports client authentication. If server-side 800 authentication is desireable then it must be provided by the 801 application underneath the SASL/GSS-API layer. 803 OAUTH10A-PLUS: This mechanism adds the channel binding [RFC5056] 804 capability to OAUTH10A for protection against man-in-the-middle 805 attacks. OAUTH10A-PLUS mandates the usage of Transport Layer 806 Security (TLS) at the application layer. 808 7. Internationalization Considerations 810 The identifer asserted by the OAuth authorization server about the 811 resource owner inside the access token may be displayed to a human. 812 For example, when SASL is used in the context of IMAP the resource 813 server may assert the resource owner's email address to the IMAP 814 server for usage in an email-based application. The identifier may 815 therefore contain internationalized characters and an application 816 needs to ensure that the mapping between the identifier provided by 817 OAuth is suitable for use with the application layer protocol SASL is 818 incorporated into. 820 At the time of writing the standardization of the assertion format 821 (in JSON format) is still ongoing, see 822 [I-D.ietf-oauth-json-web-token]. 824 8. IANA Considerations 826 8.1. SASL Registration 828 The IANA is requested to register the following SASL profile: 830 SASL mechanism profile: OAUTHBEARER 832 Security Considerations: See this document 834 Published Specification: See this document 836 For further information: Contact the authors of this document. 838 Owner/Change controller: the IETF 840 Note: None 842 The IANA is requested to register the following SASL profile: 844 SASL mechanism profile: OAUTH10A 846 Security Considerations: See this document 848 Published Specification: See this document 850 For further information: Contact the authors of this document. 852 Owner/Change controller: the IETF 854 Note: None 856 The IANA is requested to register the following SASL profile: 858 SASL mechanism profile: OAUTH10A-PLUS 860 Security Considerations: See this document 862 Published Specification: See this document 864 For further information: Contact the authors of this document. 866 Owner/Change controller: the IETF 868 Note: None 870 8.2. GSS-API Registration 872 IANA is further requested to assign an OID for these GSS mechanisms 873 in the SMI numbers registry, with the prefix of 874 iso.org.dod.internet.security.mechanisms (1.3.6.1.5.5) and to 875 reference this specification in the registry. 877 9. References 879 9.1. Normative References 881 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 882 Requirement Levels", BCP 14, RFC 2119, March 1997. 884 [RFC2473] Conta, A. and S. Deering, "Generic Packet Tunneling in 885 IPv6 Specification", RFC 2473, December 1998. 887 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 888 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 889 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 891 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 892 Leach, P., Luotonen, A., and L. Stewart, "HTTP 893 Authentication: Basic and Digest Access Authentication", 894 RFC 2617, June 1999. 896 [RFC2743] Linn, J., "Generic Security Service Application Program 897 Interface Version 2, Update 1", RFC 2743, January 2000. 899 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 900 (SHA1)", RFC 3174, September 2001. 902 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 903 Security Layer (SASL)", RFC 4422, June 2006. 905 [RFC4627] Crockford, D., "The application/json Media Type for 906 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 908 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 909 Encodings", RFC 4648, October 2006. 911 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 912 Channels", RFC 5056, November 2007. 914 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 915 Specifications: ABNF", STD 68, RFC 5234, January 2008. 917 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 918 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 920 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 921 October 2008. 923 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 924 Service Application Program Interface (GSS-API) Mechanisms 925 in Simple Authentication and Security Layer (SASL): The 926 GS2 Mechanism Family", RFC 5801, July 2010. 928 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 929 April 2010. 931 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 932 for TLS", RFC 5929, July 2010. 934 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 936 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 937 Verification of Domain-Based Application Service Identity 938 within Internet Public Key Infrastructure Using X.509 939 (PKIX) Certificates in the Context of Transport Layer 940 Security (TLS)", RFC 6125, March 2011. 942 [RFC6680] Williams, N., Johansson, L., Hartman, S., and S. 943 Josefsson, "Generic Security Service Application 944 Programming Interface (GSS-API) Naming Extensions", 945 RFC 6680, August 2012. 947 [RFC6749] Hardt, D., "The OAuth 2.0 Authorization Framework", 948 RFC 6749, October 2012. 950 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 951 Framework: Bearer Token Usage", RFC 6750, October 2012. 953 9.2. Informative References 955 [I-D.ietf-appsawg-webfinger] 956 Jones, P., Salgueiro, G., and J. Smarr, "WebFinger", 957 draft-ietf-appsawg-webfinger-10 (work in progress), 958 February 2013. 960 [I-D.ietf-oauth-json-web-token] 961 Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 962 (JWT)", draft-ietf-oauth-json-web-token-06 (work in 963 progress), December 2012. 965 [I-D.ietf-oauth-v2-http-mac] 966 Richer, J., Mills, W., and H. Tschofenig, "OAuth 2.0 967 Message Authentication Code (MAC) Tokens", 968 draft-ietf-oauth-v2-http-mac-02 (work in progress), 969 November 2012. 971 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 972 4rev1", RFC 3501, March 2003. 974 [RFC6819] Lodderstedt, T., McGloin, M., and P. Hunt, "OAuth 2.0 975 Threat Model and Security Considerations", RFC 6819, 976 January 2013. 978 Appendix A. Acknowlegements 980 The authors would like to thank the members of the Kitten working 981 group, and in addition and specifically: Simon Josefson, Torsten 982 Lodderstadt, Ryan Troll, Alexey Melnikov, Jeffrey Hutzelman, and Nico 983 Williams. 985 This document was produced under the chairmanship of Alexey Melnikov, 986 Tom Yu, Shawn Emery, Josh Howlett, Sam Hartman. The supervising area 987 directors was Stephen Farrell. 989 Appendix B. Document History 991 [[ to be removed by RFC editor before publication as an RFC ]] 993 -10 995 o Clarifications throughout the document in response to the feedback 996 from Jeffrey Hutzelman. 998 -09 1000 o Incorporated review by Alexey and Hannes. 1002 o Clarified the three OAuth SASL mechanisms. 1004 o Updated references 1006 o Extended acknowledgements 1008 -08 1010 o Fixed the channel binding examples for p=$cbtype 1012 o More tuning of the authcid language and edited and renamed 3.2.1. 1014 -07 1016 o Struck the MUST langiage from authzid. 1018 o 1020 -06 1022 o Removed the user field. Fixed the examples again. 1024 o Added canonicalization language. 1026 o 1028 -05 1030 o Fixed the GS2 header language again. 1032 o Separated out different OAuth schemes into different SASL 1033 mechanisms. Took out the scheme in the error return. Tuned up 1034 the IANA registrations. 1036 o Added the user field back into the SASL message. 1038 o Fixed the examples (again). 1040 o 1042 -04 1044 o Changed user field to be carried in the gs2-header, and made gs2 1045 header explicit in all cases. 1047 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 1048 reference. 1050 o Changed to sending an empty client response (single control-A) as 1051 the second message of a failed sequence. 1053 o Fixed channel binding prose to refer to the normative specs and 1054 removed the hashing of large channel binding data, which brought 1055 mroe problems than it solved. 1057 o Added a SMTP examples for Bearer use case. 1059 -03 1061 o Added user field into examples and fixed egregious errors there as 1062 well. 1064 o Added text reminding developers that Authorization scheme names 1065 are case insensitive. 1067 -02 1069 o Added the user data element back in. 1071 o Minor editorial changes. 1073 -01 1075 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 1076 webfinger instead of WF and SWD older drafts. 1078 o Replacing HTTP as the message format and adjusted all examples. 1080 -00 1081 o Renamed draft into proper IETF naming format now that it's 1082 adopted. 1084 o Minor fixes. 1086 Authors' Addresses 1088 William Mills 1089 Yahoo! Inc. 1091 Phone: 1092 Email: wmills@yahoo-inc.com 1094 Tim Showalter 1096 Phone: 1097 Email: tjs@psaux.com 1099 Hannes Tschofenig 1100 Nokia Siemens Networks 1101 Linnoitustie 6 1102 Espoo 02600 1103 Finland 1105 Phone: +358 (50) 4871445 1106 Email: Hannes.Tschofenig@gmx.net 1107 URI: http://www.tschofenig.priv.at