idnits 2.17.1 draft-ietf-kitten-sasl-oauth-08.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 (September 17, 2012) is 4238 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 867, but no explicit reference was found in the text == Unused Reference: 'RFC2617' is defined on line 871, but no explicit reference was found in the text == Unused Reference: 'RFC3174' is defined on line 879, but no explicit reference was found in the text == Unused Reference: 'RFC5246' is defined on line 894, but no explicit reference was found in the text == Unused Reference: 'RFC5988' is defined on line 911, 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: March 21, 2013 6 H. Tschofenig 7 Nokia Siemens Networks 8 September 17, 2012 10 A set of SASL and GSS-API Mechanisms for OAuth 11 draft-ietf-kitten-sasl-oauth-08 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 March 21, 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 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 Identities in the SASL Context . . . . . . . . . 11 76 3.2.2. Canonicalization . . . . . . . . . . . . . . . . . . . 11 77 3.2.3. Server response to failed authentication. . . . . . . 11 78 3.2.4. Completing an error message sequence. . . . . . . . . 12 79 3.3. Use of Signature Type Authorization . . . . . . . . . . . 12 80 3.4. Channel Binding . . . . . . . . . . . . . . . . . . . . . 13 81 4. GSS-API OAuth Mechanism Specification . . . . . . . . . . . . 15 82 5. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 83 5.1. Successful Bearer Token Exchange . . . . . . . . . . . . . 17 84 5.2. OAuth 1.0a Authorization with Channel Binding . . . . . . 18 85 5.3. Failed Exchange . . . . . . . . . . . . . . . . . . . . . 19 86 5.4. Failed Channel Binding . . . . . . . . . . . . . . . . . . 20 87 5.5. SMTP Example of a failed negotiation. . . . . . . . . . . 20 88 6. Security Considerations . . . . . . . . . . . . . . . . . . . 22 89 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23 90 7.1. SASL Registration . . . . . . . . . . . . . . . . . . . . 23 91 7.2. GSS-API Registration . . . . . . . . . . . . . . . . . . . 24 92 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 25 93 8.1. Normative References . . . . . . . . . . . . . . . . . . . 25 94 8.2. Informative References . . . . . . . . . . . . . . . . . . 26 95 Appendix A. Acknowlegements . . . . . . . . . . . . . . . . . . . 27 96 Appendix B. Document History . . . . . . . . . . . . . . . . . . 28 97 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 30 99 1. Introduction 101 OAuth [I-D.ietf-oauth-v2] enables a third-party application to obtain 102 limited access to a protected resource, either on behalf of a 103 resource owner by orchestrating an approval interaction, or by 104 allowing the third-party application to obtain access on its own 105 behalf. The core OAuth specification [I-D.ietf-oauth-v2] does not 106 define the interaction between the client and the resource server 107 with the access to a protected resource using an Access Token. This 108 functionality is described in separate specifications, for example 109 Bearer tokens [I-D.ietf-oauth-v2-bearer], MAC tokens 110 [I-D.ietf-oauth-v2-http-mac], and OAuth 1.0a [RFC5849]. In each of 111 these are defined in an HTTP-based environment only. 113 Figure 1 shows the abstract message flow as shown in Figure 1 of 114 [I-D.ietf-oauth-v2]. 116 +--------+ +---------------+ 117 | |--(A)- Authorization Request ->| Resource | 118 | | | Owner | 119 | |<-(B)-- Authorization Grant ---| | 120 | | +---------------+ 121 | | 122 | | +---------------+ 123 | |--(C)-- Authorization Grant -->| Authorization | 124 | Client | | Server | 125 | |<-(D)----- Access Token -------| | 126 | | +---------------+ 127 | | 128 | | +---h------------+ 129 | |--(E)----- Access Token ------>| Resource | 130 | | | Server | 131 | |<-(F)--- Protected Resource ---| | 132 +--------+ +---------------+ 134 Figure 1: Abstract OAuth 2.0 Protocol Flow 136 This document takes advantage of the OAuth protocol and its 137 deployment base to provide a way to use SASL [RFC4422] as well as the 138 GSS-API [RFC2743] to gain access to resources when using non-HTTP- 139 based protocols, such as the Internet Message Access Protocol (IMAP) 140 [RFC3501] and SMTP [RFC5321], which is what this memo uses in the 141 examples. 143 The Simple Authentication and Security Layer (SASL) is a framework 144 for providing authentication and data security services in 145 connection-oriented protocols via replaceable mechanisms. It 146 provides a structured interface between protocols and mechanisms. 147 The resulting framework allows new protocols to reuse existing 148 mechanisms and allows old protocols to make use of new mechanisms. 149 The framework also provides a protocol for securing subsequent 150 protocol exchanges within a data security layer. 152 The Generic Security Service Application Program Interface (GSS-API) 153 [RFC2743] provides a framework for applications to support multiple 154 authentication mechanisms through a unified interface. 156 This document defines SASL mechanisms for OAuth, and it conforms to 157 the new bridge between SASL and the GSS-API called GS2 [RFC5801]. 158 This means that this document defines both SASL and GSS-API 159 mechanisms. Implementers may be interested in either the SASL, the 160 GSS-API, or even both mechanisms. To faciliate these two variants, 161 the description has been split into two parts, one part that provides 162 normative references for those interested in the SASL OAuth mechanism 163 (see Section 3), and a second part for those implementers that wish 164 to implement the GSS-API portion (see Section 4). 166 When OAuth is integrated into SASL and the GSS-API the high-level 167 steps are as follows: 169 (A) The client requests authorization from the resource owner. 170 The authorization request can be made directly to the resource 171 owner (as shown), or preferably indirectly via the authorization 172 server as an intermediary. 174 (B) The client receives an authorization grant which is a 175 credential representing the resource owner's authorization, 176 expressed using one of four grant types defined in this 177 specification or using an extension grant type. The authorization 178 grant type depends on the method used by the client to request 179 authorization and the types supported by the authorization server. 181 (C) The client requests an access token by authenticating with the 182 authorization server and presenting the authorization grant. 184 (D) The authorization server authenticates the client and 185 validates the authorization grant, and if valid issues an access 186 token. 188 (E) The client requests the protected resource from the resource 189 server and authenticates by presenting the access token. 191 (F) The resource server validates the access token, and if valid, 192 indicates a successful authentication. 194 Steps (E) and (F) are not defined in [I-D.ietf-oauth-v2] and are the 195 main functionality specified within this document. Consequently, the 196 message exchange shown in Figure 2 is the result of this 197 specification. The client will genrally need to determine the 198 authentication endpoints (and perhaps the service endpoints) before 199 the OAuth 2.0 protocol exchange messages in steps (A)-(D) are 200 executed. The discovery of the resource owner and authorization 201 server endpoints is outside the scope of this specification. The 202 client must discover those endpoints using a discovery mechanisms 203 such as Webfinger using host-meta [I-D.jones-appsawg-webfinger]. In 204 band discovery is not tenable if clients support the OAuth 2.0 205 password grant. Once credentials are obtained the client proceeds to 206 steps (E) and (F) defined in this specification. 208 ----+ 209 +--------+ +---------------+ | 210 | |--(A)-- Authorization Request --->| Resource | | 211 | | | Owner | |Plain 212 | |<-(B)------ Access Grant ---------| | |OAuth 213 | | +---------------+ |2.0 214 | | | 215 | | Client Credentials & +---------------+ | 216 | |--(C)------ Access Grant -------->| Authorization | | 217 | Client | | Server | | 218 | |<-(D)------ Access Token ---------| | | 219 | | (w/ Optional Refresh Token) +---------------+ | 220 | | ----+ 221 | | ----+ 222 | | +---------------+ | 223 | | | | |OAuth 224 | |--(E)------ Access Token -------->| Resource | |over 225 | | | Server | |SASL/ 226 | |<-(F)---- Protected Resource -----| | |GSS- 227 | | | | |API 228 +--------+ +---------------+ | 229 ----+ 231 Figure 2: OAuth SASL Architecture 233 2. Terminology 235 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 236 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 237 document are to be interpreted as described in [RFC2119]. 239 The reader is assumed to be familiar with the terms used in the OAuth 240 2.0 specification [I-D.ietf-oauth-v2]. 242 In examples, "C:" and "S:" indicate lines sent by the client and 243 server respectively. Line breaks have been inserted for readability. 245 Note that the IMAP SASL specification requires base64 encoding 246 message, not this memo. 248 3. OAuth SASL Mechanism Specifications 250 SASL is used as a generalized authentication method in a variety of 251 application layer protocols. This document defines the following 252 SASL mechanisms for usage with OAuth: 254 OAUTHBEARER Authorization using Bearer tokens. 256 OAUTH10A Authorization using OAuth 1.0a tokens. 258 OAUTH10A-PLUS Adds channel binding [RFC5056] capability to 259 OAUTH10A for additional security guarantees. 261 Any new OAuth token scheme MAY define a new SASL mechanism compatible 262 with the mechanisms defined here by simply registering the new 263 name(s) and citing this specification for the further definition. 264 New channel binding enabled "-PLUS" mechanisms defined in this way 265 MUST include message integrity protection. A newly defined mechanism 266 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 reponse. 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. The ABNF [RFC5234] 299 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 authroization. 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 In authorization schemes that use signatures, the client MUST send 327 host and port number key/values, and the server MUST fail an 328 authorization request requiring signatures that does not have host 329 and port values. For authorization schemes that require a URI scheme 330 as part of the data being signed "http" is always used. In OAuth 331 1.0a for example, the signature base string includes the 332 reconstructed HTTP URL. 334 3.1.1. Reserved Key/Values 336 In these mechanisms values for path, query string and post body are 337 assigned default values. OAuth authorization schemes MAY define 338 usage of these in the SASL context and extend this specification. 339 For OAuth schemes that use request signatures the default values MUST 340 be used unless explict values are provided in the client response. 341 The following key values are reserved for future use: 343 mthd (RESERVED): HTTP method for use in signatures, the default 344 value is "POST". 346 path (RESERVED): HTTP path data, the default value is "/". 348 post (RESERVED): HTTP post data, the default value is "". 350 3.1.2. Use of the gs2-header 352 The OAuth scheme related mechanisms are also GSS-API mechanisms, see 353 Section 4 for further detail. The gs2-header is used as follows: 355 o The "gs2-nonstd-flag" MUST NOT be present. 357 o The "gs2-authzid" carries the authorization identity as specified 358 in [RFC5801]. If present the application MUST determine whether 359 access is granted for the identity asserted in the OAuth 360 credential, if it does not the server MUST fail the negotiation. 362 In the non "-PLUS" mechanisms the "gs2-cb-flag" MUST be set to "n" 363 because channel-binding [RFC5056] data is not expected. In the 364 OAUTH10A-PLUS mechanism (or other -PLUS variants based on this 365 specification) the "gs2-cb-flag" MUST be set appropriately by the 366 client. 368 3.2. Server's Response 370 The server validates the response per the specification for the 371 authorization scheme used. If the authorization scheme used includes 372 signing of the request parameters the client must provide a client 373 response that satisfies the data requirements for 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. 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 authenticated identity reported 385 by the SASL mechanism is the identity securely established for the 386 client with the OAuth credential. The application, not the SASL 387 mechanism, based on local access policy determines whether the 388 identity reported by the mechanism is allowed access to the requested 389 resource. Note that the semantics of the authz-id is specified by 390 the SASL framework [RFC4422]. 392 3.2.1. OAuth Identities in the SASL Context 394 Some OAuth schemes can carry both an owner or resource identity and a 395 "proxy" identity, for example an OAuth 1.0a [RFC5849] mechanism where 396 the consumer key (oauth_consumer_key) identifies the entity using the 397 token and the token itself identifies the owner or resouce. If both 398 identities are needed by an application the developer will need to 399 provide a way to communicate that from the SASL mechanism back to the 400 application such as a GSS-API [RFC2473] named type like 401 GSS_C_NT_USER_NAME or a comparable newly defined GSS-API name type or 402 name attribute [RFC6680]. 404 3.2.2. Canonicalization 406 The identity asserted by the OAuth authorization server is canonical 407 for display. The server MAY provide a different canonical form based 408 on local data. 410 3.2.3. Server response to failed authentication. 412 For a failed authentication the server returns a JSON [RFC4627] 413 formatted error result, and fails the authentication. The error 414 result consists of the following values: 416 status (REQUIRED): The authorization error code. Valid error 417 codes are defined in the IANA [[need registry name]] registry 418 specified in the OAuth 2 core specification. 420 scope (OPTIONAL): An OAuth scope which is valid to access the 421 service. This may be empty which implies that unscoped tokens 422 are required, or a space separated list. Use of a space 423 separated list is NOT RECOMMENDED. 425 If the resource server provides a scope the client SHOULD always 426 request scoped tokens from the token endpoint. The client MAY use a 427 scope other than the one provided by the resource server. Scopes 428 other than those advertised by the resource server are be defined by 429 the resource owner and provided in service documentation or discovery 430 information (which is beyond the scope of this memo). If not present 431 then the client SHOULD presume an empty scope (unscoped token) is 432 needed. 434 If channel binding is in use and the channel binding fails the server 435 responds with a status code set to 412 to indicate that the channel 436 binding precondition failed. If the authentication scheme in use 437 does not include signing the server SHOULD revoke the presented 438 credential and the client SHOULD discard that credential. 440 3.2.4. Completing an error message sequence. 442 Section 3.6 of [RFC4422] explicitly prohibits additional information 443 in an unsuccessful authentication outcome. Therefor, the error 444 message is sent in a normal message. The client MUST then send an 445 additional client response consisting of a single %x01 (control A) 446 character to the server in order to allow the server to finish the 447 exchange. 449 3.3. Use of Signature Type Authorization 451 Some OAuth mechanisms support authorization using signatures, which 452 requires that both client and server construct the string to be 453 signed. OAuth 2 is designed for authentication/authorization to 454 access specific URIs. SASL is designed for user authentication, and 455 has no facility for being more specific. In this mechanism we 456 require or define default values for the data elements from an HTTP 457 request which allow the signature base string to be constructed 458 properly. The default HTTP path is "/" and the default post body is 459 empty. These atoms are defined as extension points so that no 460 changes are needed if there is a revision of SASL which supports more 461 specific resource authorization, e.g. IMAP access to a specific 462 folder or FTP access limited to a specific directory. 464 Using the example in the OAuth 1.0a specification as a starting 465 point, on an IMAP server running on port 143 and given the OAuth 1.0a 466 style authorization request (with %x01 shown as ^A and line breaks 467 added for readability) below: 469 n,a=user@example.com^A 470 host=example.com^A 471 user=user@example.com^A 472 port=143^A 473 auth=OAuth realm="Example", 474 oauth_consumer_key="9djdj82h48djs9d2", 475 oauth_token="kkk9d7dh3k39sjv7", 476 oauth_signature_method="HMAC-SHA1", 477 oauth_timestamp="137131201", 478 oauth_nonce="7d8f3e4a", 479 oauth_signature="Tm90IGEgcmVhbCBzaWduYXR1cmU%3D"^A^A 481 The signature base string would be constructed per the OAuth 1.0 482 specification [RFC5849] with the following things noted: 484 o The method value is defaulted to POST. 486 o The scheme defaults to be "http", and any port number other than 487 80 is included. 489 o The path defaults to "/". 491 o The query string defaults to "". 493 In this example the signature base string with line breaks added for 494 readability would be: 496 POST&http%3A%2F%2Fexample.com:143%2F&oauth_consumer_key%3D9djdj82h4 497 8djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHMAC-SH 498 A1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39sjv7 500 3.4. Channel Binding 502 The channel binding data is carried in the "qs" (query string) key 503 value pair formatted as a standard HTTP query parameter with the name 504 "cbdata". Channel binding requires that the channel binding data be 505 integrity protected end-to-end in order to protect against man-in- 506 the-middle attacks. All authorization schemes offered with "-PLUS" 507 mechanisms MUST provide integrity protection. It should be noted 508 that while the Bearer token scheme specifies SSL for normal usage it 509 offers no integrity protection and is not suitable for use with 510 channel binding. 512 The channel binding data is computed by the client based on it's 513 choice of preferred channel binding type. As specified in [RFC5056], 514 the channel binding information MUST start with the channel binding 515 unique prefix, followed by a colon (ASCII 0x3A), followed by a base64 516 encoded channel binding payload. The channel binding payload is the 517 raw data from the channel binding type. For example, if the client 518 is using tls-unique for channel binding then the raw channel binding 519 data is the TLS finished message as specified in section 3.1 of 520 [RFC5929]. 522 4. GSS-API OAuth Mechanism Specification 524 Note: The normative references in this section are informational for 525 SASL implementers, but they are normative for GSS-API implementers. 527 A SASL OAuth mechanism is also a GSS-API mechanism and the messages 528 described in Section 3 are the same with the following changes to the 529 GS2 related elements: 531 1. the GS2 header on the client's first message is excluded when 532 used as a GSS-API mechanism. 534 2. the initial context token header is prefixed to the client's 535 first authentication message (context token), as described in 536 Section 3.1 of RFC 2743, 538 The GSS-API mechanism OIDs are: 540 o OAUTHBEARER: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 542 o OAUTH10A: [[TBD: IANA -- probably in the 1.3.6.1.5.5 tree]] 544 OAuth mechanims security contexts always have the mutual_state flag 545 (GSS_C_MUTUAL_FLAG) set to TRUE. OAuth supports credential 546 delegation, therefore security contexts may have the deleg_state flag 547 (GSS_C_DELEG_FLAG) set to either TRUE or FALSE. 549 The mutual authentication property of this mechanism relies on 550 successfully comparing the TLS server identity with the negotiated 551 target name. Since the TLS channel is managed by the application 552 outside of the GSS-API mechanism, the mechanism itself is unable to 553 confirm the name while the application is able to perform this 554 comparison for the mechanism. For this reason, applications MUST 555 match the TLS server identity with the target name, as discussed in 556 [RFC6125]. 558 OAuth mechanisms do not support per-message tokens or 559 GSS_Pseudo_random. 561 OAuth supports a standard generic name syntax for acceptors, such as 562 GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], Section 4.1). These 563 service names MUST be associated with the "entityID" claimed by the 564 RP. OAuth mechanisms support only a single name type for initiators: 565 GSS_C_NT_USER_NAME. GSS_C_NT_USER_NAME is the default name type. 566 The query, display, and exported name syntaxes for OAuth principal 567 names are all the same. There is no OAuth-specific name syntax; 568 applications SHOULD use generic GSS-API name types, such as 569 GSS_C_NT_USER_NAME and GSS_C_NT_HOSTBASED_SERVICE (see [RFC2743], 570 Section 4). The exported name token does, of course, conform to 571 [RFC2743], Section 3.2, but the "NAME" part of the token should be 572 treated as a potential input string to the OAuth name normalization 573 rules. 575 5. Examples 577 These examples illustrate exchanges between an IMAP and SMTP clients 578 and servers. 580 Note to implementers: Authorization scheme names are case 581 insensitive. One example uses "Bearer" but that could as easily be 582 "bearer", "BEARER", or "BeArEr". 584 5.1. Successful Bearer Token Exchange 586 This example shows a successful OAuth 2.0 bearer token exchange. 587 Note that line breaks are inserted for readability. 589 S: * IMAP4rev1 Server Ready 590 C: t0 CAPABILITY 591 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER 592 S: t0 OK Completed 593 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 594 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 595 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 596 S: t1 OK SASL authentication succeeded 598 As required by IMAP [RFC3501], the payloads are base64-encoded. The 599 decoded initial client response (with %x01 represented as ^A and long 600 lines wrapped for readability) is: 602 n,a=user@example.com^Ahost=server.example.com^Aport=143^A 603 auth=Bearer vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==^A^A 605 The same credential used in an SMTP exchange is shown below. Note 606 that line breaks are inserted for readability, and that the SMTP 607 protocol terminates lines with CR and LF characters (ASCII values 608 0x0D and 0x0A), these are not displayed explicitly in the example. 610 [connection begins] 611 S: 220 mx.example.com ESMTP 12sm2095603fks.9 612 C: EHLO sender.example.com 613 S: 250-mx.example.com at your service,[172.31.135.47] 614 S: 250-SIZE 35651584 615 S: 250-8BITMIME 616 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 617 S: 250-ENHANCEDSTATUSCODES 618 S: 250-PIPELINING 619 C: t1 AUTHENTICATE OAUTHBEARER bixhPXVzZXJAZXhhbXBsZS5jb20BaG9zdD1zZX 620 J2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD1CZWFyZXIgdkY5ZGZ0NHFtV 621 GMyTnZiM1JsY2tCaGJIUmhkbWx6ZEdFdVkyOXRDZz09AQE= 622 S: 235 Authentication successful. 623 [connection continues...] 625 5.2. OAuth 1.0a Authorization with Channel Binding 627 This example shows channel binding in the context of an OAuth 1.0a 628 signed authorization request. Note that line breaks are inserted for 629 readability. 631 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 632 Ready 633 S: t0 OK Completed 634 C: t1 AUTHENTICATE OAUTH10A-PLUS cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcGxlL 635 mNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoPU9BdXRoI 636 HJlYWxtPSJFeGFtcGxlIixvYXV0aF9jb25zdW1lcl9rZXk9IjlkamRqODJoNDhka 637 nM5ZDIiLG9hdXRoX3Rva2VuPSJra2s5ZDdkaDNrMzlzanY3IixvYXV0aF9zaWduY 638 XR1cmVfbWV0aG9kPSJITUFDLVNIQTEiLG9hdXRoX3RpbWVzdGFtcD0iMTM3MTMxM 639 jAxIixvYXV0aF9ub25jZT0iN2Q4ZjNlNGEiLG9hdXRoX3NpZ25hdHVyZT0iU1Nkd 640 ElHRWdiR2wwZEd4bElIUmxZU0J3YjNRdSIBcXM9Y2JkYXRhPXRscy11bmlxdWU6U 641 0c5M0lHSnBaeUJwY3lCaElGUk1VeUJtYVc1aGJDQnRaWE56WVdkbFB3bz0BAQ== 642 S: t1 OK SASL authentication succeeded 644 As required by IMAP [RFC3501], the payloads are base64-encoded. The 645 decoded initial client response (with %x01 represented as ^A and 646 lines wrapped for readability) is: 648 p=tls-unique,a=user@example.com^A 649 host=server.example.com^A 650 port=143^A 651 auth=OAuth realm="Example", 652 oauth_consumer_key="9djdj82h48djs9d2", 653 oauth_token="kkk9d7dh3k39sjv7", 654 oauth_signature_method="HMAC-SHA1", 655 oauth_timestamp="137131201", 656 oauth_nonce="7d8f3e4a", 657 oauth_signature="SSdtIGEgbGl0dGxlIHRlYSBwb3Qu"^A 658 qs=cbdata=tls-unique:SG93IGJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=^A^A 660 In this example the signature base string with line breaks added for 661 readability would be: 663 POST&http%3A%2F%2Fserver.example.com:143%2F&cbdata=tls-unique:SG93I 664 GJpZyBpcyBhIFRMUyBmaW5hbCBtZXNzYWdlPwo=%26oauth_consumer_key%3D9djd 665 j82h48djs9d2%26oauth_nonce%3D7d8f3e4a%26oauth_signature_method%3DHM 666 AC-SHA1%26oauth_timestamp%3D137131201%26oauth_token%3Dkkk9d7dh3k39s 667 jv7 669 5.3. Failed Exchange 671 This example shows a failed exchange because of the empty 672 Authorization header, which is how a client can query for the needed 673 scope. Note that line breaks are inserted for readability. 675 S: * CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR IMAP4rev1 Server 676 Ready 677 S: t0 OK Completed 678 C: t1 AUTHENTICATE OAUTHBEARER cD10bHMtdW5pcXVlLGE9dXNlckBleGFtcG 679 xlLmNvbQFob3N0PXNlcnZlci5leGFtcGxlLmNvbQFwb3J0PTE0MwFhdXRoP 680 QFjYmRhdGE9AQE= 681 S: + ewoic3RhdHVzIjoiNDAxIgoic2NvcGUiOiJleGFtcGxlX3Njb3BlIgp9 682 C: + AQ== 683 S: t1 NO SASL authentication failed 685 The decoded initial client response is: 687 n,a=user@example.com,^Ahost=server.example.com^A 688 port=143^Aauth=^A^A 690 The decoded server error response is: 692 { 693 "status":"401", 694 "scope":"example_scope" 695 } 697 The client responds with the required dummy response. 699 5.4. Failed Channel Binding 701 This example shows a channel binding failure in an empty request. 702 The channel binding information is empty. Note that line breaks are 703 inserted for readability. 705 S: * CAPABILITY IMAP4rev1 AUTH=OAUTH10A-PLUS SASL-IR IMAP4rev1 Server 706 Ready 707 S: t0 OK Completed 708 C: t1 AUTHENTICATE OAUTH10A-PLUS cCxhPXVzZXJAZXhhbXBsZS5jb20BaG9z 709 dD1zZXJ2ZXIuZXhhbXBsZS5jb20BcG9ydD0xNDMBYXV0aD0BY2JkYXRhPQEB 710 S: + ewoic3RhdHVzIjoiNDEyIiwKInNjb3BlIjoiZXhhbXBsZV9zY29wZSIKfQ== 711 C: + AQ== 712 S: t1 NO SASL authentication failed 714 The decoded initial client response is: 716 p=tls-unique,a=user@example.com,^Ahost=server.example.com^A 717 port=143^Aauth=^Acbdata=^A^A 719 The decoded server response is: 721 { 722 "status":"412", 723 "scope":"example_scope" 724 } 726 The client responds with the required dummy response. 728 5.5. SMTP Example of a failed negotiation. 730 This example shows an authorization failure in an SMTP exchange. 731 Note that line breaks are inserted for readability, and that the SMTP 732 protocol terminates lines with CR and LF characters (ASCII values 733 0x0D and 0x0A), these are not displayed explicitly in the example. 735 [connection begins] 736 S: 220 mx.example.com ESMTP 12sm2095603fks.9 737 C: EHLO sender.example.com 738 S: 250-mx.example.com at your service,[172.31.135.47] 739 S: 250-SIZE 35651584 740 S: 250-8BITMIME 741 S: 250-AUTH LOGIN PLAIN OAUTHBEARER 742 S: 250-ENHANCEDSTATUSCODES 743 S: 250-PIPELINING 744 C: AUTH OAUTHBEARER bixhPT1zb21ldXNlckBleGFtcGxlLmNvbQFhdXRoPUJlYXJlciB2 745 RjlkZnQ0cW1UYzJOdmIzUmxja0JoZEhSaGRtbHpkR0V1WTI5dENnPT0BAQ== 746 S: 334 eyJzdGF0dXMiOiI0MDEiLCJzY2hlbWVzIjoiYmVhcmVyIG1hYyIsInNjb3BlIjoia 747 HR0cHM6Ly9tYWlsLmdvb2dsZS5jb20vIn0K 748 C: AQ== 749 S: 535-5.7.1 Username and Password not accepted. Learn more at 750 S: 535 5.7.1 http://support.example.com/mail/oauth 751 [connection continues...] 753 The server returned an error message in the 334 SASL message, the 754 client responds with the required dummy response, and the server 755 finalizes the negotiation. 757 6. Security Considerations 759 This mechanism does not provide a security layer, but does provide a 760 provision for channel binding. The OAuth 2 specification 761 [I-D.ietf-oauth-v2] allows for a variety of usages, and the security 762 properties of these profiles vary. The usage of bearer tokens, for 763 example, provide security features similar to cookies. Applications 764 using this mechanism SHOULD exercise the same level of care using 765 this mechanism as they would in using the SASL PLAIN mechanism. In 766 particular, TLS 1.2 or an equivalent secure channel MUST be 767 implemented and its usage is RECOMMENDED. 769 The channel binding in this mechanism has different properties based 770 on the authentication scheme used. The integrity guarantee for 771 channel binding depends on the quality of the guarantee in the the 772 authorization scheme. 774 It is possible that SASL will be authenticating a connection and the 775 life of that connection may outlast the life of the token used to 776 authenticate it. This is a common problem in application protocols 777 where connections are long-lived, and not a problem with this 778 mechanism per se. Servers MAY unilaterally disconnect clients in 779 accordance with the application protocol. 781 An OAuth credential is not equivalent to the password or primary 782 account credential. There are protocols like XMPP that allow actions 783 like change password. The server SHOULD ensure that actions taken in 784 the authenticated channel are appropriate to the strength of the 785 presented credential. 787 Tokens have a lifetime associated with them. Reducing the lifetime 788 of a token provides security benefits in the case that tokens leak. 789 In addition a previously obtained token MAY be revoked or rendered 790 invalid at any time. The client MAY request a new access token for 791 each connection to a resource server, but it SHOULD cache and re-use 792 access credentials that appear to be valid. 794 7. IANA Considerations 796 7.1. SASL Registration 798 The IANA is requested to register the following SASL profile: 800 SASL mechanism profile: OAUTHBEARER 802 Security Considerations: See this document 804 Published Specification: See this document 806 For further information: Contact the authors of this document. 808 Owner/Change controller: the IETF 810 Note: None 812 The IANA is requested to register the following SASL profile: 814 SASL mechanism profile: OAUTH10A 816 Security Considerations: See this document 818 Published Specification: See this document 820 For further information: Contact the authors of this document. 822 Owner/Change controller: the IETF 824 Note: None 826 The IANA is requested to register the following SASL profile: 828 SASL mechanism profile: OAUTH10A-PLUS 830 Security Considerations: See this document 832 Published Specification: See this document 834 For further information: Contact the authors of this document. 836 Owner/Change controller: the IETF 838 Note: None 840 7.2. GSS-API Registration 842 IANA is further requested to assign an OID for thESE GSS mechanismS 843 in the SMI numbers registry, with the prefix of 844 iso.org.dod.internet.security.mechanisms (1.3.6.1.5.5) and to 845 reference this specification in the registry. 847 8. References 849 8.1. Normative References 851 [I-D.ietf-oauth-v2] 852 Hardt, D., "The OAuth 2.0 Authorization Framework", 853 draft-ietf-oauth-v2-31 (work in progress), August 2012. 855 [I-D.ietf-oauth-v2-bearer] 856 Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 857 Framework: Bearer Token Usage", 858 draft-ietf-oauth-v2-bearer-23 (work in progress), 859 August 2012. 861 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 862 Requirement Levels", BCP 14, RFC 2119, March 1997. 864 [RFC2473] Conta, A. and S. Deering, "Generic Packet Tunneling in 865 IPv6 Specification", RFC 2473, December 1998. 867 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 868 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 869 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 871 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 872 Leach, P., Luotonen, A., and L. Stewart, "HTTP 873 Authentication: Basic and Digest Access Authentication", 874 RFC 2617, June 1999. 876 [RFC2743] Linn, J., "Generic Security Service Application Program 877 Interface Version 2, Update 1", RFC 2743, January 2000. 879 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 880 (SHA1)", RFC 3174, September 2001. 882 [RFC4422] Melnikov, A. and K. Zeilenga, "Simple Authentication and 883 Security Layer (SASL)", RFC 4422, June 2006. 885 [RFC4627] Crockford, D., "The application/json Media Type for 886 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 888 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 889 Channels", RFC 5056, November 2007. 891 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 892 Specifications: ABNF", STD 68, RFC 5234, January 2008. 894 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 895 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 897 [RFC5321] Klensin, J., "Simple Mail Transfer Protocol", RFC 5321, 898 October 2008. 900 [RFC5801] Josefsson, S. and N. Williams, "Using Generic Security 901 Service Application Program Interface (GSS-API) Mechanisms 902 in Simple Authentication and Security Layer (SASL): The 903 GS2 Mechanism Family", RFC 5801, July 2010. 905 [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, 906 April 2010. 908 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 909 for TLS", RFC 5929, July 2010. 911 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 913 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 914 Verification of Domain-Based Application Service Identity 915 within Internet Public Key Infrastructure Using X.509 916 (PKIX) Certificates in the Context of Transport Layer 917 Security (TLS)", RFC 6125, March 2011. 919 [RFC6680] Williams, N., Johansson, L., Hartman, S., and S. 920 Josefsson, "Generic Security Service Application 921 Programming Interface (GSS-API) Naming Extensions", 922 RFC 6680, August 2012. 924 8.2. Informative References 926 [I-D.ietf-oauth-v2-http-mac] 927 Hammer-Lahav, E., "HTTP Authentication: MAC Access 928 Authentication", draft-ietf-oauth-v2-http-mac-01 (work in 929 progress), February 2012. 931 [I-D.jones-appsawg-webfinger] 932 Jones, P., Salgueiro, G., and J. Smarr, "WebFinger", 933 draft-jones-appsawg-webfinger-06 (work in progress), 934 June 2012. 936 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 937 4rev1", RFC 3501, March 2003. 939 Appendix A. Acknowlegements 941 The authors would like to thank the members of the Kitten working 942 group, and in addition and specifically: Simon Josefson, Torsten 943 Lodderstadt, Ryan Troll, and Nico Williams. 945 Appendix B. Document History 947 [[ to be removed by RFC editor before publication as an RFC ]] 949 -08 951 o Fixed the channel binding examples for p=$cbtype 953 o More tuning of the authcid language and edited and renamed 3.2.1. 955 -07 957 o Struck the MUST langiage from authzid. 959 o 961 -06 963 o Removed the user field. Fixed the examples again. 965 o Added canonicalization language. 967 o 969 -05 971 o Fixed the GS2 header language again. 973 o Separated out different OAuth schemes into different SASL 974 mechanisms. Took out the scheme in the error return. Tuned up 975 the IANA registrations. 977 o Added the user field back into the SASL message. 979 o Fixed the examples (again). 981 o 983 -04 985 o Changed user field to be carried in the gs2-header, and made gs2 986 header explicit in all cases. 988 o Converted MAC examples to OAuth 1.0a. Moved MAC to an informative 989 reference. 991 o Changed to sending an empty client response (single control-A) as 992 the second message of a failed sequence. 994 o Fixed channel binding prose to refer to the normative specs and 995 removed the hashing of large channel binding data, which brought 996 mroe problems than it solved. 998 o Added a SMTP examples for Bearer use case. 1000 -03 1002 o Added user field into examples and fixed egregious errors there as 1003 well. 1005 o Added text reminding developers that Authorization scheme names 1006 are case insensitive. 1008 -02 1010 o Added the user data element back in. 1012 o Minor editorial changes. 1014 -01 1016 o Ripping out discovery. Changed to refer to I-D.jones-appsawg- 1017 webfinger instead of WF and SWD older drafts. 1019 o Replacing HTTP as the message format and adjusted all examples. 1021 -00 1023 o Renamed draft into proper IETF naming format now that it's 1024 adopted. 1026 o Minor fixes. 1028 Authors' Addresses 1030 William Mills 1031 Yahoo! Inc. 1033 Phone: 1034 Email: wmills@yahoo-inc.com 1036 Tim Showalter 1038 Phone: 1039 Email: tjs@psaux.com 1041 Hannes Tschofenig 1042 Nokia Siemens Networks 1043 Linnoitustie 6 1044 Espoo 02600 1045 Finland 1047 Phone: +358 (50) 4871445 1048 Email: Hannes.Tschofenig@gmx.net 1049 URI: http://www.tschofenig.priv.at