idnits 2.17.1 draft-ietf-kitten-sasl-oauth-05.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 (August 23, 2012) is 4264 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: 'RFC2616' is defined on line 857, but no explicit reference was found in the text == Unused Reference: 'RFC2617' is defined on line 861, but no explicit reference was found in the text == Unused Reference: 'RFC3174' is defined on line 869, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 884, but no explicit reference was found in the text == Unused Reference: 'RFC5988' is defined on line 901, 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 (-05) exists of draft-ietf-oauth-v2-http-mac-01 -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) Summary: 8 errors (**), 0 flaws (~~), 9 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: February 24, 2013 6 H. Tschofenig 7 Nokia Siemens Networks 8 August 23, 2012 10 A set of SASL and GSS-API Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-05 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 February 24, 2013. 51 Copyright Notice 53 Copyright (c) 2012 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 Specification . . . . . . . . . . . . . . 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. Mapping to SASL Identities . . . . . . . . . . . . . . 11 76 3.2.2. Server response to failed authentication. . . . . . . 11 77 3.2.3. Completing an error message sequence. . . . . . . . . 12 78 3.3. Use of Signature Type Authorization . . . . . . . . . . . 12 79 3.4. Channel Binding . . . . . . . . . . . . . . . . . . . . . 13 80 4. GSS-API OAuth Mechanism Specification . . . . . . . . . . . . 14 81 5. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 82 5.1. Successful Bearer Token Exchange . . . . . . . . . . . . . 15 83 5.2. OAuth 1.0a Authorization with Channel Binding . . . . . . 16 84 5.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 17 85 5.4. Failed Channel Binding . . . . . . . . . . . . . . . . . . 18 86 5.5. SMTP Example of a failed negotiation. . . . . . . . . . . 18 87 6. Security Considerations . . . . . . . . . . . . . . . . . . . 20 88 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 89 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 21 90 7.2. GSS-API Registration . . . . . . . . . . . . . . . . . . . 22 91 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 23 92 8.1. Normative References . . . . . . . . . . . . . . . . . . . 23 93 8.2. Informative References . . . . . . . . . . . . . . . . . . 24 94 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . . 25 95 Appendix B. Document History . . . . . . . . . . . . . . . . . . 26 96 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 28 98 1. Introduction 100 OAuth [I-D.ietf-oauth-v2] enables a third-party application to obtain 101 limited access to a protected resource, either on behalf of a 102 resource owner by orchestrating an approval interaction, or by 103 allowing the third-party application to obtain access on its own 104 behalf. The core OAuth specification [I-D.ietf-oauth-v2] does not 105 define the interaction between the client and the resource server 106 with the access to a protected resource using an Access Token. This 107 functionality is described in separate specifications, for example 108 [I-D.ietf-oauth-v2-bearer], [I-D.ietf-oauth-v2-http-mac], and OAuth 109 1.0a [RFC5849] where the focus is on an HTTP-based environment only. 111 Figure 1 shows the abstract message flow as shown in Figure 1 of 112 [I-D.ietf-oauth-v2]. 114 +--------+ +---------------+ 115 | |--(A)- Authorization Request ->| Resource | 116 | | | Owner | 117 | |<-(B)-- Authorization Grant ---| | 118 | | +---------------+ 119 | | 120 | | +---------------+ 121 | |--(C)-- Authorization Grant -->| Authorization | 122 | Client | | Server | 123 | |<-(D)----- Access Token -------| | 124 | | +---------------+ 125 | | 126 | | +---h------------+ 127 | |--(E)----- Access Token ------>| Resource | 128 | | | Server | 129 | |<-(F)--- Protected Resource ---| | 130 +--------+ +---------------+ 132 Figure 1: Abstract OAuth 2.0 Protocol Flow 134 This document takes advantage of the OAuth protocol and its 135 deployment base to provide a way to use SASL [RFC4422] as well as the 136 GSS-API [RFC2743] to gain access to resources when using non-HTTP- 137 based protocols, such as the Internet Message Access Protocol (IMAP) 138 [RFC3501] and SMTP [RFC5321], which is what this memo uses in the 139 examples. 141 The Simple Authentication and Security Layer (SASL) is a framework 142 for providing authentication and data security services in 143 connection-oriented protocols via replaceable mechanisms. It 144 provides a structured interface between protocols and mechanisms. 146 The resulting framework allows new protocols to reuse existing 147 mechanisms and allows old protocols to make use of new mechanisms. 148 The framework also provides a protocol for securing subsequent 149 protocol exchanges within a data security layer. 151 The Generic Security Service Application Program Interface (GSS-API) 152 [RFC2743] provides a framework for applications to support multiple 153 authentication mechanisms through a unified interface. 155 This document defines SASL mechanisms for OAuth, and it conforms to 156 the new bridge between SASL and the GSS-API called GS2 [RFC5801]. 157 This means that this document defines both SASL and GSS-API 158 mechanisms. Implementers may be interested in either the SASL, the 159 GSS-API, or even both mechanisms. To faciliate these two variants, 160 the description has been split into two parts, one part that provides 161 normative references for those interested in the SASL OAuth mechanism 162 (see Section 3), and a second part for those implementers that wish 163 to implement the GSS-API portion (see Section 4). 165 When OAuth is integrated into SASL and the GSS-API the high-level 166 steps are as follows: 168 (A) The client requests authorization from the resource owner. 169 The authorization request can be made directly to the resource 170 owner (as shown), or preferably indirectly via the authorization 171 server as an intermediary. 173 (B) The client receives an authorization grant which is a 174 credential representing the resource owner's authorization, 175 expressed using one of four grant types defined in this 176 specification or using an extension grant type. The authorization 177 grant type depends on the method used by the client to request 178 authorization and the types supported by the authorization server. 180 (C) The client requests an access token by authenticating with the 181 authorization server and presenting the authorization grant. 183 (D) The authorization server authenticates the client and 184 validates the authorization grant, and if valid issues an access 185 token. 187 (E) The client requests the protected resource from the resource 188 server and authenticates by presenting the access token. 190 (F) The resource server validates the access token, and if valid, 191 indicates a successful authentication. 193 Steps (E) and (F) are not defined in [I-D.ietf-oauth-v2] and are the 194 main functionality specified within this document. Consequently, the 195 message exchange shown in Figure 2 is the result of this 196 specification. The client will genrally need to determine the 197 authentication endpoints (and perhaps the service endpoints) before 198 the OAuth 2.0 protocol exchange messages in steps (A)-(D) are 199 executed. The discovery of the resource owner and authorization 200 server endpoints is outside the scope of this specification. The 201 client must discover those endpoints using a discovery mechanisms 202 such as Webfinger using host-meta [I-D.jones-appsawg-webfinger]. In 203 band discovery is not tenable if clients support the OAuth 2.0 204 password grant. Once credentials are obtained the client proceeds to 205 steps (E) and (F) defined in this specification. 207 ----+ 208 +--------+ +---------------+ | 209 | |--(A)-- Authorization Request --->| Resource | | 210 | | | Owner | |Plain 211 | |<-(B)------ Access Grant ---------| | |OAuth 212 | | +---------------+ |2.0 213 | | | 214 | | Client Credentials & +---------------+ | 215 | |--(C)------ Access Grant -------->| Authorization | | 216 | Client | | Server | | 217 | |<-(D)------ Access Token ---------| | | 218 | | (w/ Optional Refresh Token) +---------------+ | 219 | | ----+ 220 | | ----+ 221 | | +---------------+ | 222 | | | | |OAuth 223 | |--(E)------ Access Token -------->| Resource | |over 224 | | | Server | |SASL/ 225 | |<-(F)---- Protected Resource -----| | |GSS- 226 | | | | |API 227 +--------+ +---------------+ | 228 ----+ 230 Figure 2: OAuth SASL Architecture 232 2. Terminology 234 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 235 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 236 document are to be interpreted as described in [RFC2119]. 238 The reader is assumed to be familiar with the terms used in the OAuth 239 2.0 specification [I-D.ietf-oauth-v2]. 241 In examples, "C:" and "S:" indicate lines sent by the client and 242 server respectively. Line breaks have been inserted for readability. 244 Note that the IMAP SASL specification requires base64 encoding 245 message, not this memo. 247 3. OAuth SASL Mechanism Specification 249 SASL is used as a generalized authentication method in a variety of 250 application layer protocols. This document defines the following 251 SASL mechanisms for usage with OAuth: 253 OAUTHBEARER Authorization using Bearer tokens. 255 OAUTH10A Authorization using OAuth 1.0a tokens. 257 OAUTH10A-PLUS Adds channel binding [RFC5056] capability to 258 OAUTH10A for additional security guarantees. 260 Any new OAuth token scheme MAY define a new SASL mechanism compatible 261 with the mechanisms defined here by simply registering the new 262 name(s) and citing this specification for the further definition. 263 New channel binding enabled "-PLUS" mechanisms defined in this way 264 MUST include message integrity protection. 266 These mechanisms are client initiated and lock-step, the server 267 always replying to a client message. In the case where the client 268 has and correctly uses a valid token the flow is: 270 o Client sends a valid and correct initial client response. 272 o Server responds with a successful authentication. 274 In the case where authorization fails the server sends an error 275 result, then client MUST then send an additional message to the 276 server in order to allow the server to finish the exchange. Some 277 protocols and common SASL implementations do not support both sending 278 a SASL message and finalizing a SASL negotiation, the additional 279 client message in the error case deals with this problem. This 280 exchange is: 282 o Client sends an invalid initial client response. 284 o Server responds with an error message. 286 o Client sends an empty client reponse. 288 o Server fails the authentication. 290 3.1. Initial Client Response 292 Client responses are a key/value pair sequence. The initial client 293 response includes a gs2-header as defined in GS2 [RFC5801], which 294 carries the authorization ID. These key/value pairs carry the 295 equivalent values from an HTTP context in order to be able to 296 complete an OAuth style HTTP authorization. The client MUST send an 297 authorization ID in the gs2-header. The ABNF [RFC5234] syntax is: 299 kvsep = %x01 300 key = 1*ALPHA 301 value = *(VCHAR | SP | HTAB | CR | LF ) 302 kvpair = key "=" value kvsep 303 client_resp = 0*kvpair kvsep 304 ;; gs2-header = As defined in GSS-API 305 initial_client_resp = gs2-header kvsep client_resp 307 The following key/value pairs are defined in the client response: 309 auth (REQUIRED): The payload of the HTTP Authorization header for 310 an equivalent HTTP OAuth authroization. 312 user (REQUIRED): The authorization ID. The server MAY use this 313 as a routing or database lookup hint. The server MUST NOT use 314 this as authoritative, the user name MUST be asserted by the 315 OAuth credential. 317 host: Contains the host name to which the client connected. 319 port: Contains the port number represented as a decimal positive 320 integer string without leading zeros to which the client 321 connected. 323 qs: The HTTP query string. In non-channel binding mechanisms 324 this is reserved, the client SHOUD NOT send it, and has the 325 default value of "". In "-PLUS" variants this carries a single 326 key value pair "cbdata" for the channel binding data payload 327 formatted as an HTTP query string. 329 In authorization schemes that use signatures, the client MUST send 330 host and port number key/values, and the server MUST fail an 331 authorization request requiring signatures that does not have host 332 and port values. For authorization schemes that require a URI scheme 333 as part of the data being signed "http" is always used. In OAuth 334 1.0a for example, the signature base string includes the 335 reconstructed HTTP URL. 337 3.1.1. Reserved Key/Values 339 In these mechanisms values for path, query string and post body are 340 assigned default values. OAuth authorization schemes MAY define 341 usage of these in the SASL context and extend this specification. 342 For OAuth schemes that use request signatures the default values MUST 343 be used unless explict values are provided in the client response. 344 The following key values are reserved for future use: 346 mthd (RESERVED): HTTP method for use in signatures, the default 347 value is "POST". 349 path (RESERVED): HTTP path data, the default value is "/". 351 post (RESERVED): HTTP post data, the default value is "". 353 3.1.2. Use of the gs2-header 355 The OAuth scheme related mechanisms are also GSS-API mechanisms, see 356 Section 4 for further detail. The gs2-header is used as follows: 358 o The "gs2-nonstd-flag" MUST NOT be present. 360 o The "gs2-authzid" carries the authorization identity as specified 361 in [RFC5801]. 363 In the non "-PLUS" mechanisms the "gs2-cb-flag" MUST be set to "n" 364 because channel-binding [RFC5056] data is not expected. In the 365 OAUTH10A-PLUS mechanism (or other -PLUS variants based on this 366 specification) the "gs2-cb-flag" MUST be set appropriately by the 367 client. 369 3.2. Server's Response 371 The server validates the response per the specification for the 372 authorization scheme used. If the authorization scheme used includes 373 signing of the request parameters the client must provide a client 374 response that satisfies the data requirements for the scheme in use. 376 In a "-PLUS" mechanism the server examines the channel binding data, 377 extracts the channel binding unique prefix, and extracts the raw 378 channel biding data based on the channel binding type used. It then 379 computes it's own copy of the channel binding payload and compares 380 that to the payload sent by the client in the cbdata key/value. 381 Those two must be equal for channel binding to succeed. 383 The server responds to a successfully verified client message by 384 completing the SASL negotiation. The authorization scheme MUST carry 385 the user ID to be used as the authorization identity (identity to act 386 as). The server MUST use the ID obtained from the credential as the 387 user being authorized. 389 3.2.1. Mapping to SASL Identities 391 Some OAuth mechanisms can provide both an authorization identity and 392 an authentication identity. An example of this is OAuth 1.0a 393 [RFC5849] where the consumer key (oauth_consumer_key) identifies the 394 entity using the token which equates to the SASL authentication 395 identity, and is authenticated using the shared secret. The 396 authorization identity in the OAuth 1.0a case is carried in the token 397 (per the requirement above), which SHOULD be validated independently. 398 The server MAY use a consumer key, a value derived from it, or other 399 comparable identity in the OAuth authorization scheme as the SASL 400 authentication identity. If an appropriate authentication identity 401 is not available the server MUST use the authorization identity as 402 the authentication identity. 404 3.2.2. Server response to failed authentication. 406 For a failed authentication the server returns a JSON [RFC4627] 407 formatted error result, and fails the authentication. The error 408 result consists of the following values: 410 status (REQUIRED): The authorization error code. Valid error 411 codes are defined in the IANA [[need registry name]] registry 412 specified in the OAuth 2 core specification. 414 scope (OPTIONAL): An OAuth scope which is valid to access the 415 service. This may be empty which implies that unscoped tokens 416 are required, or a space separated list. Use of a space 417 separated list is NOT RECOMMENDED. 419 If the resource server provides a scope the client SHOULD always 420 request scoped tokens from the token endpoint. The client MAY use a 421 scope other than the one provided by the resource server. Scopes 422 other than those advertised by the resource server are be defined by 423 the resource owner and provided in service documentation or discovery 424 information (which is beyond the scope of this memo). If not present 425 then the client SHOULD presume an empty scope (unscoped token) is 426 needed. 428 If channel binding is in use and the channel binding fails the server 429 responds with a status code set to 412 to indicate that the channel 430 binding precondition failed. If the authentication scheme in use 431 does not include signing the server SHOULD revoke the presented 432 credential and the client SHOULD discard that credential. 434 3.2.3. Completing an error message sequence. 436 If the client gets an error message from the server it MUST send an 437 empty client response consisting of a single %x01 (control A) 438 character, which is a correctly formatted client response with no 439 key/value pairs. The server then completes the SASL negotiation with 440 a failure result. 442 3.3. Use of Signature Type Authorization 444 This mechanism supports authorization using signatures, which 445 requires that both client and server construct the string to be 446 signed. OAuth 2 is designed for authentication/authorization to 447 access specific URIs. SASL is designed for user authentication, and 448 has no facility for being more specific. In this mechanism we 449 require or define default values for the data elements from an HTTP 450 request which allow the signature base string to be constructed 451 properly. The default HTTP path is "/" and the default post body is 452 empty. These atoms are defined as extension points so that no 453 changes are needed if there is a revision of SASL which supports more 454 specific resource authorization, e.g. IMAP access to a specific 455 folder or FTP access limited to a specific directory. 457 Using the example in the OAuth 1.0a specification as a starting 458 point, on an IMAP server running on port 143 and given the OAuth 1.0a 459 style authorization request (with %x01 shown as ^A and line breaks 460 added for readability) below: 462 n,a=user@example.com,^A 463 host=example.com^A 464 user=user@example.com^A 465 port=143^A 466 auth=OAuth realm="Example", 467 oauth_consumer_key="9djdj82h48djs9d2", 468 oauth_token="kkk9d7dh3k39sjv7", 469 oauth_signature_method="HMAC-SHA1", 470 oauth_timestamp="137131201", 471 oauth_nonce="7d8f3e4a", 472 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU%3D"^A^A 474 The signature base string would be constructed per the OAuth 1.0 475 specification [RFC5849] with the following things noted: 477 o The method value is defaulted to POST. 479 o The scheme defaults to be "http", and any port number other than 480 80 is included. 482 o The path defaults to "/". 484 o The query string defaults to "". 486 In this example the signature base string with line breaks added for 487 readability would be: 489 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 490 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 491 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 493 3.4. Channel Binding 495 The channel binding data is carried in the "qs" (query string) key 496 value pair formatted as a standard HTTP query parameter with the name 497 "cbdata". Channel binding requires that the channel binding data be 498 integrity protected end-to-end in order to protect against man-in- 499 the-middle attacks. All authorization schemes offered with "-PLUS" 500 mechanisms MUST provide integrity protection. It should be noted 501 that while the Bearer token scheme specifies SSL for normal usage it 502 offers no integrity protection and is not suitable for use with 503 channel binding. 505 The channel binding data is computed by the client based on it's 506 choice of preferred channel binding type. As specified in [RFC5056], 507 the channel binding information MUST start with the channel binding 508 unique prefix, followed by a colon (ASCII 0x3A), followed by a base64 509 encoded channel binding payload. The channel binding payload is the 510 raw data from the channel binding type. For example, if the client 511 is using tls-unique for channel binding then the raw channel binding 512 data is the TLS finished message as specified in section 3.1 of 513 [RFC5929]. 515 4. GSS-API OAuth Mechanism Specification 517 Note: The normative references in this section are informational for 518 SASL implementers, but they are normative for GSS-API implementers. 520 The SASL OAuth mechanism is also a GSS-API mechanism and the messages 521 described in Section 3 are the same with the following changes to the 522 GS2 related elements: 524 1. the GS2 header on the client's first message and the following 525 %x01 (control A) are excluded when used as a GSS-API mechanism. 527 2. the initial context token header is prefixed to the client's 528 first authentication message (context token), as described in 529 Section 3.1 of RFC 2743, 531 The GSS-API mechanism OID for OAuth is [[TBD: IANA]]. 533 OAuth security contexts always have the mutual_state flag 534 (GSS_C_MUTUAL_FLAG) set to TRUE. OAuth supports credential 535 delegation, therefore security contexts may have the deleg_state flag 536 (GSS_C_DELEG_FLAG) set to either TRUE or FALSE. 538 The mutual authentication property of this mechanism relies on 539 successfully comparing the TLS server identity with the negotiated 540 target name. Since the TLS channel is managed by the application 541 outside of the GSS-API mechanism, the mechanism itself is unable to 542 confirm the name while the application is able to perform this 543 comparison for the mechanism. For this reason, applications MUST 544 match the TLS server identity with the target name, as discussed in 545 [RFC6125]. 547 The OAuth mechanism does not support per-message tokens or 548 GSS_Pseudo_random. 550 OAuth supports a standard generic name syntax for acceptors, such as 551 GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], Section 4.1). These 552 service names MUST be associated with the "entityID" claimed by the 553 RP. OAuth supports only a single name type for initiators: 554 GSS_C_NT_USER_NAME. GSS_C_NT_USER_NAME is the default name type. 555 The query, display, and exported name syntaxes for OAuth principal 556 names are all the same. There is no OAuth-specific name syntax; 557 applications SHOULD use generic GSS-API name types, such as 558 GSS_C_NT_USER_NAME and GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], 559 Section 4). The exported name token does, of course, conform to 560 [RFC2743], Section 3.2, but the "NAME" part of the token should be 561 treated as a potential input string to the OAuth name normalization 562 rules. 564 5. Examples 566 These example illustrate exchanges between an IMAP client and an IMAP 567 server. 569 Note to implementers: Authorization scheme names are case 570 insensitive. One example uses "Bearer" but that could as easily be 571 "bearer", "BEARER", or "BeArEr". 573 5.1. Successful Bearer Token Exchange 575 This example shows a successful OAuth 2.0 bearer token exchange. 576 Note that line breaks are inserted for readability. 578 S: * IMAP4rev1 Server Ready 579 C: t0 CAPABILITY 580 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER 581 S: t0 OK Completed 582 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 583 J2ZXIuZXhhbXBsZS5jb20BdXNlcj11c2VyQGV4YW1wbGUuY29tAXBvcnQ9MTQzA 584 WF1dGg9QmVhcmVyIHZGOWRmdDRxbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZ 585 Mjl0Q2c9PQEB 586 S: t1 OK SASL authentication succeeded 588 As required by IMAP [RFC3501], the payloads are base64-encoded. The 589 decoded initial client response (with %x01 represented as ^A and long 590 lines wrapped for readability) is: 592 n,a=user@example.com^Ahost=server.example.com^Auser=user@example.com^A 593 port=143^Aauth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 595 The same credential used in an SMTP exchange is shown below. Note 596 that line breaks are inserted for readability, and that the SMTP 597 protocol terminates lines with CR and LF characters (ASCII values 598 0x0D and 0x0A), these are not displayed explicitly in the example. 600 [connection begins] 601 S: 220 mx.example.com ESMTP 12sm2095603fks.9 602 C: EHLO sender.example.com 603 S: 250-mx.example.com at your service,[172.31.135.47] 604 S: 250-SIZE 35651584 605 S: 250-8BITMIME 606 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 607 S: 250-ENHANCEDSTATUSCODES 608 S: 250-PIPELINING 609 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 610 J2ZXIuZXhhbXBsZS5jb20BdXNlcj11c2VyQGV4YW1wbGUuY29tAXBvcnQ9MTQzA 611 WF1dGg9QmVhcmVyIHZGOWRmdDRxbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZ 612 Mjl0Q2c9PQEB 613 S: 235 Authentication successful. 614 [connection continues...] 616 5.2. OAuth 1.0a Authorization with Channel Binding 618 This example shows channel binding in the context of an OAuth 1.0a 619 signed authorization request. Note that line breaks are inserted for 620 readability. 622 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 623 Ready 624 S: t0 OK Completed 625 C: t1 AUTHENTICATE OAUTH10A-PLUS eSxhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZ 626 XJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1PQXV0aCByZWFsbT0iRXhhb 627 XBsZSIsb2F1dGhfY29uc3VtZXJfa2V5PSI5ZGpkajgyaDQ4ZGpzOWQyIixvYXV0a 628 F90b2tlbj0ia2trOWQ3ZGgzazM5c2p2NyIsb2F1dGhfc2lnbmF0dXJlX21ldGhvZ 629 D0iSE1BQy1TSEExIixvYXV0aF90aW1lc3RhbXA9IjEzNzEzMTIwMSIsb2F1dGhfb 630 m9uY2U9IjdkOGYzZTRhIixvYXV0aF9zaWduYXR1cmU9IlNTZHRJR0VnYkdsMGRHe 631 GxJSFJsWVNCd2IzUXUiAXFzPWNiZGF0YT10bHMtdW5pcXVlOlNHOTNJR0pwWnlCc 632 GN5QmhJRlJNVXlCbWFXNWhiQ0J0WlhOellXZGxQd289AQE= 633 S: t1 OK SASL authentication succeeded 635 As required by IMAP [RFC3501], the payloads are base64-encoded. The 636 decoded initial client response (with %x01 represented as ^A and 637 lines wrapped for readability) is: 639 y,a=user@example.com^A 640 host=server.example.com^A 641 user=user@example.com^A 642 port=143^A 643 auth=OAuth realm="Example", 644 oauth_consumer_key="9djdj82h48djs9d2", 645 oauth_token="kkk9d7dh3k39sjv7", 646 oauth_signature_method="HMAC-SHA1", 647 oauth_timestamp="137131201", 648 oauth_nonce="7d8f3e4a", 649 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A 650 qs=cbdata=tls-unique:SG93IGJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=^A^A 652 In this example the signature base string with line breaks added for 653 readability would be: 655 POST&http%3A%2F%2Fserver.example.com:143%2F&cbdata=tls-unique:SG93I 656 GJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=%26oauth_consumer_key%3D9djd 657 j82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHM 658 AC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39s 659 jv7 661 5.3. Failed Exchange 663 This example shows a failed exchange because of the empty 664 Authorization header, which is how a client can query for the needed 665 scope. Note that line breaks are inserted for readability. 667 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 668 Ready 669 S: t0 OK Completed 670 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD 671 1zZXJ2ZXIuZXhhbXBsZS5jb20BdXNlcj11c2VyQGV4YW1wbGUuY29tAXBvc 672 nQ9MTQzAWF1dGg9AQE= 673 S: + ewoic3RhdHVzIjoiNDAxIgoic2NvcGUiOiJleGFtcGxlX3Njb3BlIgp9 674 C: + AQ== 675 S: t1 NO SASL authentication failed 677 The decoded initial client response is: 679 n,a=user@example.com,^Ahost=server.example.com^Auser=user@example. 680 com^Aport=143^Aauth=^A^A 682 The decoded server error response is: 684 { 685 "status":"401", 686 "scope":"example_scope" 687 } 689 The client responds with the required empty response. 691 5.4. Failed Channel Binding 693 This example shows a channel binding failure in an empty request. 694 The channel binding information is empty. Note that line breaks are 695 inserted for readability. 697 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 698 Ready 699 S: t0 OK Completed 700 C: t1 AUTHENTICATE OAUTH10A-PLUS eSxhPXVzZXJAZXhhbXBsZS5jb20sAWhv 701 c3Q9c2VydmVyLmV4YW1wbGUuY29tAXVzZXI9dXNlckBleGFtcGxlLmNvbQF 702 wb3J0PTE0MwFhdXRoPQFjYmRhdGE9AQE= 703 S: + ewoic3RhdHVzIjoiNDEyIiwKInNjb3BlIjoiZXhhbXBsZV9zY29wZSIKfQ== 704 C: + AQ== 705 S: t1 NO SASL authentication failed 707 The decoded initial client response is: 709 y,a=user@example.com,^Ahost=server.example.com^A 710 user=user@example.com^Aport=143^Aauth=^Acbdata=^A^A 712 The decoded server response is: 714 { 715 "status":"412", 716 "scope":"example_scope" 717 } 719 The client responds with the required empty response. 721 5.5. SMTP Example of a failed negotiation. 723 This example shows an authorization failure in an SMTP exchange. 724 Note that line breaks are inserted for readability, and that the SMTP 725 protocol terminates lines with CR and LF characters (ASCII values 726 0x0D and 0x0A), these are not displayed explicitly in the example. 728 [connection begins] 729 S: 220 mx.example.com ESMTP 12sm2095603fks.9 730 C: EHLO sender.example.com 731 S: 250-mx.example.com at your service,[172.31.135.47] 732 S: 250-SIZE 35651584 733 S: 250-8BITMIME 734 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 735 S: 250-ENHANCEDSTATUSCODES 736 S: 250-PIPELINING 737 C: AUTH OAUTHBEARER dXNlcj1zb21ldXNlckBleGFtcGxlLmNvbQFhdXRoPUJlYXJlciB2 738 RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQo= 739 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 740 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 741 C: AQ== 742 S: 535-5.7.1 Username and Password not accepted. Learn more at 743 S: 535 5.7.1 http://support.example.com/mail/oauth 744 [connection continues...] 746 The server returned an error message in the 334 SASL message, the 747 client responds with the required empty response, and the server 748 finalizes the negotiation. 750 6. Security Considerations 752 This mechanism does not provide a security layer, but does provide a 753 provision for channel binding. The OAuth 2 specification 754 [I-D.ietf-oauth-v2] allows for a variety of usages, and the security 755 properties of these profiles vary. The usage of bearer tokens, for 756 example, provide security features similar to cookies. Applications 757 using this mechanism SHOULD exercise the same level of care using 758 this mechanism as they would in using the SASL PLAIN mechanism. In 759 particular, TLS 1.2 or an equivalent secure channel MUST be 760 implemented and its usage is RECOMMENDED. 762 The channel binding in this mechanism has different properties based 763 on the authentication scheme used. The integrity guarantee for 764 channel binding depends on the quality of the guarantee in the the 765 authorization scheme. 767 It is possible that SASL will be authenticating a connection and the 768 life of that connection may outlast the life of the token used to 769 authenticate it. This is a common problem in application protocols 770 where connections are long-lived, and not a problem with this 771 mechanism per se. Servers MAY unilaterally disconnect clients in 772 accordance with the application protocol. 774 An OAuth credential is not equivalent to the password or primary 775 account credential. There are protocols like XMPP that allow actions 776 like change password. The server SHOULD ensure that actions taken in 777 the authenticated channel are appropriate to the strength of the 778 presented credential. 780 Tokens have a lifetime associated with them. Reducing the lifetime 781 of a token provides security benefits in the case that tokens leak. 782 In addition a previously obtained token MAY be revoked or rendered 783 invalid at any time. The client MAY request a new access token for 784 each connection to a resource server, but it SHOULD cache and re-use 785 access credentials that appear to be valid. 787 7. IANA Considerations 789 7.1. SASL Registration 791 The IANA is requested to register the following SASL profile: 793 SASL mechanism profile: OAUTHBEARER 795 Security Considerations: See this document 797 Published Specification: See this document 799 For further information: Contact the authors of this document. 801 Owner/Change controller: the IETF 803 Note: None 805 The IANA is requested to register the following SASL profile: 807 SASL mechanism profile: OAUTH10A 809 Security Considerations: See this document 811 Published Specification: See this document 813 For further information: Contact the authors of this document. 815 Owner/Change controller: the IETF 817 Note: None 819 The IANA is requested to register the following SASL profile: 821 SASL mechanism profile: OAUTH10A-PLUS 823 Security Considerations: See this document 825 Published Specification: See this document 827 For further information: Contact the authors of this document. 829 Owner/Change controller: the IETF 831 Note: None 833 7.2. GSS-API Registration 835 IANA is further requested to assign an OID for thESE GSS mechanismS 836 in the SMI numbers registry, with the prefix of 837 iso.org.dod.internet.security.mechanisms (1.3.6.1.5.5) and to 838 reference this specification in the registry. 840 8. References 842 8.1. Normative References 844 [I-D.ietf-oauth-v2] 845 Hardt, D., "The OAuth 2.0 Authorization Framework", 846 draft-ietf-oauth-v2-31 (work in progress), August 2012. 848 [I-D.ietf-oauth-v2-bearer] 849 Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 850 Framework: Bearer Token Usage", 851 draft-ietf-oauth-v2-bearer-23 (work in progress), 852 August 2012. 854 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 855 Requirement Levels", BCP 14, RFC 2119, March 1997. 857 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 858 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 859 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 861 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 862 Leach, P., Luotonen, A., and L. Stewart, "HTTP 863 Authentication: Basic and Digest Access Authentication", 864 RFC 2617, June 1999. 866 [RFC2743] Linn, J., "Generic Security Service Application Program 867 Interface Version 2, Update 1", RFC 2743, January 2000. 869 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 870 (SHA1)", RFC 3174, September 2001. 872 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 873 Security Layer (SASL)", RFC 4422, June 2006. 875 [RFC4627] Crockford, D., "The application/json Media Type for 876 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 878 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 879 Channels", RFC 5056, November 2007. 881 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 882 Specifications: ABNF", STD 68, RFC 5234, January 2008. 884 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 885 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 887 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 888 October 2008. 890 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 891 Service Application Program Interface (GSS-API) Mechanisms 892 in Simple Authentication and Security Layer (SASL): The 893 GS2 Mechanism Family", RFC 5801, July 2010. 895 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 896 April 2010. 898 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 899 for TLS", RFC 5929, July 2010. 901 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 903 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 904 Verification of Domain-Based Application Service Identity 905 within Internet Public Key Infrastructure Using X.509 906 (PKIX) Certificates in the Context of Transport Layer 907 Security (TLS)", RFC 6125, March 2011. 909 8.2. Informative References 911 [I-D.ietf-oauth-v2-http-mac] 912 Hammer-Lahav, E., "HTTP Authentication: MAC Access 913 Authentication", draft-ietf-oauth-v2-http-mac-01 (work in 914 progress), February 2012. 916 [I-D.jones-appsawg-webfinger] 917 Jones, P., Salgueiro, G., and J. Smarr, "WebFinger", 918 draft-jones-appsawg-webfinger-06 (work in progress), 919 June 2012. 921 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 922 4rev1", RFC 3501, March 2003. 924 Appendix A. Acknowlegements 926 The authors would like to thank the members of the Kitten working 927 group, and in addition and specifically: Simon Josefson, Torsten 928 Lodderstadt, Ryan Troll, and Nico Williams. 930 Appendix B. Document History 932 [[ to be removed by RFC editor before publication as an RFC ]] 934 -05 936 o Fixed the GS2 header language again. 938 o Separated out different OAuth schemes into different SASL 939 mechanisms. Took out the scheme in the error return. Tuned up 940 the IANA registrations. 942 o Added the user field back into the SASL message. 944 o Fixed the examples (again). 946 o 948 -04 950 o Changed user field to be carried in the gs2-header, and made gs2 951 header explicit in all cases. 953 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 954 reference. 956 o Changed to sending an empty client response (single control-A) as 957 the second message of a failed sequence. 959 o Fixed channel binding prose to refer to the normative specs and 960 removed the hashing of large channel binding data, which brought 961 mroe problems than it solved. 963 o Added a SMTP examples for Bearer use case. 965 -03 967 o Added user field into examples and fixed egregious errors there as 968 well. 970 o Added text reminding developers that Authorization scheme names 971 are case insensitive. 973 -02 975 o Added the user data element back in. 977 o Minor editorial changes. 979 -01 981 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 982 webfinger instead of WF and SWD older drafts. 984 o Replacing HTTP as the message format and adjusted all examples. 986 -00 988 o Renamed draft into proper IETF naming format now that it's 989 adopted. 991 o Minor fixes. 993 Authors' Addresses 995 William Mills 996 Yahoo! Inc. 998 Phone: 999 Email: wmills@yahoo-inc.com 1001 Tim Showalter 1003 Phone: 1004 Email: tjs@psaux.com 1006 Hannes Tschofenig 1007 Nokia Siemens Networks 1008 Linnoitustie 6 1009 Espoo 02600 1010 Finland 1012 Phone: +358 (50) 4871445 1013 Email: Hannes.Tschofenig@gmx.net 1014 URI: http://www.tschofenig.priv.at