Web Authorization Protocol                                T. Lodderstedt
Internet-Draft                                                   yes.com
Intended status: Standards Track                               J. Richer
Expires: March 23, 2020                              Bespoke Engineering
                                                             B. Campbell
                                                           Ping Identity
                                                      September 20, 2019

                 OAuth 2.0 Rich Authorization Requests


   This document specifies a new parameter "authorization_details" that
   is used to carry fine grained authorization data in the OAuth
   authorization request.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on March 23, 2020.

Copyright Notice

   Copyright (c) 2019 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (https://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of

Lodderstedt, et al.      Expires March 23, 2020                 [Page 1]

Internet-Draft                  oauth-rar                 September 2019

   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Conventions and Terminology . . . . . . . . . . . . . . .   3
   2.  Request parameter "authorization_details" . . . . . . . . . .   3
     2.1.  Authorization data elements types . . . . . . . . . . . .   5
     2.2.  Using "authorization_details" . . . . . . . . . . . . . .   7
     2.3.  Authorization Request Processing  . . . . . . . . . . . .   9
     2.4.  Token Response  . . . . . . . . . . . . . . . . . . . . .  10
     2.5.  Relationship to "resource" parameter  . . . . . . . . . .  11
   3.  Metadata  . . . . . . . . . . . . . . . . . . . . . . . . . .  12
   4.  Implementation Considerations . . . . . . . . . . . . . . . .  12
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .  13
   6.  Privacy Considerations  . . . . . . . . . . . . . . . . . . .  13
   7.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .  13
   8.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  14
   9.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  14
     9.1.  Normative References  . . . . . . . . . . . . . . . . . .  14
     9.2.  Informative References  . . . . . . . . . . . . . . . . .  14
   Appendix A.  Document History . . . . . . . . . . . . . . . . . .  15
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  15

1.  Introduction

   The OAuth 2.0 authorization framework [RFC6749] defines the parameter
   "scope" that allows OAuth clients to specify the requested scope,
   i.e., the permission, of an access token.  This mechanism is
   sufficient to implement static scenarios and coarse-grained
   authorization requests, such as "give me read access to the resource
   owner's profile" but it is not sufficient to specify fine-grained
   authorization requirements, such as "please let me make a payment
   with the amount of 45 Euros" or "please give me read access to folder
   A and write access to file X".

   This draft introduces a new parameter "authorization_details" that
   allows clients to specify their fine-grained authorization
   requirements using the expressiveness of JSON data structures.

   For example, a request for payment authorization can be represented
   using a JSON object like this:

Lodderstedt, et al.      Expires March 23, 2020                 [Page 2]

Internet-Draft                  oauth-rar                 September 2019

      "type": "payment_initiation",
      "remittanceInformationUnstructured":"Ref Number Merchant"

   In addition to facilitating custom authorization requests, this draft
   also introduces a set of common data type fields for use across
   different APIs.

   For a comprehensive discussion of the challenges arising from new use
   cases in the open banking and electronic signing spaces see

1.1.  Conventions and Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "OPTIONAL" in this document are to be interpreted as described in BCP
   14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

   This specification uses the terms "access token", "refresh token",
   "authorization server", "resource server", "authorization endpoint",
   "authorization request", "authorization response", "token endpoint",
   "grant type", "access token request", "access token response", and
   "client" defined by The OAuth 2.0 Authorization Framework [RFC6749].

2.  Request parameter "authorization_details"

   The request parameter "authorization_details" contains a JSON array
   of JSON objects.  Each JSON object contains the data to specify the
   authorization requirements for a certain type of resource.  The type
   of resource or access requirement is determined by the "type" field.

Lodderstedt, et al.      Expires March 23, 2020                 [Page 3]

Internet-Draft                  oauth-rar                 September 2019

   This example shows the specification of authorization details for a
   payment initiation transaction:

         "type": "payment_initiation",
         "actions": ["initiate", "status", "cancel"],
         "remittanceInformationUnstructured":"Ref Number Merchant"

   This example shows a combined request asking for access to account
   information and permission to initiate a payment:

Lodderstedt, et al.      Expires March 23, 2020                 [Page 4]

Internet-Draft                  oauth-rar                 September 2019

         "type": "account_information",
           ["list_accounts", "read_balances", "read_transactions"],
         "identifier": "abc-123565",
         "locations": [
         "type": "payment_initiation",
         "actions": ["initiate", "status", "cancel"],
         "remittanceInformationUnstructured":"Ref Number Merchant"

   The JSON objects with "type" fields of "account_information" and
   "payment_initiation" represent the different authorization data to be
   used by the AS to ask for consent and MUST subsequently also be made
   available to the respective resource servers.  The array MAY contain
   several elements of the same "type".

2.1.  Authorization data elements types

   This draft defines a set of common data elements that are designed to
   be usable across different types of APIs.  These data elements MAY be
   combined in different ways depending on the needs of the API.  Unless
   otherwise noted, all data elements are OPTIONAL.

      The type of resource request as a string.  This field MAY define
      which other elements are allowed in the request.  This element is

Lodderstedt, et al.      Expires March 23, 2020                 [Page 5]

Internet-Draft                  oauth-rar                 September 2019

      An array of strings representing the location of the resource or
      resource server.  This is typically composed of URIs.

      An array of strings representing the kinds of actions to be taken
      at the resource.  The values of the strings are determined by the
      API being protected.

      An array of strings representing the kinds of data being requested
      from the resource.

      A string identifier indicating a specific resource available at
      the API.

   An API MAY define its own extensions, subject to the "type" of the
   request.  It is assumed that the full structure of each of the
   authorization data elements is tailored to the needs of a certain
   application, API, or resource type.  The example structures shown
   above are based on certain kinds of APIs that can be found in the
   Open Banking space.

   Note: Applications MUST ensure that their authorization data types do
   not collide.  This is either achieved by using a namespace under the
   control of the entity defining the type name or by registering the
   type with the new "OAuth Authorization Data Type Registry" (see
   Section 8).

   The following example shows how an implementation could utilize the
   namespace "https://scheme.example.org/" to ensure collision resistant
   element names.

Lodderstedt, et al.      Expires March 23, 2020                 [Page 6]

Internet-Draft                  oauth-rar                 September 2019


2.2.  Using "authorization_details"

   The request parameter can be used anywhere where the "scope"
   parameter is used, examples include:

   o  Authorization requests as specified in [RFC6749],

   o  Access token requests as specified in [RFC6749],

   o  Request objects as specified in [I-D.ietf-oauth-jwsreq],

   o  Device Authorization Request as specified in [RFC8628].

   Parameter encoding is determined by the respective context.

   In the context of an authorization request according to [RFC6749],
   the parameter is encoded using the "application/x-www-form-
   urlencoded" format as shown in the following example (JSON string
   trimmed for brevity):

Lodderstedt, et al.      Expires March 23, 2020                 [Page 7]

Internet-Draft                  oauth-rar                 September 2019

   GET /authorize?response_type=code&client_id=s6BhdRkqt3
       5D%0A%20%20%20 HTTP/1.1
   Host: server.example.com

   In the context of a request object as specified in
   [I-D.ietf-oauth-jwsreq], "authorization_details" is added as another
   top level JSON element.

Lodderstedt, et al.      Expires March 23, 2020                 [Page 8]

Internet-Draft                  oauth-rar                 September 2019

           "type": "https://www.someorg.com/payment_initiation",
           "actions": ["initiate", "status", "cancel"],
           "remittanceInformationUnstructured":"Ref Number Merchant"

   Note: Authorization request URIs containing authorization details in
   a request parameter or a request object can become very long.
   Implementers SHOULD therefore consider using the "request_uri"
   parameter as defined in [I-D.ietf-oauth-jwsreq], potentially in
   combination with the pushed request object mechanism as defined in
   [I-D.lodderstedt-oauth-par] to pass authorization details in a
   reliable and secure manner.

2.3.  Authorization Request Processing

   Based on the data provided in the "authorization_details" parameter
   the AS will ask the user for consent to the requested access

Lodderstedt, et al.      Expires March 23, 2020                 [Page 9]

Internet-Draft                  oauth-rar                 September 2019

   Note: The AS is supposed to merge the authorization requirements
   given in the "scope" parameter and the "authorization_details"
   parameter if both are present in the authorization request.

   The AS MUST refuse to process any unknown authorization data type.
   If the "authorization_details" contains any unknown authorization
   data type, the AS MUST abort processing and respond with an error
   "invalid_scope" to the client.

   If the resource owner grants the client the requested access, the AS
   will issue tokens to the client that are associated with the
   respective "authorization_details".

   The AS MUST make the "authorization_details" available to the
   respective resource servers.  The AS MAY add the
   "authorization_details" element to access tokens in JWT format and to
   Token Introspection responses.

   The AS MUST take into consideration the privacy implications when
   sharing authorization details with the resource servers.  The AS
   SHOULD share this data with the resource servers on a "need to know"

2.4.  Token Response

   In addition to the token response parameters as defined in [RFC6749],
   the authorization server MUST also return the authorization details
   as granted by the resource owner and assigned to the respective
   access token.

   This is shown in the following example:

Lodderstedt, et al.      Expires March 23, 2020                [Page 10]

Internet-Draft                  oauth-rar                 September 2019

        HTTP/1.1 200 OK
        Content-Type: application/json
        Cache-Control: no-cache, no-store

               "type": "https://www.someorg.com/payment_initiation",
               "actions": ["initiate", "status", "cancel"],
               "remittanceInformationUnstructured":"Ref Number Merchant"

2.5.  Relationship to "resource" parameter

   [I-D.ietf-oauth-resource-indicators] defines the request parameter
   "resource" indicating to the AS the resource(s) where the client
   intends to use the access tokens issued based on a certain grant.

   This mechanism is a way to audience-restrict access tokens and to
   allow the AS to create resource specific access tokens.

   This draft can be used in conjunction with
   [I-D.ietf-oauth-resource-indicators] in the same way as the "scope"
   parameter.  The AS is supposed to narrow down the authorization
   details and respective permissions to the needs of the particular
   resource when minting an access token.

Lodderstedt, et al.      Expires March 23, 2020                [Page 11]

Internet-Draft                  oauth-rar                 September 2019

   This depends, however, on the AS to know what authorization details
   are relevant for what RS.  The parameter introduced in this
   specification can also be combined with the concept of resource
   indicators to make this relationship explicit.  This enables the AS
   to narrow down the privileges of an access token to specific
   permissions for individual operations on specific resources (see
   [I-D.ietf-oauth-security-topics], section-3.3).

   The "locations" and the "identifier" elements together allow the AS
   to determine the resource a client wants to access as shown in
   following example:

         "type": "https://scheme.example.org/storage":

   The AS MUST respect those values when deciding whether a certain
   element is placed into a (structured) access token or token
   introspection response.

3.  Metadata

   The AS advertises support for "authorization_details" using the
   metadata parameter "authorization_details_supported" of type boolean.

   The authorization data types supported can be determined using the
   metadata parameter "authorization_data_types_supported", which is an
   JSON array.

   Clients announce the authorization data types they use in the new
   dynamic client registration parameter "authorization_data_types".

   The registration of new authorization data types with the AS is out
   of scope of this draft.

4.  Implementation Considerations

   The scheme and processing will vary significantly among different
   authorization data types.  Any implementation of this draft is
   therefore supposed to allow the customization of the user consent and
   the handling of access token data.

Lodderstedt, et al.      Expires March 23, 2020                [Page 12]

Internet-Draft                  oauth-rar                 September 2019

   One option would be to have a mechanism allowing the registration of
   extension modules, each of them responsible for rendering the
   respective user consent and any transformation needed to provide the
   data needed to the resource server by way of structured access tokens
   or token introspection responses.

5.  Security Considerations

   Authorization details are sent through the user agent in case of an
   OAuth authorization request, which makes them vulnerable to
   modifications by the user.  In order to ensure their integrity, the
   client SHOULD send authorization details in a signed request object
   as defined in [I-D.ietf-oauth-jwsreq] or use the "request_uri"
   authorization request parameter as defined in [I-D.ietf-oauth-jwsreq]
   to pass the URI of the request object to the authorization server.

6.  Privacy Considerations

   Implementers MUST design and use authorization details in a privacy
   preserving manner.

   Any sensitive personal data included in authorization details MUST be
   prevented from leaking, e.g., through referrer headers.
   Implementation options include encrypted request objects as defined
   in [I-D.ietf-oauth-jwsreq] or transmission of authorization details
   via end-to-end encrypted connections between client and authorization
   server by utilizing the "request_uri" authorization request parameter
   as defined in [I-D.ietf-oauth-jwsreq].

   Even if the request data are encrypted, an attacker could use the
   authorization server to learn the user data by injecting the
   encrypted request data into an authorization request on a device
   under his control and use the authorization server's user consent
   screens to show the (decrypted) user data in the clear.
   Implementations MUST consider this attacker vector and implement
   appropriate counter measures, e.g. by only showing portions of the
   data or, if possible, determing whether the assumed user context is
   still the same (after user authentication).

7.  Acknowledgements

   We would would like to thank Daniel Fett, Sebastian Ebling, Dave
   Tonge, Mike Jones, Nat Sakimura, and Rob Otto for their valuable
   feedback during the preparation of this draft.

   We would also like to thank Daniel Fett, Dave Tonge and Aaron Parecki
   for their valuable feedback to this draft.

Lodderstedt, et al.      Expires March 23, 2020                [Page 13]

Internet-Draft                  oauth-rar                 September 2019

8.  IANA Considerations


   o  "authorization_details" as JWT claim

   o  "authorization_details_supported" and
      "authorization_data_types_supported" as metadata parameters

   o  "authorization_data_types" as dynamic client registration

   o  establish authorization data type registry

9.  References

9.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,

   [RFC6749]  Hardt, D., Ed., "The OAuth 2.0 Authorization Framework",
              RFC 6749, DOI 10.17487/RFC6749, October 2012,

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [RFC8628]  Denniss, W., Bradley, J., Jones, M., and H. Tschofenig,
              "OAuth 2.0 Device Authorization Grant", RFC 8628,
              DOI 10.17487/RFC8628, August 2019,

9.2.  Informative References

              Sakimura, N. and J. Bradley, "The OAuth 2.0 Authorization
              Framework: JWT Secured Authorization Request (JAR)",
              draft-ietf-oauth-jwsreq-19 (work in progress), June 2019.

              Campbell, B., Bradley, J., and H. Tschofenig, "Resource
              Indicators for OAuth 2.0", draft-ietf-oauth-resource-
              indicators-08 (work in progress), September 2019.

Lodderstedt, et al.      Expires March 23, 2020                [Page 14]

Internet-Draft                  oauth-rar                 September 2019

              Lodderstedt, T., Bradley, J., Labunets, A., and D. Fett,
              "OAuth 2.0 Security Best Current Practice", draft-ietf-
              oauth-security-topics-13 (work in progress), July 2019.

              Lodderstedt, T., Campbell, B., Sakimura, N., Tonge, D.,
              and F. Skokan, "OAuth 2.0 Pushed Authorization Requests",
              draft-lodderstedt-oauth-par-00 (work in progress),
              September 2019.

              Lodderstedt, T., "Transaction Authorization or why we need
              to re-think OAuth scopes", Apr 2019, <https://medium.com/

Appendix A.  Document History

   [[ To be removed from the final specification ]]


   o  Added Security Considerations

   o  Added Privacy Considerations

   o  Added notes on URI size and authorization details

   o  Added requirement to return the effective authorization details
      granted by the resource owner in the token response

   o  changed "authorization_details" structure from object to array

   o  added Justin Richer & Brian Campbell as Co-Authors

   -00 / -01

   o  first draft

Authors' Addresses

   Torsten Lodderstedt

   Email: torsten@lodderstedt.net

Lodderstedt, et al.      Expires March 23, 2020                [Page 15]

Internet-Draft                  oauth-rar                 September 2019

   Justin Richer
   Bespoke Engineering

   Email: ietf@justin.richer.org

   Brian Campbell
   Ping Identity

   Email: bcampbell@pingidentity.com

Lodderstedt, et al.      Expires March 23, 2020                [Page 16]