idnits 2.17.1 draft-richer-transactional-authz-04.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 : ---------------------------------------------------------------------------- ** The document seems to lack an Introduction section. ** There are 8 instances of too long lines in the document, the longest one being 804 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 268 has weird spacing: '...tatypes types...' == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords -- however, there's a paragraph with a matching beginning. Boilerplate error? (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (December 13, 2019) is 1595 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: 'BCP195' is defined on line 1166, but no explicit reference was found in the text == Unused Reference: 'RFC6749' is defined on line 1203, but no explicit reference was found in the text == Unused Reference: 'RFC7519' is defined on line 1212, but no explicit reference was found in the text == Unused Reference: 'RFC7662' is defined on line 1216, but no explicit reference was found in the text == Unused Reference: 'RFC8126' is defined on line 1224, but no explicit reference was found in the text ** Obsolete normative reference: RFC 7525 (ref. 'BCP195') (Obsoleted by RFC 9325) == Outdated reference: A later version (-04) exists of draft-fett-oauth-dpop-03 ** Obsolete normative reference: RFC 3230 (Obsoleted by RFC 9530) Summary: 4 errors (**), 0 flaws (~~), 9 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Richer, Ed. 3 Internet-Draft Bespoke Engineering 4 Intended status: Standards Track December 13, 2019 5 Expires: June 15, 2020 7 Transactional Authorization 8 draft-richer-transactional-authz-04 10 Abstract 12 This document defines a mechanism for delegating authorization to a 13 piece of software, and conveying that delegation to the software. 15 Requirements Language 17 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 18 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 19 "OPTIONAL" in this document are to be interpreted as described in BCP 20 14 RFC 2119 [RFC2119] RFC 8174 [RFC8174] when, and only when, they 21 appear in all capitals, as shown here. 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at https://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on June 15, 2020. 40 Copyright Notice 42 Copyright (c) 2019 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (https://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . 3 58 1.1. Parties . . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.2. Sequence . . . . . . . . . . . . . . . . . . . . . . . . 3 60 2. Transaction request . . . . . . . . . . . . . . . . . . . . . 4 61 2.1. Display . . . . . . . . . . . . . . . . . . . . . . . . . 6 62 2.2. Resource . . . . . . . . . . . . . . . . . . . . . . . . 6 63 2.3. User . . . . . . . . . . . . . . . . . . . . . . . . . . 7 64 2.4. Interact . . . . . . . . . . . . . . . . . . . . . . . . 7 65 2.5. Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 9 66 3. Interaction response . . . . . . . . . . . . . . . . . . . . 10 67 3.1. Redirect interaction . . . . . . . . . . . . . . . . . . 11 68 3.2. Interaction URI return . . . . . . . . . . . . . . . . . 12 69 3.3. Calculating the interaction hash . . . . . . . . . . . . 14 70 3.3.1. SHA3 . . . . . . . . . . . . . . . . . . . . . . . . 14 71 3.3.2. SHA2 . . . . . . . . . . . . . . . . . . . . . . . . 14 72 3.4. Secondary device interaction . . . . . . . . . . . . . . 15 73 4. Wait response . . . . . . . . . . . . . . . . . . . . . . . . 16 74 5. Interaction at the AS . . . . . . . . . . . . . . . . . . . . 16 75 6. Error response . . . . . . . . . . . . . . . . . . . . . . . 17 76 7. Transaction continue request . . . . . . . . . . . . . . . . 17 77 8. Token response . . . . . . . . . . . . . . . . . . . . . . . 18 78 8.1. Presenting Tokens to the RS . . . . . . . . . . . . . . . 19 79 9. Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 80 9.1. Presenting handles . . . . . . . . . . . . . . . . . . . 19 81 9.2. Validating handles . . . . . . . . . . . . . . . . . . . 20 82 9.3. Transaction handles . . . . . . . . . . . . . . . . . . . 20 83 9.4. Display handles . . . . . . . . . . . . . . . . . . . . . 20 84 9.5. Resource handles . . . . . . . . . . . . . . . . . . . . 21 85 9.5.1. Resource-first . . . . . . . . . . . . . . . . . . . 22 86 9.6. User handles . . . . . . . . . . . . . . . . . . . . . . 23 87 9.7. Key handles . . . . . . . . . . . . . . . . . . . . . . . 23 88 10. Binding Keys . . . . . . . . . . . . . . . . . . . . . . . . 24 89 10.1. Detached JWS . . . . . . . . . . . . . . . . . . . . . . 25 90 10.2. Mutual TLS . . . . . . . . . . . . . . . . . . . . . . . 25 91 10.3. DPoP . . . . . . . . . . . . . . . . . . . . . . . . . . 25 92 10.4. HTTP Signing . . . . . . . . . . . . . . . . . . . . . . 25 93 10.5. OAuth PoP . . . . . . . . . . . . . . . . . . . . . . . 26 94 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 26 95 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 96 13. Security Considerations . . . . . . . . . . . . . . . . . . . 26 97 14. Privacy Considerations . . . . . . . . . . . . . . . . . . . 26 98 15. Normative References . . . . . . . . . . . . . . . . . . . . 26 99 Appendix A. Document History . . . . . . . . . . . . . . . . . . 28 100 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 29 102 1. Protocol 104 This protocol allows a piece of software to request delegated 105 authorization to an API, protected by an authorization server usually 106 on behalf of a resource owner. 108 1.1. Parties 110 The Authorization Server (AS) manages the transactions. It is 111 defined by its transaction endpoint, a single URL that accepts a POST 112 request with a JSON payload. The AS MAY also have other endpoints, 113 including interaction endpoints and user code endpoints, and these 114 are introduced to the RC as needed during the transaction process. 116 The Resource Client (RC) requests tokens from the AS and uses tokens 117 at the RS. 119 The Resource Server (RS) accepts tokens from the RC and validates 120 them (potentially at the AS). 122 The Resource Owner (RO) authorizes the request from the RC to the RS, 123 often interactively at the AS. 125 1.2. Sequence 127 1. The RC creates a transaction request and sends it to the AS 129 2. The AS processes the transaction request and determines if the RO 130 needs to interact 132 3. If interaction is required, the AS interacts with the RO, 133 possibly by directing the RC to send the RO there 135 4. The RC continues the transaction at the AS 137 5. The AS processes the transaction again, determining that a token 138 can be issued 140 6. The AS issues a token to the RC 142 7. The RC uses the token with the RS 144 2. Transaction request 146 To start a transaction, the RC makes a transaction request to the 147 transaction endpoint of the AS. The RC creates a JSON [RFC8259] 148 document with five primary sections, included as members of a root 149 JSON object. 151 resources Information about the RS's the resulting token will be 152 applied to, including locations, extents of access, types of data 153 being accessed, and other API information. This section is 154 REQUIRED. 156 keys Information about the keys known to the RC and able to be 157 presented in future parts of the transaction. This section is 158 REQUIRED. (Note: I can't think of a good reason for this to be 159 optional.) 161 interact Information about how the RC is able to interact with the 162 RO, including callback URI's and nonce if applicable. This 163 section is REQUIRED if the RC is capable of driving interaction 164 with the user. 166 display Information about the RC making the request, including 167 display name, home page, logo, and other user-facing information. 168 This section is RECOMMENDED. 170 user Information about the RO as known to or provided to the RC, in 171 the form of assertions or references to external data. This 172 section is OPTIONAL. 174 Each section consists of either a JSON object or an array of JSON 175 objects, as described in the subsections below. Many sections MAY be 176 represented by an appropriate handle instead as described in 177 Section 9. In such cases, the section is replaced entirely by the 178 handle presentation, which is a single string instead of a JSON 179 object. The RC MAY present additional sections as defined by 180 extensions of this specification. The AS MUST ignore any sections 181 that it does not understand. 183 A non-normative example of a transaction request is below: 185 { 186 "resources": [ 187 { 188 "actions": [ 189 "read", 190 "write", 191 "dolphin" 192 ], 193 "locations": [ 194 "https://server.example.net/", 195 "https://resource.local/other" 196 ], 197 "datatypes": [ 198 "metadata", 199 "images" 200 ] 201 }, 202 "dolphin-metadata" 203 ], 204 "key": { 205 "proof": "jwsd", 206 "jwks": { 207 "keys": [ 208 { 209 "kty": "RSA", 210 "e": "AQAB", 211 "kid": "xyz-1", 212 "alg": "RS256", 213 "n": "kOB5rR4Jv0GMeL...." 214 } 215 ] 216 } 217 }, 218 "interact": { 219 "redirect": true, 220 "callback": { 221 "uri": "https://client.example.net/return/123455", 222 "nonce": "LKLTI25DK82FX4T4QFZC" 223 } 224 }, 225 "display": { 226 "name": "My Client Display Name", 227 "uri": "https://example.net/client" 228 } 229 } 231 2.1. Display 233 This section provides descriptive details of the RC software making 234 the call, useful for displaying information about the client to the 235 user during the authorization request. This section is a JSON 236 object, and all fields are OPTIONAL. The RC MAY send additional 237 fields, and the AS MUST ignore all fields that it does not 238 understand. 240 name Display name of the RC software 242 uri User-facing web page of the RC software 244 logo_uri Display image to represent the RC software 246 "display": { 247 "name": "My Client Display Name", 248 "uri": "https://example.net/client" 249 } 251 The AS SHOULD use this information in presenting any authorization 252 screens to the RO during interaction. 254 The display information MAY instead be presented as a display handle 255 reference Section 9.4. 257 2.2. Resource 259 This section identifies what the RC wants to do with the API hosted 260 at the RS. This section is a JSON array of objects, each object 261 representing a single resource or resource set. That AS MUST 262 interpret the request as being for all of the resources listed. 264 actions The types of actions the RC will take at the RS 266 locations URIs the RC will call at the RS 268 datatypes types of data available to the RC at the RS's API 269 "resources": [ 270 { 271 "actions": [ 272 "read", 273 "write", 274 "dolphin" 275 ], 276 "locations": [ 277 "https://server.example.net/", 278 "https://resource.local/other" 279 ], 280 "datatypes": [ 281 "metadata", 282 "images" 283 ] 284 }, 285 "dolphin-metadata" 286 ] 288 This can also be presented as a set of resource handle references 289 Section 9.5, or a combination of handles and resource structures. 291 2.3. User 293 This section provides a verifiable assertion about the person 294 interacting with the RC on behalf of the request. This person MAY be 295 the RO or MAY be another party. 297 assertion The value of the assertion as a string. 299 type The type of the assertion. Possible values include 300 "oidc_id_token"... 302 "user": { 303 "assertion": "eyJraWQiOiIxZTlnZGs3IiwiYWxnIjoiUlMyNTYifQ.ewogImlzcyI6ICJodHRwOi8vc2VydmVyLmV4YW1wbGUuY29tIiwKICJzdWIiOiAiMjQ4Mjg5NzYxMDAxIiwKICJhdWQiOiAiczZCaGRSa3F0MyIsCiAibm9uY2UiOiAibi0wUzZfV3pBMk1qIiwKICJleHAiOiAxMzExMjgxOTcwLAogImlhdCI6IDEzMTEyODA5NzAsCiAibmFtZSI6ICJKYW5lIERvZSIsCiAiZ2l2ZW5fbmFtZSI6ICJKYW5lIiwKICJmYW1pbHlfbmFtZSI6ICJEb2UiLAogImdlbmRlciI6ICJmZW1hbGUiLAogImJpcnRoZGF0ZSI6ICIwMDAwLTEwLTMxIiwKICJlbWFpbCI6ICJqYW5lZG9lQGV4YW1wbGUuY29tIiwKICJwaWN0dXJlIjogImh0dHA6Ly9leGFtcGxlLmNvbS9qYW5lZG9lL21lLmpwZyIKfQ.rHQjEmBqn9Jre0OLykYNnspA10Qql2rvx4FsD00jwlB0Sym4NzpgvPKsDjn_wMkHxcp6CilPcoKrWHcipR2iAjzLvDNAReF97zoJqq880ZD1bwY82JDauCXELVR9O6_B0w3K-E7yM2macAAgNCUwtik6SjoSUZRcf-O5lygIyLENx882p6MtmwaL1hd6qn5RZOQ0TLrOYu0532g9Exxcm-ChymrB4xLykpDj3lUivJt63eEGGN6DH5K6o33TcxkIjNrCD4XB1CKKumZvCedgHHF3IAK4dVEDSUoGlH9z4pP_eWYNXvqQOjGs-rDaQzUHl6cQQWNiDpWOl_lxXjQEvQ", 304 "type": "oidc_id_token" 305 } 307 This can also be presented as a user handle reference Section 9.6. 309 2.4. Interact 311 This section provides details of how the RC can interact with the RO. 312 All fields are OPTIONAL, and the RC MAY include multiple possible 313 interaction modes. If a field is not present, it is interpreted as 314 negative support for that feature. 316 callback If this object is present, it indicates the RC is capable 317 of receiving inbound messages from the RO's browser in response to 318 user interaction. This object contains the following fields: 320 uri REQUIRED. Indicates the URI to send the RO to after 321 interaction. This URI MAY be unique per transaction and MUST 322 be hosted or accessible by the RC. This URI MUST NOT contain 323 any fragment component. This URI MUST be protected by HTTPS, 324 be hosted on a server local to the user's browser 325 ("localhost"), or use an application-specific URI scheme. If 326 the RC needs any state information to tie to the front channel 327 interaction response, it MUST encode that into the callback 328 URI. The allowable URIs and URI patterns MAY be limited by the 329 AS based on the RC's presented key information. The callback 330 URI SHOULD be presented to the RO during the interaction phase 331 before redirect. 333 nonce REQUIRED. Unique value to be used in the calculation of 334 the "hash" query parameter on the callback URL, must be 335 sufficiently random to be unguessable by an attacker. MUST be 336 generated by the RC as a unique value for this transaction. 338 hash_method OPTIONAL. The signature mechanism to be used for the 339 callback hash in Section 3.3. Can be one of sha3 or sha2. If 340 absent, the default value is sha3. 342 redirect If this is set to true, the RC is capable of redirecting 343 the RO to an arbitrary interaction URL as described in Section 5. 344 The RC MAY communicate the URI to the user through a browser 345 redirection, a QR code, or some other mechanism. 347 user_code If this is set to true, the RC is capable of displaying a 348 short user code to the user and directing them to a fixed URL as 349 described in Section 5. 351 didcomm If this is set to true, the RC is capable of relaying a 352 DIDComm message to an agent or wallet. 354 didcomm_query If this is set to true, the RC is capable of relaying 355 a DIDComm query to an agent or wallet. 357 This section MUST NOT be represented by a handle reference. (Note: 358 this decision is largely due to the "callback" section being variable 359 per transaction. We could allow a handle but restrict it to non- 360 callback methods -- but in that case, it's simpler and shorter to 361 just send the booleans instead of having a special case.) 362 The following example is from an RC that can redirect to the 363 interaction endpoint and receive returns on a callback URI: 365 "interact": { 366 "redirect": true, 367 "callback": { 368 "uri": "https://example.com/client/123456", 369 "nonce": "VJLO6A4CAYLBXHTR0KRO" 370 } 371 } 373 2.5. Keys 375 This section lists the keys that the RC can present proof of 376 ownership. The RC MUST send at least one key. The RC MAY send more 377 than one key format, but all keys MUST be equivalent. 379 proof The form of proof that the RC will use when presenting the key 380 to the AS. The valid values of this field and the processing 381 requirements for each are detailed in Section 10. This field is 382 REQUIRED. 384 jwks Value of the public key as a JWK Set JSON object [Note: should 385 this be a single JWK instead? And do we want to bother with url- 386 based references?]. MUST contain an "alg" field which is used to 387 validate the signature. MUST contain the "kid" field to identify 388 the key in the signed object. 390 cert PEM serialized value of the certificate used for TLS 391 transactions, with optional internal whitespace. 393 cert#256 The certificate thumbprint calculated as per OAuth-MTLS 394 [I-D.ietf-oauth-mtls]. 396 did The DID URL identifying the key (or keys) used to sign this 397 request. 399 The RC MUST provide proof of possession of all presented 400 keysSection 10. All presented keys MUST be validated by the AS using 401 the method defined by proof. 403 This section MAY also be presented as a key handle reference 404 Section 9.7. The keys referenced by a handle MUST be validated by 405 the AS. 407 The following non-normative example shows three key types, with the 408 detached JWS proofing mechanism: 410 "keys": { 411 "proof": "jwsd", 412 "jwks": { 413 "keys": [ 414 { 415 "kty": "RSA", 416 "e": "AQAB", 417 "kid": "xyz-1", 418 "alg": "RS256", 419 "n": "kOB5rR4Jv0GMeLaY6_It_r3ORwdf8ci_JtffXyaSx8xY..." 420 } 421 ] 422 }, 423 "cert": "MIIEHDCCAwSgAwIBAgIBATANBgkqhkiG9w0BAQsFA...", 424 "did": "did:example:CV3BVVXK2PWWLCRQLRFU#xyz-1" 425 } 427 3. Interaction response 429 When evaluating a transaction request, the AS MAY determine that it 430 needs to have the RO present to interact with the AS before issuing a 431 token. This interaction can include the RO logging in to the AS, 432 authorizing the transaction, providing proof claims, determining if 433 the transaction decision should be remembered for the future, and 434 other items. 436 The AS responds to the RC based on the type of interaction supported 437 by the RC in the transaction request. The AS MAY respond with 438 multiple possible interaction methods to be chosen by the RC. For 439 example, if the RC indicates that it can handle redirects and user 440 codes and has a callback URI, it would send a transaction request 441 like this: 443 { 444 "interact": { 445 "redirect": true, 446 "user_code": true, 447 "callback": { 448 "uri": "https://client.example.net/return/123455", 449 "nonce": "LKLTI25DK82FX4T4QFZC" 450 } 451 }, 452 "resources": [ 453 "dolphin-metadata" 454 ], 455 "key": "7C7C4AZ9KHRS6X63AJAO", 456 "display": { 457 "name": "My Client Display Name", 458 "uri": "https://example.net/client" 459 } 460 } 462 The AS would then respond with a transaction response like this: 464 { 465 "interaction_url": "https://server.example.com/interact/4CF492MLVMSW9MKMXKHQ", 466 "server_nonce": "MBDOFXG4Y5CVJCX821LH", 467 "user_code": { 468 "url": "https://server.example.com/interact/device", 469 "code": "A1BC-3DFF" 470 }, 471 "handle": { 472 "value": "80UPRY5NM33OMUKMKSKU", 473 "type": "bearer" 474 } 475 } 477 This response MUST include a transaction handle as described in 478 Section 9.3 so that the transaction can continue after the user has 479 interacted. 481 3.1. Redirect interaction 483 If the RC supports a "redirect" style interaction, the AS creates a 484 unique interaction URL and returns it to the RC. This URL MUST be 485 associated with the current transaction and no other transaction. 487 interaction_url REQUIRED. The interaction URL that the RC will 488 direct the RO to. This URL MUST be unique to this transaction 489 request. The URL SHOULD contain a random portion of sufficient 490 entropy so as not to be guessable by the user. The URL MUST NOT 491 contain the transaction handle or any RC identifying information. 492 This URL MUST be protected by HTTPS. This URL MUST NOT contain 493 any fragment component. 495 handle REQUIRED. The transaction handle to use in the continue the 496 transaction Section 7. 498 { 499 "interaction_url": "https://server.example.com/interact/4CF492MLVMSW9MKMXKHQ", 500 "handle": { 501 "value": "80UPRY5NM33OMUKMKSKU", 502 "type": "bearer" 503 } 504 } 506 When the RC receives this response, it MUST launch the system 507 browser, redirect the RO through an HTTP 302 response, display the 508 URL through a scannable barcode, or otherwise send the RO to the 509 interaction URL. The RC MUST NOT modify the interaction URL or 510 append anything to it, including any query parameters, fragments, or 511 special headers. 513 The interaction URL MUST be reachable from the RO's browser, though 514 note that the RO MAY open the interaction URL on a separate device 515 from the RC itself. The interaction URL MUST be accessible from an 516 HTTP GET request, and MUST be protected by HTTPS or equivalent means. 518 Upon receiving an incoming request at the interaction URL, the AS 519 MUST determine the transaction associated with this unique URL. If 520 the transaction is not found, an error is returned to the end user 521 through the browser and the AS MUST NOT attempt to redirect to a 522 callback URL. When interacting with the RO, the AS MAY perform any 523 of the behaviors in the User Interaction section Section 5. 525 3.2. Interaction URI return 527 If the RC has supplied a callback URL in its interact request 528 Section 2.4, the AS returns a nonce in its interaction response. 530 server_nonce REQUIRED. A unique value from the server included in 531 the calculation of the "hash" value returned in the callback 532 response. REQUIRED if the client has sent a "callback" parameter 533 in its interaction request. 535 This example also includes the interaction URL from Section 3.1. 537 { 538 "interaction_url": "https://server.example.com/interact/4CF492MLVMSW9MKMXKHQ", 539 "server_nonce": "MBDOFXG4Y5CVJCX821LH", 540 "handle": { 541 "value": "80UPRY5NM33OMUKMKSKU", 542 "type": "bearer" 543 } 544 } 546 When interaction has concluded, the AS returns the user to the RC by 547 redirecting the RO's browser to the RC's callback URL presented at 548 the start of the transaction, with the addition of two query 549 parameters. 551 hash REQUIRED. The interaction hash value as described in 552 Section 3.3. 554 interact_ref REQUIRED. A shared secret associated with this 555 interaction. This value MUST be sufficiently random so as not to 556 be guessable by an attacker. This value MUST be associated by the 557 AS with the underlying transaction that is associated to with this 558 interaction. 560 The AS MUST properly process the callback parameter from the 561 interaction request as a URL, adding these values as query 562 parameters. The AS MUST NOT use simple string concatenation. For 563 example, for the callback URL of "https://example.com/client/123456", 564 the AS would add query parameters as follows (newlines added for 565 display purposes only): 567 https://example.com/client/123456 568 ?hash=p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A 569 &interact_ref=4IFWWIKYBC2PQ6U56NL1 571 Upon processing this request to the callback URL, the RC MUST 572 calculate the expected value of the "hash" parameter as described in 573 Section 3.3 and compare that value to the "hash" parameter on the 574 incoming request. 576 The RC also sends (the hash of? example here is not hashed) the 577 interaction reference as the "interact_ref" field of the transaction 578 continuation requestSection 7, using the transaction handle 579 Section 9.3 returned in the most recent transaction response from the 580 AS. 582 { 583 "handle": "80UPRY5NM33OMUKMKSKU", 584 "interact_ref": "4IFWWIKYBC2PQ6U56NL1" 585 } 587 3.3. Calculating the interaction hash 589 The "hash" parameter in the interaction response ties the front 590 channel response to a transaction by using values known only to the 591 parties in the transaction. To calculate the "hash" value for the 592 interaction response, the party doing the calculation first takes the 593 "nonce" value sent by the RC in the interaction section of the 594 initial transaction request Section 2.4, the "server_nonce" value 595 returned in the transaction response Section 3.2, and the 596 "interact_ref" returned in the callback response Section 3.2. These 597 three values are concatenated to each other in this order using a 598 single newline character as a separator between the fields. There is 599 no padding or whitespace before or after any of the lines, and no 600 trailing newline character. 602 VJLO6A4CAYLBXHTR0KRO 603 MBDOFXG4Y5CVJCX821LH 604 4IFWWIKYBC2PQ6U56NL1 606 The party then hashes this string with the appropriate algorithm 607 based on the "hash_method" parameter of the "callback" section of the 608 interaction request (Section 2.4). If the "hash_method" value is not 609 present in the RC's request, the AS defaults to "sha3". 611 3.3.1. SHA3 613 The "sha3" hash method consists of hashing the string with the 614 512-bit SHA3 algorithm. The byte array is then encoded using URL 615 Safe Base64 with no padding. The resulting string is the hash value. 617 p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A 619 3.3.2. SHA2 621 The "sha2" hash method consists of hashing the string with the 622 512-bit SHA2 algorithm. The byte array is then encoded using URL 623 Safe Base64 with no padding. The resulting string is the hash value. 625 62SbcD3Xs7L40rjgALA-ymQujoh2LB2hPJyX9vlcr1H6ecChZ8BNKkG_HrOKP_Bpj84rh4mC9aE9x7HPBFcIHw 626 3.4. Secondary device interaction 628 If the RC supports a "user_code" style interaction, the AS creates a 629 unique user interaction code and returns it to the RC. The RC 630 communicates this code to the RO and instructs the RO to enter the 631 code at a URL hosted by the AS. 633 user_code REQUIRED. An object containing the user code information. 635 user_code REQUIRED. A short code that the user can type into an 636 authorization server. This string MUST be case-insensitive, 637 MUST consist of only easily typeable characters (such as 638 letters or numbers). The time in which this code will be 639 accepted SHOULD be short lived, such as several minutes. 641 user_code_url RECOMMENDED. The interaction URL that the RC will 642 direct the RO to. This URL SHOULD be stable at the AS such 643 that clients can be statically configured with it. 645 wait RECOMMENDED. The amount of time to wait before polling again, 646 in integer seconds. If not specified, the default is 30 seconds. 647 See Section 4. 649 handle REQUIRED. The transaction handle to use in the continue 650 request. See the section on transaction handlesSection 9.3. 652 { 653 "user_code": { 654 "url": "https://server.example.com/interact/device", 655 "code": "A1BC-3DFF" 656 }, 657 "wait": 30, 658 "handle": { 659 "value": "80UPRY5NM33OMUKMKSKU", 660 "type": "bearer" 661 } 662 } 664 When the RC receives this response, it MUST communicate the user code 665 to the RO. If possible the RC SHOULD communicate the interaction URL 666 to the user as well. However, the URL is generally understood to be 667 stable over time for a given service, and this URL MAY be 668 communicated through a static means such as the device's 669 documentation or packaging. 671 When the RO enters the unique user code at the user code URL, the AS 672 MUST determine which active transaction is associated with the user 673 code. If a transaction is not found, the AS MUST return an error 674 page to the user and MUST NOT attempt to redirect to a callback URL. 675 The AS MAY use any mechanism to interact with the RO as listed in 676 Section 5. 678 Note that this method is strictly for allowing the user to enter a 679 code at a static URL. If the AS wishes to communicate a pre-composed 680 URL to the RO containing both the user code and the URL at which to 681 enter it, the AS MUST use the "interaction_url" Section 3.1 redirect 682 mechanism instead as this allows the client to communicate an 683 arbitrary interaction URL to the RO. 685 4. Wait response 687 If the AS needs the RC to wait before it can give a definitive 688 response to a transaction continue requestSection 7, the AS replies 689 to the transaction request with a wait response. This tells the RC 690 that it can poll the transaction after a set amount of time. 692 This response includes a transaction handle as in Transaction Handle 693 Section 9.3. 695 wait REQUIRED. The amount of time to wait before polling again, in 696 integer seconds. 698 handle REQUIRED. The transaction handle to use in the continue 699 request. This MUST be a newly-created handle and MUST replace any 700 existing handle for this transaction. See the section on 701 transaction handles. 703 { 704 "wait": 30, 705 "handle": { 706 "value": "80UPRY5NM33OMUKMKSKU", 707 "type": "bearer" 708 } 709 } 711 5. Interaction at the AS 713 When the RO is interacting with the AS at the interaction uri, the AS 714 MAY perform whatever actions it sees fit, including but not limited 715 to: 717 o authenticate the RO 719 o gather identity claims about the RO 721 o gather consent and authorization from the RO 722 o allow the RO to modify the parameters of the requested transaction 723 (such as disallowing some requested resources) 725 When the AS has concluded interacting with the RO, the AS MUST 726 determine if the RC has registered a callback URL and nonce parameter 727 for this transaction. If so, the AS MUST redirect the RO's browser 728 to the callback URL as described in Section 3. If the AS detects an 729 error condition, such as an unknown transaction, an untrustworthy 730 callback URL, an untrustworthy client, or suspicious RO behavior, the 731 AS MUST return an error to the RO's browser and MUST NOT redirect to 732 the callback URL. 734 6. Error response 736 If the AS determines that the token cannot be issued for any reason, 737 it responds to the RC with an error message. This message does not 738 include a transaction handle, and the RC can no longer poll for this 739 transaction. The RC MAY create a new transaction and start again. 741 error The error code. 743 { 745 "error": "user_denied" 747 } 749 TODO: we should have a more robust error mechanism. Current 750 candidate list of errors: 752 user_denied The RO denied the transaction request. 754 too_fast The RC did not respect the timeout in the wait response. 756 unknown_transaction The transaction continuation request referenced 757 an unknown transaction. 759 unknown_handle The request referenced an unknown handle. 761 7. Transaction continue request 763 Once a transaction has begun, the AS associates that transaction with 764 a transaction handleSection 9.3 which is returned to the RC in one of 765 the transaction responses Section 3.1, Section 3.4, Section 4. This 766 handle MUST be unique, MUST be associated with a single transaction, 767 and MUST be one time use. 769 The RC continues the transaction by making a request with the 770 transaction handle in the body of the request. The RC MAY add 771 additional fields to the transaction continuation request, such as 772 the interaction reference return in the callback response Section 3. 774 handle REQUIRED. The (hash of?) transaction handle indicating which 775 transaction to continue. 777 interaction_handle OPTIONAL. If the RC has received an interaction 778 handle from the callback response of the interaction URL, the RC 779 MUST include the (hash of?) that handle in its transaction 780 continue request. 782 { 784 "handle": "tghji76ytghj9876tghjko987yh" 786 } 788 The RC MUST prove all keys initially sent in the transaction 789 requestSection 2.5 as described in Section 10. 791 [[ Note: should we allow the client to mutate the transaction at this 792 point? We already allow the presentation of the interaction handle, 793 and any messaging protocols like DIDComm would allow additional work 794 to be done here. But do we want the client to be able to specify 795 additional resources, or new interaction methods, or anything like 796 that? I'm inclined not to so that's been left out for now. ]] 798 8. Token response 800 access_token The access token that the RC uses to call the RS. The 801 access token follows the handle structure described in Section 9. 803 handle The transaction handle to use in the continue 804 requestSection 7 to get a new access token once the one issued is 805 no longer usable. See the section on transaction 806 handlesSection 9.3. 808 { 809 "access_token": { 810 "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0", 811 "type": "bearer" 812 }, 813 "handle": { 814 "value": "80UPRY5NM33OMUKMKSKU", 815 "type": "bearer" 816 } 817 } 819 8.1. Presenting Tokens to the RS 821 A bearer style access token MUST be presented using the Header method 822 of OAuth 2 Bearer Tokens [RFC6750]. A sha3 style access token is 823 hashed as described in Section 9.1 and presented using the Header 824 method of OAuth 2 Bearer Tokens [RFC6750]. 826 An access token MAY be bound to any keys presented by the client 827 during the transaction request. A bound access token MUST be 828 presented with proof of the key as described in Section 10. 830 9. Handles 832 A handle in this protocol is a value presented from one party to 833 another as proof that they are the appropriate party for part of the 834 transaction. Handles can be used to reference the transaction as a 835 whole, or one of its constituent parts. When a handle is used to 836 represent a part of a transaction request, the handle presentation 837 replaces the original value. In practical terms, this often means 838 that the values of a transaction request are either an object (when 839 the full value is used) or a single string (when the handle is used). 841 value The value of the handle as a string. 843 method The verification method, MUST be one of "bearer" or "sha3". 845 9.1. Presenting handles 847 Bearer handles are presented by giving the exact string value of the 848 handle in the appropriate place. 850 SHA3 handles are validated by taking the SHA3 hash of the handle 851 value and encoding it in Base64URL with no padding, and presenting 852 the encoded value. 854 9.2. Validating handles 856 Bearer handles are validated by doing an exact byte comparison of the 857 string representation of the handle value. 859 SHA3 handles are validated by taking the SHA3 hash of the handle 860 value and encoding it in Base64URL with no padding, and comparing 861 that using an exact byte comparison with the presented value. 863 9.3. Transaction handles 865 Transaction handles are issued by the AS to the RC to allow the RC to 866 continue a transaction after every step. A transaction handle MUST 867 be discarded after it is used by both the AS and the RC. A 868 transaction MUST have only a single handle associated with it at any 869 time. If the AS determines that the RC can still continue the 870 transaction after a handle has been used, a new transaction handle 871 will be issued in its place. If the AS does not issue a transaction 872 handle in its response to the RC, the RC MUST NOT continue that 873 transaction. 875 Transaction handles always represent the current state of the 876 transaction which they reference. 878 Transactions can be continued by the RC if the AS needs to interact 879 with the ROSection 5 and the RC is expecting a callbackSection 3 or 880 if the AS is still waiting on some external conditionSection 4 while 881 the RC is polling. The transaction MAY also be continued after an 882 access token is issued Section 8 as a means of refreshing an access 883 token with the same rights associated with the transaction. 885 9.4. Display handles 887 RC handles stand in for the display section of the initial 888 transaction requestSection 2.1. The AS MAY issue a display handle to 889 a RC as part of a static registration process, analogous to a client 890 ID in OAuth 2, allowing the RC to be associated with an AS-side 891 configuration that does not change at runtime. Such static processes 892 SHOULD be bound to a set of keys known only to the RC software. 894 Display handles MAY be issued by the RS in response to a transaction 895 request. The AS MAY associate the display handle to the interact, 896 resource, and key handles issued in the same response, requiring them 897 to be used together. When the RC receives this handle, it MAY 898 present the handle in future transaction requests instead of sending 899 its information again. 901 { 902 "handle": { 903 "value": "80UPRY5NM33OMUKMKSKU", 904 "type": "bearer" 905 }, 906 "display_handle": { 907 "value": "VBUEOIQA82PBY2ZDJW7Q", 908 "type": "bearer" 909 } 910 } 912 The RC sends its handle in lieu of the display block of the 913 transaction request: 915 { 917 "display": "absc2948afgdkjnasdf9082ur3kjasdfasdf89" 919 } 921 9.5. Resource handles 923 Resource handles stand in for the detailed resource request in the 924 transaction requestSection 2.2. Resource handles MAY be created by 925 the authorization server as static stand-ins for specific resource 926 requests, analogous to OAuth2 scopes. 928 Resource handles MAY be issued by the RS in response to a transaction 929 request. In such cases, the resource handle returned represents the 930 total of all resources 932 { 933 "wait": 30, 934 "handle": { 935 "value": "80UPRY5NM33OMUKMKSKU", 936 "type": "bearer" 937 }, 938 "resources_handle": { 939 "value": "KLKP36N7GPOKRF3KGH5N", 940 "type": "bearer" 941 } 942 } 944 The RC sends its handle in lieu of the resource block of the future 945 transaction request: 947 { 949 "resources": ["KLKP36N7GPOKRF3KGH5N"] 951 } 953 Note that handles and object values MAY be combined in a single 954 request. 956 { 957 "resources": [ 958 { 959 "actions": [ 960 "read", 961 "write", 962 "dolphin" 963 ], 964 "locations": [ 965 "https://server.example.net/", 966 "https://resource.local/other" 967 ], 968 "datatypes": [ 969 "metadata", 970 "images" 971 ] 972 }, 973 "dolphin-metadata", 974 "KLKP36N7GPOKRF3KGH5N" 975 ] 976 } 978 9.5.1. Resource-first 980 [[ Strawman idea: ]] 982 In order to facilitate dynamic API protection, an RS MAY pre-register 983 a resource handle in response to an unauthorized request from the RC. 984 In this scenario, the RS creates a transaction request with no client 985 information but describing the resources being protected [[Note: this 986 is currently at odds with the required format above, perhaps this 987 should be a special mode or flag? We could still use the "keys" 988 section here though.]] The AS returns a resource handle to the RS, 989 which then communicates both the resource handle and the AS 990 transaction endpoint to the RC. The RC then begins its transaction 991 as normal, using the resource handle as one of perhaps several 992 resources it requests. 994 9.6. User handles 996 User handles MAY be issued by the AS in response to validating a 997 specific RO during a transaction and stand in for the user section of 998 a transaction requestSection 2.3. This handle MAY refer to the RO 999 that interacted with the AS, the user presented by claims in the 1000 transaction request, or a combination of these. This handle can be 1001 used in future transactions to represent the current user, analogous 1002 to the persistent claims token of UMA 2. 1004 { 1005 "wait": 30, 1006 "handle": { 1007 "value": "80UPRY5NM33OMUKMKSKU", 1008 "type": "bearer" 1009 }, 1010 "user_handle": { 1011 "value": "XUT2MFM1XBIKJKSDU8QM", 1012 "type": "bearer" 1013 } 1014 } 1016 The RC sends its handle in lieu of the user block of the transaction 1017 request: 1019 { 1021 "user": "XUT2MFM1XBIKJKSDU8QM" 1023 } 1025 9.7. Key handles 1027 Key handles stand in for the keys section of the initial transaction 1028 requestSection 2.5. The AS MAY issue a key handle to a RC as part of 1029 a static registration process, allowing the RC to be associated with 1030 an AS-side configuration that does not change at runtime. 1032 Key handles MAY be issued by the AS in response to a transaction 1033 request. The AS SHOULD bind this handle to the display, resource, 1034 and user handles issued in the same response. When the RC receives 1035 this handle, it MAY present the handle in future transaction requests 1036 instead of sending its information again. 1038 { 1039 "wait": 30, 1040 "handle": { 1041 "value": "80UPRY5NM33OMUKMKSKU", 1042 "type": "bearer" 1043 }, 1044 "key_handle": { 1045 "value": "7C7C4AZ9KHRS6X63AJAO", 1046 "type": "bearer" 1047 } 1048 } 1050 The RC sends its handle in lieu of the keys block of the transaction 1051 request: 1053 { 1055 "keys": "7C7C4AZ9KHRS6X63AJAO" 1057 } 1059 When the AS receives a key handle, it MUST validate that the keys 1060 referenced by the handle are bound to the current transaction request 1061 using the proof method referenced by the handle. 1063 10. Binding Keys 1065 Any keys presented by the RC to the AS or RS MUST be validated as 1066 part of the transaction in which they are presented.The type of 1067 binding used is indicated by the proof parameter of the keys section 1068 in the transaction request. Values defined by this specification are 1069 as follows: 1071 jwsd A detached JWS signature header 1073 mtls Mutual TLS certificate verification 1075 dpop OAuth DPoP key proof header 1077 httpsig HTTP Signing signature header 1079 oauthpop OAuth PoP key proof authentication header 1081 Additional values can be defined by a registry. 1083 All keys presented by the RC in the transaction requestSection 2 MUST 1084 be proved in all transaction continuation requestsSection 7 for that 1085 transaction. The AS MUST validate all keys presented by the RC or 1086 referenced in the transaction at each call to the transaction 1087 endpoint. The client MUST NOT use a different key during the 1088 transaction. 1090 10.1. Detached JWS 1092 This method is indicated by "jwsd" in the "proof" field of a key 1093 request. To sign a request to the transaction endpoint, the RC takes 1094 the serialized body of the request and signs it using detached JWS 1095 [RFC7797]. The header of the JWS MUST contain the kid field of the 1096 key bound to this RC during this transaction. The JWS header MUST 1097 contain an alg field appropriate for the key identified by kid and 1098 MUST NOT be none. 1100 The RC presents the signature in the JWS-Signature HTTP Header field. 1101 [Note: this is a custom header field, do we need this?] 1103 JWS-Signature: eyj0.... 1105 When the AS receives the JWS-Signature header, it MUST parse its 1106 contents as a detached JWS object. The HTTP Body is used as the 1107 payload for purposes of validating the JWS, with no transformations. 1109 10.2. Mutual TLS 1111 This method is indicated by "mtls" in the "proof" field of a key 1112 request. The RC presents its client certificate during TLS 1113 negotiation with the server (either AS or RS). The AS or RS takes 1114 the thumbprint of the client certificate presented during mutual TLS 1115 negotiation and compares that thumbprint to the thumbprint presented 1116 by the RC application as described in [I-D.ietf-oauth-mtls] section 1117 3. 1119 10.3. DPoP 1121 This method is indicated by "dpop" in the "proof" field of a key 1122 request. The RC creates a DPoP signature header as described in 1123 [I-D.fett-oauth-dpop] section 2. 1125 10.4. HTTP Signing 1127 This method is indicated by "httpsig" in the "proof" field of a key 1128 request. The RC creates an HTTP Signature header as described in 1129 [I-D.cavage-http-signatures] section 4. The RC MUST calculate and 1130 present the Digest header as defined in [RFC3230]. 1132 10.5. OAuth PoP 1134 This method is indicated by "oauthpop" in the "proof" field of a key 1135 request. The RC creates an HTTP Authorization PoP header as 1136 described in [I-D.ietf-oauth-signed-http-request] section 4, with the 1137 following additional requirements: 1139 o The at (access token) field MUST be omitted [note: this is in 1140 contrast to the requirements in the existing spec] 1142 o The b (body hash) field MUST be calculated and supplied 1144 11. Acknowledgements 1146 12. IANA Considerations 1148 [We'll want a registry for key proof types, and maybe some other 1149 field names. We'll need to register at least one header and maybe 1150 some others?] 1152 13. Security Considerations 1154 All requests have to be over TLS or equivalent. Many handles act as 1155 shared secrets, though they can be combined with a requirement to 1156 provide proof of a key as well. 1158 14. Privacy Considerations 1160 Handles are passed between parties and therefore should be stateful 1161 and not contain any internal structure or information, which could 1162 leak private data. 1164 15. Normative References 1166 [BCP195] Sheffer, Y., Holz, R., and P. Saint-Andre, 1167 "Recommendations for Secure Use of Transport Layer 1168 Security (TLS) and Datagram Transport Layer Security 1169 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 1170 2015, . 1172 [I-D.cavage-http-signatures] 1173 Cavage, M. and M. Sporny, "Signing HTTP Messages", draft- 1174 cavage-http-signatures-12 (work in progress), October 1175 2019. 1177 [I-D.fett-oauth-dpop] 1178 Fett, D., Campbell, B., Bradley, J., Lodderstedt, T., 1179 Jones, M., and D. Waite, "OAuth 2.0 Demonstration of 1180 Proof-of-Possession at the Application Layer (DPoP)", 1181 draft-fett-oauth-dpop-03 (work in progress), October 2019. 1183 [I-D.ietf-oauth-mtls] 1184 Campbell, B., Bradley, J., Sakimura, N., and T. 1185 Lodderstedt, "OAuth 2.0 Mutual-TLS Client Authentication 1186 and Certificate-Bound Access Tokens", draft-ietf-oauth- 1187 mtls-17 (work in progress), August 2019. 1189 [I-D.ietf-oauth-signed-http-request] 1190 Richer, J., Bradley, J., and H. Tschofenig, "A Method for 1191 Signing HTTP Requests for OAuth", draft-ietf-oauth-signed- 1192 http-request-03 (work in progress), August 2016. 1194 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1195 Requirement Levels", BCP 14, RFC 2119, 1196 DOI 10.17487/RFC2119, March 1997, 1197 . 1199 [RFC3230] Mogul, J. and A. Van Hoff, "Instance Digests in HTTP", 1200 RFC 3230, DOI 10.17487/RFC3230, January 2002, 1201 . 1203 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 1204 RFC 6749, DOI 10.17487/RFC6749, October 2012, 1205 . 1207 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 1208 Framework: Bearer Token Usage", RFC 6750, 1209 DOI 10.17487/RFC6750, October 2012, 1210 . 1212 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 1213 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 1214 . 1216 [RFC7662] Richer, J., Ed., "OAuth 2.0 Token Introspection", 1217 RFC 7662, DOI 10.17487/RFC7662, October 2015, 1218 . 1220 [RFC7797] Jones, M., "JSON Web Signature (JWS) Unencoded Payload 1221 Option", RFC 7797, DOI 10.17487/RFC7797, February 2016, 1222 . 1224 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 1225 Writing an IANA Considerations Section in RFCs", BCP 26, 1226 RFC 8126, DOI 10.17487/RFC8126, June 2017, 1227 . 1229 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1230 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1231 May 2017, . 1233 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 1234 Interchange Format", STD 90, RFC 8259, 1235 DOI 10.17487/RFC8259, December 2017, 1236 . 1238 Appendix A. Document History 1240 - 04 1242 o Added crypto agility for callback return hash. 1244 o Changed "interaction_handle" to "interaction_ref". 1246 - 03 1248 o Removed "state" in favor of "nonce". 1250 o Created signed return parameter for front channel return. 1252 o Changed "client" section to "display" section, as well as 1253 associated handle. 1255 o Changed "key" to "keys". 1257 o Separated key proofing from key presentation. 1259 o Separated interaction methods into booleans instead of "type" 1260 field. 1262 - 02 1264 o Minor editorial cleanups. 1266 - 01 1268 o Made JSON multimodal for handle requests. 1270 o Major updates to normative language and references throughout 1271 document. 1273 o Allowed interaction to split between how the user gets to the AS 1274 and how the user gets back. 1276 - 00 1278 o Initial submission. 1280 Author's Address 1282 Justin Richer (editor) 1283 Bespoke Engineering 1285 Email: ietf@justin.richer.org