GNAP                                                      J. Richer, Ed.
Internet-Draft                                       Bespoke Engineering
Intended status: Standards Track                              A. Parecki
Expires: 13 January 28 March 2022                                              Okta
                                                              F. Imbault
                                                                acert.io
                                                            12 July
                                                       24 September 2021

              Grant Negotiation and Authorization Protocol
                    draft-ietf-gnap-core-protocol-06
                    draft-ietf-gnap-core-protocol-07

Abstract

   GNAP defines a mechanism for delegating authorization to a piece of
   software, and conveying that delegation to the software.  This
   delegation can include access to a set of APIs as well as information
   passed directly to the software.

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 13 January 28 March 2022.

Copyright Notice

   Copyright (c) 2021 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 the Trust Legal Provisions and are
   provided without warranty as described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   4   5
     1.1.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   5   6
     1.2.  Roles . . . . . . . . . . . . . . . . . . . . . . . . . .   5   6
     1.3.  Elements  . . . . . . . . . . . . . . . . . . . . . . . .   8   9
     1.4.  Trust relationships . . . . . . . . . . . . . . . . . . .  10
     1.5.  Sequences . . . . . . . . . . . . . . . . . . . . . . . .   9
       1.4.1.  11
       1.5.1.  Redirect-based Interaction  . . . . . . . . . . . . .  12
       1.4.2.  15
       1.5.2.  User-code Interaction . . . . . . . . . . . . . . . .  15
       1.4.3.  18
       1.5.3.  Asynchronous Authorization  . . . . . . . . . . . . .  17
       1.4.4.  20
       1.5.4.  Software-only Authorization . . . . . . . . . . . . .  19
       1.4.5.  22
       1.5.5.  Refreshing an Expired Access Token  . . . . . . . . .  20
       1.4.6.  23
       1.5.6.  Requesting User Information . . . . . . . . . . . . .  22  25
   2.  Requesting Access . . . . . . . . . . . . . . . . . . . . . .  23  26
     2.1.  Requesting Access to Resources  . . . . . . . . . . . . .  25  28
       2.1.1.  Requesting a Single Access Token  . . . . . . . . . .  25  28
       2.1.2.  Requesting Multiple Access Tokens . . . . . . . . . .  28  31
     2.2.  Requesting Subject Information  . . . . . . . . . . . . .  30  33
     2.3.  Identifying the Client Instance . . . . . . . . . . . . .  31  34
       2.3.1.  Identifying the Client Instance by Reference  . . . .  32  35
       2.3.2.  Providing Displayable Client Instance Information . .  33  36
       2.3.3.  Authenticating the Client Instance  . . . . . . . . .  33  36
     2.4.  Identifying the User  . . . . . . . . . . . . . . . . . .  34  37
       2.4.1.  Identifying the User by Reference . . . . . . . . . .  35  38
     2.5.  Interacting with the User . . . . . . . . . . . . . . . .  35  38
       2.5.1.  Start Mode Definitions  . . . . . . . . . . . . . . .  37  40
       2.5.2.  Finish Interaction Modes  . . . . . . . . . . . . . .  38  41
       2.5.3.  Hints . . . . . . . . . . . . . . . . . . . . . . . .  41  44
       2.5.4.  Extending Interaction Modes . . . . . . . . . . . . .  41  44
     2.6.  Extending The Grant Request . . . . . . . . . . . . . . .  41  44
   3.  Grant Response  . . . . . . . . . . . . . . . . . . . . . . .  42  45
     3.1.  Request Continuation  . . . . . . . . . . . . . . . . . .  43  46
     3.2.  Access Tokens . . . . . . . . . . . . . . . . . . . . . .  44  47
       3.2.1.  Single Access Token . . . . . . . . . . . . . . . . .  45  48
       3.2.2.  Multiple Access Tokens  . . . . . . . . . . . . . . .  48  51
     3.3.  Interaction Modes . . . . . . . . . . . . . . . . . . . .  49  52
       3.3.1.  Redirection to an arbitrary URL . . . . . . . . . . .  50  53
       3.3.2.  Launch of an application URL  . . . . . . . . . . . .  51  54
       3.3.3.  Display of a Short User Code  . . . . . . . . . . . .  51  54
       3.3.4.  Interaction Finish  . . . . . . . . . . . . . . . . .  52  55
       3.3.5.  Extending Interaction Mode Responses  . . . . . . . .  53  56
     3.4.  Returning User Subject Information . . . . . . . . . . . . . . .  53  56
     3.5.  Returning Dynamically-bound Reference Handles . . . . . .  54  57
     3.6.  Error Response  . . . . . . . . . . . . . . . . . . . . .  56  58
     3.7.  Extending the Response  . . . . . . . . . . . . . . . . .  56  59
   4.  Determining Authorization and Consent . . . . . . . . . . . .  56  59
     4.1.  Interaction Start Methods . . . . . . . . . . . . . . . .  59  62
       4.1.1.  Interaction at a Redirected URI . . . . . . . . . . .  60  62
       4.1.2.  Interaction at the User Code URI  . . . . . . . . . .  60  63
       4.1.3.  Interaction through an Application URI  . . . . . . .  61  64
     4.2.  Post-Interaction Completion . . . . . . . . . . . . . . .  61  64
       4.2.1.  Completing Interaction with a Browser Redirect to the
               Callback URI  . . . . . . . . . . . . . . . . . . . .  62  65
       4.2.2.  Completing Interaction with a Direct HTTP Request
               Callback  . . . . . . . . . . . . . . . . . . . . . .  63  66
       4.2.3.  Calculating the interaction hash  . . . . . . . . . .  64  66
   5.  Continuing a Grant Request  . . . . . . . . . . . . . . . . .  65  68
     5.1.  Continuing After a Completed Interaction  . . . . . . . .  67  70
     5.2.  Continuing During Pending Interaction . . . . . . . . . .  68  71
     5.3.  Modifying an Existing Request . . . . . . . . . . . . . .  69  73
     5.4.  Canceling a Grant Request . . . . . . . . . . . . . . . .  75  78
   6.  Token Management  . . . . . . . . . . . . . . . . . . . . . .  75  79
     6.1.  Rotating the Access Token . . . . . . . . . . . . . . . .  75  79
     6.2.  Revoking the Access Token . . . . . . . . . . . . . . . .  77  81
   7.  Securing Requests from the Client Instance  . . . . . . . . .  78  82
     7.1.  Key Formats . . . . . . . . . . . . . . . . . . . . . . .  78  83
       7.1.1.  Key References  . . . . . . . . . . . . . . . . . . .  80  84
     7.2.  Presenting Access Tokens  . . . . . . . . . . . . . . . .  80  84
     7.3.  Proving Possession of a Key with a Request  . . . . . . .  81  85
       7.3.1.  HTTP Message Signing  . . . . . . . . . . . . . . . .  83  87
       7.3.2.  Mutual TLS  . . . . . . . . . . . . . . . . . . . . .  87  91
       7.3.3.  Detached JWS  . . . . . . . . . . . . . . . . . . . .  89  93
       7.3.4.  Attached JWS  . . . . . . . . . . . . . . . . . . . .  93  97
   8.  Resource Access Rights  . . . . . . . . . . . . . . . . . . .  97 101
     8.1.  Requesting Resources By Reference . . . . . . . . . . . . 100 104
   9.  Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . 102 106
     9.1.  RS-first Method of AS Discovery . . . . . . . . . . . . . 103 107
   10. Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . 105 109
   11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 105 109
   12. Security Considerations . . . . . . . . . . . . . . . . . . . 105
   13. Privacy Considerations 109
     12.1.  TLS Protection in Transit  . . . . . . . . . . . . . . . 109
     12.2.  Protection of Client Instance Key Material . . . . 105
   14. Normative References . . . 110
     12.3.  Protection of Authorization Server . . . . . . . . . . . 111
     12.4.  Symmetric and Asymmetric Client Instance Keys  . . . . . 112
     12.5.  Generation of Access Tokens  . 105
   Appendix A.  Document History . . . . . . . . . . . . . 113
     12.6.  Bearer Access Tokens . . . . . 108
   Appendix B.  Compared to OAuth 2.0 . . . . . . . . . . . . . 114
     12.7.  Key-Bound Token Access Tokens  . . 110
   Appendix C.  Component Data Models . . . . . . . . . . . 114
     12.8.  Exposure of End-user Credentials to Client Instance  . . 115
     12.9.  Mixing Up Authorization Servers  . . 113
   Appendix D.  Example Protocol Flows . . . . . . . . . . 116
     12.10. Processing of Client-Presented User Information  . . . . 117
     12.11. Client Instance Pre-registration . 113
     D.1.  Redirect-Based User Interaction . . . . . . . . . . . 118
     12.12. Client Instance Impersonation  . . 113
     D.2.  Secondary Device Interaction . . . . . . . . . . . 119
     12.13. Interception of Information in the Browser . . . 117
     D.3.  No User Involvement . . . . 120
     12.14. Callback URL Manipulation  . . . . . . . . . . . . . . . 120
     D.4.  Asynchronous Authorization  .
     12.15. MTLS Deployment Patterns . . . . . . . . . . . . . . 121
     D.5.  Applying OAuth 2.0 Scopes and Client IDs . . 121
     12.16. Interception of Responses from the AS  . . . . . . 124
   Appendix E.  JSON Structures and Polymorphism . . . 121
     12.17. Key Distribution . . . . . . . 126
   Authors' Addresses . . . . . . . . . . . . . 122
     12.18. Interaction Finish Modes and Polling . . . . . . . . . . 127

1.  Introduction

   This protocol allows a piece 122
     12.19. Storage of software, the client instance, to
   request delegated authorization to resource servers Information During Interaction and to request
   direct information.  This delegation is facilitated by an
   authorization server usually on behalf
             Continuation  . . . . . . . . . . . . . . . . . . . . . 123
     12.20. Denial of a resource owner.  The end-
   user operating the software may interact with the authorization
   server to authenticate, provide consent, and authorize the request.

   The process by which the delegation happens is known as a grant, and
   GNAP allows for the negotiation Service (DoS) through Grant Continuation . . . 124
     12.21. Exhaustion of the grant process over time Random Value Space . . . . . . . . . . . . 124
   13. Privacy Considerations  . . . . . . . . . . . . . . . . . . . 125
     13.1.  Surveillance . . . . . . . . . . . . . . . . . . . . . . 125
       13.1.1.  Surveillance by
   multiple parties acting in distinct roles.

   This specification focuses on the portions of the delegation process
   facing the client instance.  In particular, this specification
   defines interoperable methods for a client instance to request,
   negotiate, and receive access to information facilitated Client . . . . . . . . . . . . . 125
       13.1.2.  Surveillance by the
   authorization server.  This specification also discusses discovery
   mechanisms for the client instance to configure itself dynamically.
   The means for an authorization server and resource server to
   interoperate are discussed in the companion document, Authorization Server . . . . . . 125
     13.2.  Stored Data  . . . . . . . . . . . . . . . . . . . . . . 126
     13.3.  Intrusion  . . . . . . . . . . . . . . . . . . . . . . . 127
     13.4.  Correlation  . . . . . . . . . . . . . . . . . . . . . . 127
       13.4.1.  Correlation by Clients . . . . . . . . . . . . . . . 127
       13.4.2.  Correlation by Resource Servers  . . . . . . . . . . 127
       13.4.3.  Correlation by Authorization Servers . . . . . . . . 128
     13.5.  Disclosure in Shared References  . . . . . . . . . . . . 128
   14. References  . . . . . . . . . . . . . . . . . . . . . . . . . 128
     14.1.  Normative References . . . . . . . . . . . . . . . . . . 128
     14.2.  Informative References . . . . . . . . . . . . . . . . . 131
   Appendix A.  Document History . . . . . . . . . . . . . . . . . . 131
   Appendix B.  Compared to OAuth 2.0  . . . . . . . . . . . . . . . 134
   Appendix C.  Component Data Models  . . . . . . . . . . . . . . . 136
   Appendix D.  Example Protocol Flows . . . . . . . . . . . . . . . 136
     D.1.  Redirect-Based User Interaction . . . . . . . . . . . . . 137
     D.2.  Secondary Device Interaction  . . . . . . . . . . . . . . 140
     D.3.  No User Involvement . . . . . . . . . . . . . . . . . . . 143
     D.4.  Asynchronous Authorization  . . . . . . . . . . . . . . . 144
     D.5.  Applying OAuth 2.0 Scopes and Client IDs  . . . . . . . . 148
   Appendix E.  JSON Structures and Polymorphism . . . . . . . . . . 149
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . 150

1.  Introduction

   This protocol allows a piece of software, the client instance, to
   request delegated authorization to resource servers and to request
   direct information.  This delegation is facilitated by an
   authorization server usually on behalf of a resource owner.  The end-
   user operating the software may interact with the authorization
   server to authenticate, provide consent, and authorize the request.

   The process by which the delegation happens is known as a grant, and
   GNAP allows for the negotiation of the grant process over time by
   multiple parties acting in distinct roles.

   This specification focuses on the portions of the delegation process
   facing the client instance.  In particular, this specification
   defines interoperable methods for a client instance to request,
   negotiate, and receive access to information facilitated by the
   authorization server.  This specification also discusses discovery
   mechanisms for the client instance to configure itself dynamically.
   The means for an authorization server and resource server to
   interoperate are discussed in the companion document,
   [I-D.draft-ietf-gnap-resource-servers].

   The focus of this protocol is to provide interoperability between the
   different parties acting in each role, and is not to specify
   implementation details of each.  Where appropriate, GNAP may make
   recommendations about internal implementation details, but these
   recommendations are to ensure the security of the overall deployment
   rather than to be prescriptive in the implementation.

   This protocol solves many of the same use cases as OAuth 2.0
   [RFC6749], OpenID Connect [OIDC], and the family of protocols that
   have grown up around that ecosystem.  However, GNAP is not an
   extension of OAuth 2.0 and is not intended to be directly compatible
   with OAuth 2.0.  GNAP seeks to provide functionality and solve use
   cases that OAuth 2.0 cannot easily or cleanly address.  Appendix B
   further details the protocol rationale compared to OAuth 2.0.  GNAP
   and OAuth 2.0 will likely exist in parallel for many deployments, and
   considerations have been taken to facilitate the mapping and
   transition from legacy systems to GNAP.  Some examples of these can
   be found in Appendix D.5.

1.1.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "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 document contains non-normative examples of partial and complete
   HTTP messages, JSON structures, URLs, query components, keys, and
   other elements.  Some examples use a single trailing backslash '' to
   indicate line wrapping for long values, as per [RFC8792].  The "\"
   character and leading spaces on wrapped lines are not part of the
   value.

1.2.  Roles

   The parties in GNAP perform actions under different roles.  Roles are
   defined by the actions taken and the expectations leveraged on the
   role by the overall protocol.

   +-------------+            +------------+
   |             |            |            |
   |Authorization|            |  Resource  |
   |   Server    |            |   Server   |
   |             |<-+   +---->|            |
   +-------------+  |   |     +------------+
          +         |   |
          +         |   |
          +         |   |
          +         |   |
          +         |   |
          +       +----------+
          +       |  Client  |
          +       | Instance |
          +       +----------+
          +            +
          +            +
          +            +
    +-----------+      +      +------------+
    |           |      + + + +|            |
    |  Resource |             |    End     |
    |   Owner   | ~ ~ ~ ~ ~ ~ |    User    |
    |           |             |            |
    +-----------+             +------------+

   Legend

   + + + indicates interaction between a human and computer
   ----- indicates interaction between two pieces of software
   ~ ~ ~ indicates a potential equivalence or out-of-band
             communication between roles

   Authorization Server (AS)  server that grants delegated privileges to
      a particular instance of client software in the form of access
      tokens or other information (such as subject information).

   Client  application operated by an end-user that consumes resources
      from one or several RSs, possibly requiring access privileges from
      one or several ASs.  Example: a client can be a mobile
      application, a web application, etc.  Note: this specification
      differentiates between a specific instance (the client instance,
      identified by its unique key) and the software running the
      instance (the client software).  For some kinds of client
      software, there could be many instances of that software, each
      instance with a different key.

   Resource Server (RS)  server that provides operations on protected
      resources, where operations require a valid access token issued by
      an AS.

   Resource Owner (RO)  subject entity that may grant or deny operations
      on resources it has authority upon.  Note: the act of granting or
      denying an operation may be manual (i.e. through an interaction
      with a physical person) or automatic (i.e. through predefined
      organizational rules).

   End-user  natural person that operates a client instance.  Note: that
      natural person may or may not be the same entity as the RO.

   The design of GNAP does not assume any one deployment architecture,
   but instead attempts to define roles that can be fulfilled in a
   number of different ways for different use cases.  As long as a given
   role fulfills all of its obligations and behaviors as defined by the
   protocol, GNAP does not make additional requirements on its structure
   or setup.

   Multiple roles can be fulfilled by the same party, and a given party
   can switch roles in different instances of the protocol.  For
   example, the RO and end-user in many instances are the same person,
   where a user is authorizing the client instance to act on their own
   behalf at the RS.  In this case, one party fulfills both of the RO
   and end-user roles, but the roles themselves are still defined
   separately from each other to allow for other use cases where they
   are fulfilled by different parties.

   For another example, in some complex scenarios, an RS receiving
   requests from one client instance can act as a client instance for a
   downstream secondary RS in order to fulfill the original request.  In
   this case, one piece of software is both an RS and a client instance
   from different perspectives, and it fulfills these roles separately
   as far as the overall protocol is concerned.

   A single role need not be deployed as a monolithic service.  For
   example, A client instance could have components that are installed
   on the end-user's device as well as a back-end system that it
   communicates with.  If both of these components participate in the
   delegation protocol, they are both considered part of the client
   instance.  If there are several copies of the client software that
   run separately but all share the same key material, such as a
   deployed cluster, then this cluster is considered a single client
   instance.

   In these cases, the distinct components of what is considered a GNAP
   client instance may use any number of different communication
   mechanisms between them, all of which would be considered an
   implementation detail of the client instances and out of scope of
   GNAP.

   For another example, an AS could likewise be built out of many
   constituent components in a distributed architecture.  The component
   that the client instance calls directly could be different from the
   component that the RO interacts with to drive consent, since API
   calls and user interaction have different security considerations in
   many environments.  Furthermore, the AS could need to collect
   identity claims about the RO from one system that deals with user
   attributes while generating access tokens at another system that
   deals with security rights.  From the perspective of GNAP, all of
   these are pieces of the AS and together fulfill the role of the AS as
   defined by the protocol.  These pieces may have their own internal
   communications mechanisms which are considered out of scope of GNAP.

1.3.  Elements

   In addition to the roles above, the protocol also involves several
   elements that are acted upon by the roles throughout the process.

   Attribute  characteristics related to a subject.

   Access Token  a data artifact representing a set of rights and/or
      attributes.  Note: an access token can be first issued to an
      client instance (requiring authorization by the RO) and
      subsequently rotated.

   Grant  (verb): to permit an instance of client software to receive
      some attributes at a specific time and valid for a specific
      duration and/or to exercise some set of delegated rights to access
      a protected resource (noun): the act of granting.

   Privilege  right or attribute associated with a subject.  Note: the
      RO defines and maintains the rights and attributes associated to
      the protected resource, and might temporarily delegate some set of
      those privileges to an end-user.  This process is refered to as
      privilege delegation.

   Protected Resource  protected API (Application Programming Interface)
      served by an RS and that can be accessed by a client, if and only
      if a valid access token is provided.  Note: to avoid complex
      sentences, the specification document may simply refer to resource
      instead of protected resource.

   Right  ability given to a subject to perform a given operation on a
      resource under the control of an RS.

   Subject  person, organization or device.

   Subject Information  statement asserted by an AS about a subject.

1.4.  Trust relationships

   GNAP defines its trust objective as: "the RO trusts the AS to ensure
   access validation and delegation of protected resources to end-users,
   through third party clients."

   This trust objective can be decomposed into trust relationships
   between software elements and roles, especially the pairs end-user/
   RO, end-user/client, client/AS, RS/RO, AS/RO, AS/RS.  Trust of an
   agent by its pair can exist if the pair is informed that the agent
   has made a promise to follow the protocol in the past (e.g. pre-
   registration, uncompromised cryptographic components) or if the pair
   is able to infer by indirect means that the agent has made such a
   promise (e.g. a compliant client request).  Each agent defines its
   own valuation function of promises given or received.  Examples of
   such valuations can be the benefits from interacting with other
   agents (e.g. safety in client access, interoperability with identity
   standards), the cost of following the protocol (including its
   security and privacy requirements and recommendations), a ranking of
   promise importance (e.g. a policy decision made by the AS), the
   assessment of one's vulnerability or risk of not being able to defend
   against threats, etc.  Those valuations may depend on the context of
   the request.  For instance, the AS may decide to either take into
   account or discard hints provided by the client, the RS may refuse
   bearer tokens, etc. depending on the specific case in which GNAP is
   used.  Some promises can be conditional of some previous interactions
   (e.g. repeated requests).

   Looking back on each trust relationship:

   *  end-user/RO: this relationship exists only when the end-user and
      the RO are different, in which case the end-user needs some out of
      band mechanism of getting the RO consent (see Section 4).  GNAP
      generally assumes that humans can be authenticated thanks to
      identity protocols (for instance, through an id_token assertion in
      Section 2.2).

   *  end-user/client: the client acts as a user agent.  Depending on
      the technology used (browser, SPA, mobile application, IoT device,
      etc.), some interactions may or may not be possible (as described
      in Section 2.5.1).  Client developers promise to implement
      requirements and generally some recommendations or best practices,
      so that the end-users may confidently use their software.
      However, end-users might also be facing some attacker's client
      software, without even realizing it.

   *  client/AS: An honest AS may be facing an attacker's client (as
      discussed just above), or the reverse, and GNAP aims at making
      common attacks impractical.  The core specification makes access
      tokens opaque to the client and defines the request/response
      scheme in detail, therefore avoiding extra trust hypotheses from
      this critical piece of software.  Yet the AS may further define
      cryptographic attestations or optional rules to simplify the
      access of clients it already trusts, due to past behavior or
      organizational policies (see Section 2.3).

   *  RS/RO: the RS promises it protects its resources from unauthorized
      access, and only accepts valid access tokens issued by a trusted
      AS.  In case tokens are key bound, proper validation is expected
      from the RS.

   *  AS/RO: the AS is expected to follow the decisions made by the RO,
      either through interactive consent requests, repeated interactions
      or automated rules (as described in Section 1.5).  Privacy
      considerations aim to reduce the risk of an honest but too curious
      AS, or the consequences of an unexpected user data exposure.

   *  AS/RS: the AS promises to issue valid access tokens to legitimate
      client requests (i.e. after carrying out appropriate due
      diligence, as defined in the GNAP protocol).  Some optional
      configurations are covered by
      [I-D.draft-ietf-gnap-resource-servers].

   A global assumption made by GNAP is that authorization requests are
   security and privacy sensitive, and appropriate measures are
   respectively detailed in Section 12 and Section 13.

   A formal trust model is out of scope of this specification, but might
   be carried out thanks to [promise-theory].

1.5.  Sequences

   GNAP can be used in a variety of ways to allow the core delegation
   process to take place.  Many portions of this process are
   conditionally present depending on the context of the deployments,
   and not every step in this overview will happen in all circumstances.

   Note that a connection between roles in this process does not
   necessarily indicate that a specific protocol message is sent across
   the wire between the components fulfilling the roles in question, or
   that a particular step is required every time.  For example, for a
   client instance interested in only getting subject information
   directly, and not calling an RS, all steps involving the RS below do
   not apply.

   In some circumstances, the information needed at a given stage is
   communicated out of band or is preconfigured between the components
   or entities performing the roles.  For example, one entity can fulfil
   multiple roles, and so explicit communication between the roles is
   not necessary within the protocol flow.  Additionally some components
   may not be involved in all use cases.  For example, a client instance
   could be calling the AS just to get direct user information and have
   no need to get an access token to call an RS.

       +------------+         +------------+
       | End-user   | ~ ~ ~ ~ |  Resource  |
       |            |         | Owner (RO) |
       +------------+         +------------+
           +                         +
           +                         +
          (A)                       (B)
           +                         +
           +                         +
       +--------+                    +          +------------+
       | Client | (1)                +          |  Resource  |
       |Instance|                    +          |   Server   |
       |        |       +---------------+       |    (RS)    |
       |        |--(2)->| Authorization |       |            |
       |        |<-(3)--|     Server    |       |            |
       |        |       |      (AS)     |       |            |
       |        |--(4)->|               |       |            |
       |        |<-(5)--|               |       |            |
       |        |--------------(6)------------->|            |
       |        |       |               |   (7) |            |
       |        |<-------------(8)------------->|            |
       |        |--(9)->|               |       |            |
       |        |<-(10)-|               |       |            |
       |        |--------------(11)------------>|            |
       |        |       |               |  (12) |            |
       |        |-(13)->|               |       |            |
       |        |       |               |       |            |
       +--------+       +---------------+       +------------+

   Legend
   + + + indicates a possible interaction with a human
   ----- indicates an interaction between protocol roles
   ~ ~ ~ indicates a potential equivalence or out-of-band
           communication between roles

   *  (A) The end-user interacts with the client instance to indicate a
      need for resources on behalf of the RO.  This could identify the
      RS the client instance needs to call, the resources needed, or the
      RO that is needed to approve the request.  Note that the RO and
      end-user are often the same entity in practice, but some more
      dynamic processes are discussed in
      [I-D.draft-ietf-gnap-resource-servers].

   *  (1) The client instance determines what access is needed and which
      AS to approach for access.  Note that for most situations, the
      client instance is pre-configured with which AS to talk to and
      which kinds of access it needs.

   *  (2) The client instance requests access at the AS (Section 2).

   *  (3) The AS processes the request and determines what is needed to
      fulfill the request.  The AS sends its response to the client
      instance (Section 3).

   *  (B) If interaction is required, the AS interacts with the RO
      (Section 4) to gather authorization.  The interactive component of
      the AS can function using a variety of possible mechanisms
      including web page redirects, applications, challenge/response
      protocols, or other methods.  The RO approves the request for the
      client instance being operated by the end-user.  Note that the RO
      and end-user are often the same entity in practice.

   *  (4) The client instance continues the grant at the AS (Section 5).

   *  (5) If the AS determines that access can be granted, it returns a
      response to the client instance (Section 3) including an access
      token (Section 3.2) for calling the RS and any directly returned
      information (Section 3.4) about the RO.

   *  (6) The client instance uses the access token (Section 7.2) to
      call the RS.

   *  (7) The RS determines if the token is sufficient for the request
      by examining the token.  The means of the RS determining this
      access are out of scope of this specification, but some options
      are discussed in [I-D.draft-ietf-gnap-resource-servers].

   *  (8) The client instance calls the RS (Section 7.2) using the
      access token until the RS or client instance determine that the
      token is no longer valid.

   *  (9) When the token no longer works, the client instance fetches an
      updated access token (Section 6.1) based on the rights granted in
      (5).

   *  (10) The AS issues a new access token (Section 3.2) to the client
      instance.

   *  (11) The client instance uses the new access token (Section 7.2)
      to call the RS.

   *  (12) The RS determines if the new token is sufficient for the
      request.  The means of the RS determining this access are out of
      scope of this specification, but some options are discussed in
      [I-D.draft-ietf-gnap-resource-servers].

   *  (13) The client instance disposes of the token (Section 6.2) once
      the client instance has completed its access of the RS and no
      longer needs the token.

   The following sections and Appendix D contain specific guidance on
   how to use GNAP in different situations and deployments.  For
   example, it is possible for the client instance to never request an
   access token and never call an RS, just as it is possible for there
   not to be a user involved in the delegation process.

1.5.1.  Redirect-based Interaction

   In this example flow, the client instance is a web application that
   wants access to resources on behalf of the current user, who acts as
   both the end-user and the resource owner (RO).  Since the client
   instance is capable of directing the user to an arbitrary URL and
   receiving responses from the user's browser, interaction here is
   handled through front-channel redirects using the user's browser.
   The redirection URL used for interaction is a service hosted by the
   AS in this example.  The client instance uses a persistent session
   with the user to ensure the same user that is starting the
   interaction is the user that returns from the interaction.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         | User |
 |Instance|                                  |        |         |      |
 |        |< (1) + Start Session + + + + + + + + + + + + + + + +|      |
 |        |                                  |        |         |      |
 |        |--(2)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(3)-- Interaction Needed -------|        |         |      |
 |        |                                  |        |         |      |
 |        |+ (4) + Redirect for Interaction + + + + + + + + + > |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (6) +>|      |
 |        |                                  |        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |< (7) + Redirect for Continuation + + + + + + + + + +|      |
 |        |                                  |        |         +------+
 |        |--(8)--- Continue Request ------->|        |
 |        |                                  |        |
 |        |<-(9)----- Grant Access ----------|        |
 |        |                                  |        |
 |        |                                  |        |     +--------+
 |        |--(10)-- Access API ---------------------------->|   RS   |
 |        |                                  |        |     |        |
 |        |<-(11)-- API Response ---------------------------|        |
 |        |                                  |        |     +--------+
 +--------+                                  +--------+

   1.   The client instance establishes a verifiable session to the
        user, in the role of the end-user.

   2.   The client instance requests access to the resource (Section 2).
        The client instance indicates that it can redirect to an
        arbitrary URL (Section 2.5.1.1) and receive a redirect from the
        browser (Section 2.5.2.1).  The client instance stores
        verification information for its redirect in the session created
        in (1).

   3.   The AS determines that interaction is needed and responds
        (Section 3) with a URL to send the user to (Section 3.3.1) and
        information needed to verify the redirect (Section 3.3.4) in
        (7).  The AS also includes information the client instance will
        need to continue the request (Section 3.1) in (8).  The AS
        associates this continuation information with an ongoing request
        that will be referenced in (4), (6), and (8).

   4.   The client instance stores the verification and continuation
        information from (3) in the session from (1).  The client
        instance then redirects the user to the URL (Section 4.1.1)
        given by the AS in (3).  The user's browser loads the
        interaction redirect URL.  The AS loads the pending request
        based on the incoming URL generated in (3).

   5.   The user authenticates at the AS, taking on the role of the RO.

   6.   As the RO, the user authorizes the pending request from the
        client instance.

   7.   When the AS is done interacting with the user, the AS redirects
        the user back (Section 4.2.1) to the client instance using the
        redirect URL provided in (2).  The redirect URL is augmented
        with an interaction reference that the AS associates with the
        ongoing request created in (2) and referenced in (4).  The
        redirect URL is also augmented with a hash of the security
        information provided in (2) and (3).  The client instance loads
        the verification information from (2) and (3) from the session
        created in (1).  The client instance calculates a hash
        (Section 4.2.3) based on this information and continues only if
        the hash validates.  Note that the client instance needs to
        ensure that the parameters for the incoming request match those
        that it is expecting from the session created in (1).  The
        client instance also needs to be prepared for the end-user never
        being returned to the client instance and handle timeouts
        appropriately.

   8.   The client instance loads the continuation information from (3)
        and sends the interaction reference from (7) in a request to
        continue the request (Section 5.1).  The AS validates the
        interaction reference ensuring that the reference is associated
        with the request being continued.

   9.   If the request has been authorized, the AS grants access to the
        information in the form of access tokens (Section 3.2) and
        direct subject information (Section 3.4) to the client instance.

   10.  The client instance uses the access token (Section 7.2) to call
        the RS.

   11.  The RS validates the access token and returns an appropriate
        response for the API.

   An example set of protocol messages for this method can be found in
   Appendix D.1.

1.5.2.  User-code Interaction

   In this example flow, the client instance is a device that is capable
   of presenting a short, human-readable code to the user and directing
   the user to enter that code at a known URL.  The URL the user enters
   the code at is an interactive service hosted by the AS in this
   example.  The client instance is not capable of presenting an
   arbitrary URL to the user, nor is it capable of accepting incoming
   HTTP requests from the user's browser.  The client instance polls the
   AS while it is waiting for the RO to authorize the request.  The
   user's interaction is assumed to occur on a secondary device.  In
   this example it is assumed that the user is both the end-user and RO,
   though the user is not assumed to be interacting with the client
   instance through the same web browser used for interaction at the AS.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         | User |
 |Instance|--(1)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(2)-- Interaction Needed -------|        |         |      |
 |        |                                  |        |         |      |
 |        |+ (3) + + Display User Code + + + + + + + + + + + + >|      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (4) + |      |
 |        |                                  |        |Open URI |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |--(9)--- Continue Request (A) --->|        |         |      |
 |        |                                  |        |<+ (6) +>|      |
 |        |<-(10)- Not Yet Granted (Wait) ---|        |  Code   |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (7) +>|      |
 |        |                                  |        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (8) +>|      |
 |        |                                  |        |Completed|      |
 |        |                                  |        |         |      |
 |        |--(11)-- Continue Request (B) --->|        |         +------+
 |        |                                  |        |
 |        |<-(12)----- Grant Access ---------|        |
 |        |                                  |        |
 |        |                                  |        |     +--------+
 |        |--(13)-- Access API ---------------------------->|   RS   |
 |        |                                  |        |     |        |
 |        |<-(14)-- API Response ---------------------------|        |
 |        |                                  |        |     +--------+
 +--------+                                  +--------+
   1.   The client instance requests access to the resource (Section 2).
        The client instance indicates that it can display a user code
        (Section 2.5.1.3).

   2.   The AS determines that interaction is needed and responds
        (Section 3) with a user code to communicate to the user
        (Section 3.3.3).  This could optionally include a URL to direct
        the user to, but this URL should be static and so could be
        configured in the client instance's documentation.  The AS also
        includes information the client instance will need to continue
        the request (Section 3.1) in (8) and (10).  The AS associates
        this continuation information with an ongoing request that will
        be referenced in (4), (6), (8), and (10).

   3.   The client instance stores the continuation information from (2)
        for use in (8) and (10).  The client instance then communicates
        the code to the user (Section 4.1.1) given by the AS in (2).

   4.   The user's directs their browser to the user code URL.  This URL
        is stable and can be communicated via the client software's
        documentation, the AS documentation, or the client software
        itself.  Since it is assumed that the RO will interact with the
        AS through a secondary device, the client instance does not
        provide a mechanism to launch the RO's browser at this URL.

   5.   The end-user authenticates at the AS, taking on the role of the
        RO.

   6.   The RO enters the code communicated in (3) to the AS.  The AS
        validates this code against a current request in process.

   7.   As the RO, the user authorizes the pending request from the
        client instance.

   8.   When the AS is done interacting with the user, the AS indicates
        to the RO that the request has been completed.

   9.   Meanwhile, the client instance loads the continuation
        information stored at (3) and continues the request (Section 5).
        The AS determines which ongoing access request is referenced
        here and checks its state.

   10.  If the access request has not yet been authorized by the RO in
        (6), the AS responds to the client instance to continue the
        request (Section 3.1) at a future time through additional polled
        continuation requests.  This response can include updated
        continuation information as well as information regarding how
        long the client instance should wait before calling again.  The
        client instance replaces its stored continuation information
        from the previous response (2).  Note that the AS may need to
        determine that the RO has not approved the request in a
        sufficient amount of time and return an appropriate error to the
        client instance.

   11.  The client instance continues to poll the AS (Section 5.2) with
        the new continuation information in (9).

   12.  If the request has been authorized, the AS grants access to the
        information in the form of access tokens (Section 3.2) and
        direct subject information (Section 3.4) to the client instance.

   13.  The client instance uses the access token (Section 7.2) to call
        the RS.

   14.  The RS validates the access token and returns an appropriate
        response for the API.

   An example set of protocol messages for this method can be found in
   Appendix D.2.

1.5.3.  Asynchronous Authorization

   In this example flow, the end-user and RO roles are fulfilled by
   different parties, and the RO does not interact with the client
   instance.  The AS reaches out asynchronously to the RO during the
   request process to gather the RO's authorization for the client
   instance's request.  The client instance polls the AS while it is
   waiting for the RO to authorize the request.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         |  RO  |
 |Instance|--(1)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(2)-- Not Yet Granted (Wait) ---|        |         |      |
 |        |                                  |        |<+ (3) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |--(6)--- Continue Request (A) --->|        |         |      |
 |        |                                  |        |<+ (4) +>|      |
 |        |<-(7)-- Not Yet Granted (Wait) ---|        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |Completed|      |
 |        |                                  |        |         |      |
 |        |--(8)--- Continue Request (B) --->|        |         +------+
 |        |                                  |        |
 |        |<-(9)------ Grant Access ---------|        |
 |        |                                  |        |
 |        |                                  |        |     +--------+
 |        |--(10)-- Access API ---------------------------->|   RS   |
 |        |                                  |        |     |        |
 |        |<-(11)-- API Response ---------------------------|        |
 |        |                                  |        |     +--------+
 +--------+                                  +--------+

   1.   The client instance requests access to the resource (Section 2).
        The client instance does not send any interactions modes to the
        server, indicating that it does not expect to interact with the
        RO.  The client instance can also signal which RO it requires
        authorization from, if known, by using the user request section
        (Section 2.4).

   2.   The AS determines that interaction is needed, but the client
        instance cannot interact with the RO.  The AS responds
        (Section 3) with the information the client instance will need
        to continue the request (Section 3.1) in (6) and (8), including
        a signal that the client instance should wait before checking
        the status of the request again.  The AS associates this
        continuation information with an ongoing request that will be
        referenced in (3), (4), (5), (6), and (8).

   3.   The AS determines which RO to contact based on the request in
        (1), through a combination of the user request (Section 2.4),
        the resources request (Section 2.1), and other policy
        information.  The AS contacts the RO and authenticates them.

   4.   The RO authorizes the pending request from the client instance.

   5.   When the AS is done interacting with the RO, the AS indicates to
        the RO that the request has been completed.

   6.   Meanwhile, the client instance loads the continuation
        information stored at (2) and continues the request (Section 5).
        The AS determines which ongoing access request is referenced
        here and checks its state.

   7.   If the access request has not yet been authorized by the RO in
        (6), the AS responds to the client instance to continue the
        request (Section 3.1) at a future time through additional
        polling.  This response can include refreshed credentials as
        well as information regarding how long the client instance
        should wait before calling again.  The client instance replaces
        its stored continuation information from the previous response
        (2).  Note that the AS may need to determine that the RO has not
        approved the request in a sufficient amount of time and return
        an appropriate error to the client instance.

   8.   The client instance continues to poll the AS (Section 5.2) with
        the new continuation information from (7).

   9.   If the request has been authorized, the AS grants access to the
        information in the form of access tokens (Section 3.2) and
        direct subject information (Section 3.4) to the client instance.

   10.  The client instance uses the access token (Section 7.2) to call
        the RS.

   11.  The RS validates the access token and returns an appropriate
        response for the API.

   An example set of protocol messages for this method can be found in
   Appendix D.4.

1.5.4.  Software-only Authorization

   In this example flow, the AS policy allows the client instance to
   make a call on its own behalf, without the need for a RO to be
   involved at runtime to approve the decision.  Since there is no
   explicit RO, the client instance does not interact with an RO.

   +--------+                            +--------+
   | Client |                            |   AS   |
   |Instance|--(1)--- Request Access --->|        |
   |        |                            |        |
   |        |<-(2)---- Grant Access -----|        |
   |        |                            |        |  +--------+
   |        |--(3)--- Access API ------------------->|   RS   |
   |        |                            |        |  |        |
   |        |<-(4)--- API Response ------------------|        |
   |        |                            |        |  +--------+
   +--------+                            +--------+

   1.  The client instance requests access to the resource (Section 2).
       The client instance does not send any interactions modes to the
       server.

   2.  The AS determines that the request is been authorized, the AS
       grants access to the information in the form of access tokens
       (Section 3.2) to the client instance.  Note that direct subject
       information (Section 3.4) is not generally applicable in this use
       case, as there is no user involved.

   3.  The client instance uses the access token (Section 7.2) to call
       the RS.

   4.  The RS validates the access token and returns an appropriate
       response for the API.

   An example set of protocol messages for this method can be found in
   Appendix D.3.

1.5.5.  Refreshing an Expired Access Token

   In this example flow, the client instance receives an access token to
   access a resource server through some valid GNAP process.  The client
   instance uses that token at the RS for some time, but eventually the
   access token expires.  The client instance then gets a new access
   token by rotating the expired access token at the AS using the
   token's management URL.

   +--------+                                          +--------+
   | Client |                                          |   AS   |
   |Instance|--(1)--- Request Access ----------------->|        |
   |        |                                          |        |
   |        |<-(2)--- Grant Access --------------------|        |
   |        |                                          |        |
   |        |                             +--------+   |        |
   |        |--(3)--- Access Resource --->|   RS   |   |        |
   |        |                             |        |   |        |
   |        |<-(4)--- Success Response ---|        |   |        |
   |        |                             |        |   |        |
   |        |                             |        |   |        |
   |        |                             |        |   |        |
   |        |--(5)--- Access Resource --->|        |   |        |
   |        |                             |        |   |        |
   |        |<-(6)--- Error Response -----|        |   |        |
   |        |                             +--------+   |        |
   |        |                                          |        |
   |        |--(7)--- Rotate Token ------------------->|        |
   |        |                                          |        |
   |        |<-(8)--- Rotated Token -------------------|        |
   |        |                                          |        |
   +--------+                                          +--------+

   1.  The client instance requests access to the resource (Section 2).

   2.  The AS grants access to the resource (Section 3) with an access
       token (Section 3.2) usable at the RS.  The access token response
       includes a token management URI.

   3.  The client instance uses the access token (Section 7.2) to call
       the RS.

   4.  The RS validates the access token and returns an appropriate
       response for the API.

   5.  Time passes and the client instance uses the access token to call
       the RS again.

   6.  The RS validates the access token and determines that the access
       token is expired The RS responds to the client instance with an
       error.

   7.  The client instance calls the token management URI returned in
       (2) to rotate the access token (Section 6.1).  The client
       instance uses the access token (Section 7.2) in this call as well
       as the appropriate key, see the token rotation section for
       details.

   8.  The AS validates the rotation request including the signature and
       keys presented in (5) and returns a new access token
       (Section 3.2.1).  The response includes a new access token and
       can also include updated token management information, which the
       client instance will store in place of the values returned in
       (2).

1.5.6.  Requesting User Information

   In this scenario, the client instance does not call an RS and does
   not request an access token.  Instead, the client instance only
   requests and is returned direct subject information (Section 3.4).
   Many different interaction modes can be used in this scenario, so
   these are shown only in the abstract as functions of the AS here.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         | User |
 |Instance|                                  |        |         |      |
 |        |--(1)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(2)--- Request Access ----------|        |         |      |
 |        |                                  |        |         |      |
 |        |+ (3) + Facilitate Interaction + + + + + + + + + + > |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (4) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |< (6) + Signal Continuation + + + + + + + + + + + + +|      |
 |        |                                  |        |         +------+
 |        |--(7)--- Continue Request ------->|        |
 |        |                                  |        |
 |        |<-(8)----- Grant Access ----------|        |
 |        |                                  |        |
 +--------+                                  +--------+

   1.  The focus client instance requests access to subject information
       (Section 2).

   2.  The AS determines that interaction is needed and responds
       (Section 3) with appropriate information for facilitating user
       interaction (Section 3.3).

   3.  The client instance facilitates the user interacting with the AS
       (Section 4) as directed in (2).

   4.  The user authenticates at the AS, taking on the role of this protocol the RO.

   5.  As the RO, the user authorizes the pending request from the
       client instance.

   6.  When the AS is done interacting with the user, the AS returns the
       user to provide interoperability between the
   different parties acting in each role, client instance and is not signals continuation.

   7.  The client instance loads the continuation information from (2)
       and calls the AS to specify
   implementation details of each.  Where appropriate, GNAP may make
   recommendations about internal implementation details, but these
   recommendations are continue the request (Section 5).

   8.  If the request has been authorized, the AS grants access to ensure the security of
       requested direct subject information (Section 3.4) to the overall deployment
   rather than client
       instance.  At this stage, the user is generally considered
       "logged in" to be prescriptive in the implementation.

   This protocol solves many of client instance based on the same use cases as OAuth 2.0
   [RFC6749], OpenID Connect [OIDC], identifiers and
       assertions provided by the family of protocols that
   have grown up around AS.  Note that ecosystem.  However, GNAP is the AS can restrict the
       subject information returned and it might not match what the
       client instance requested, see the section on subject information
       for details.

2.  Requesting Access

   To start a request, the client instance sends JSON [RFC8259] document
   with an
   extension object as its root.  Each member of OAuth 2.0 the request object
   represents a different aspect of the client instance's request.  Each
   field is described in detail in a section below.

   access_token (object / array of objects)  Describes the rights and
      properties associated with the requested access token.
      Section 2.1

   subject (object)  Describes the information about the RO that the
      client instance is not intended requesting to be returned directly compatible
   with OAuth 2.0.  GNAP seeks in the
      response from the AS.  Section 2.2

   client (object / string)  Describes the client instance that is
      making this request, including the key that the client instance
      will use to provide functionality protect this request and solve use
   cases any continuation requests at
      the AS and any user-facing information about the client instance
      used in interactions.  Section 2.3

   user (object / string)  Identifies the end-user to the AS in a manner
      that OAuth 2.0 cannot easily the AS can verify, either directly or cleanly address.  Appendix B
   further details by interacting with the protocol rationale compared
      end-user to OAuth 2.0.  GNAP
   and OAuth 2.0 will likely exist in parallel determine their status as the RO.  Section 2.4

   interact (object)  Describes the modes that the client instance has
      for many deployments, and
   considerations have been taken allowing the RO to facilitate interact with the mapping AS and
   transition from legacy systems modes for the
      client instance to GNAP.  Some examples receive updates when interaction is complete.
      Section 2.5

   Additional members of these this request object can be found in Appendix D.5.

1.1.  Terminology

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

   This document contains Section 2.6

   A non-normative examples example of partial and complete
   HTTP messages, JSON structures, URLs, query components, keys, and
   other elements.  Some examples use a single trailing backslash '' to
   indicate line wrapping for long values, as per [RFC8792]. grant request is below:

   {
       "access_token": {
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "dolphin-metadata"
           ]
       },
       "client": {
         "display": {
           "name": "My Client Display Name",
           "uri": "https://example.net/client"
         },
         "key": {
           "proof": "httpsig",
           "jwk": {
                       "kty": "RSA",
                       "e": "AQAB",
                       "kid": "xyz-1",
                       "alg": "RS256",
                       "n": "kOB5rR4Jv0GMeL...."
           }
         }
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       },
       "subject": {
           "formats": ["iss_sub", "opaque"],
           "assertions": ["id_token"]
       }
   }

   The "\"
   character request and leading spaces on wrapped lines are not part response MUST be sent as a JSON object in the body of
   the
   value.

1.2.  Roles

   The parties in GNAP perform actions under different roles.  Roles are
   defined HTTP POST request with Content-Type "application/json", unless
   otherwise specified by the actions taken and signature mechanism.

   The authorization server MUST include the expectations leveraged on HTTP "Cache-Control"
   response header field [RFC7234] with a value set to "no-store".

2.1.  Requesting Access to Resources

   If the
   role by client instance is requesting one or more access tokens for
   the overall protocol.

+-------------+            +------------+
|             |            |            |
|Authorization|            |  Resource  |
|   Server    |            |   Server   |
|             |<-+   +---->|            |
+-------------+  |   |     +------------+
       +         |   |
       +         |   |
       +         |   |
       +         |   |
       +         |   |
       +       +----------+
       +       |  Client  |
       +       | Instance |
       +       +----------+
       +            +
       +            +
       +            +
 +-----------+      +      +------------+
 |           |      + + + +|            |
 |  Resource |             |    End     |
 |   Owner   | ~ ~ ~ ~ ~ ~ |    User    |
 |           |             |            |
 +-----------+             +------------+

Legend

+ + + indicates interaction between a human and computer
----- indicates interaction between two pieces purpose of software
~ ~ ~ indicates accessing an API, the client instance MUST include an
   "access_token" field.  This field MUST be an object (for a potential equivalence single
   access token (Section 2.1.1)) or out-of-band communication between roles

   Authorization Server (AS)  server an array of these objects (for
   multiple access tokens (Section 2.1.2)), as described in the
   following sections.

2.1.1.  Requesting a Single Access Token

   To request a single access token, the client instance sends an
   "acccess_token" object composed of the following fields.

   access (array of objects/strings)  Describes the rights that grants delegated privileges the
      client instance is requesting for one or more access tokens to
      a particular be
      used at RS's.  This field is REQUIRED.  Section 8

   label (string)  A unique name chosen by the client instance to refer
      to the resulting access token.  The value of client software this field is opaque
      to the AS.  If this field is included in the form request, the AS MUST
      include the same label in the token response (Section 3.2).  This
      field is REQUIRED if used as part of a multiple access
      tokens or other information (such as subject information).

   Client  application operated by an end-user token
      request (Section 2.1.2), and is OPTIONAL otherwise.

   flags (array of strings)  A set of flags that consumes resources
      from one or several RSs, possibly requiring access privileges from
      one indicate desired
      attributes or several ASs.

      Example: a client can behavior to be a mobile application, a web application,
      etc.

      Note: attached to the access token by the
      AS.  This field is OPTIONAL.

   The values of the "flags" field defined by this specification differentiates between are as
   follows:

   "bearer"  If this flag is included, the access token being requested
      is a specific
      instance (the client instance, identified by its unique key) and bearer token.  If this flag is omitted, the software running access token is
      bound to the key used by the client instance (the in this request, or
      the key's most recent rotation.  Methods for presenting bound and
      bearer access tokens are described in Section 7.2.  [[ See issue
      #38 (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/38)
      ]]

   "split"  If this flag is included, the client software).  For some
      kinds instance is capable of client software, there could be many instances
      receiving a different number of that
      software, each instance with tokens than specified in the token
      request (Section 2.1), including receiving multiple access tokens
      (Section 3.2.2) in response to any single token request
      (Section 2.1.1) or a different key.

   Resource Server (RS)  server that provides operations on protected
      resources, where operations require number of access tokens than
      requested in a valid multiple access token issued request (Section 2.1.2).  The
      "label" fields of the returned additional tokens are chosen by
      an the
      AS.

   Resource Owner (RO)  subject entity that may grant or deny operations
      on resources it has authority upon.

      Note:  The client instance MUST be able to tell from the act token
      response where and how it can use each of granting or denying an operation may the access tokens.  [[
      See issue #37 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
      issues/37) ]]

   Flag values MUST NOT be manual
      (i.e. through an interaction with a physical person) or automatic
      (i.e. through predefined organizational rules).

   End-user  natural person that operates a client instance.

      Note: that natural person may or may not included more than once.

   Additional flags can be defined by extensions using a registry TBD
   (Section 11).

   In the same entity as following example, the
      RO.

   The design of GNAP does not assume any one deployment architecture,
   but instead attempts client instance is requesting access to define roles that can be fulfilled in
   a
   number complex resource described by a pair of different ways access request object.

   "access_token": {
       "access": [
           {
               "type": "photo-api",
               "actions": [
                   "read",
                   "write",
                   "delete"
               ],
               "locations": [
                   "https://server.example.net/",
                   "https://resource.local/other"
               ],
               "datatypes": [
                   "metadata",
                   "images"
               ]
           },
           {
               "type": "walrus-access",
               "actions": [
                   "foo",
                   "bar"
               ],
               "locations": [
                   "https://resource.other/"
               ],
               "datatypes": [
                   "data",
                   "pictures",
                   "walrus whiskers"
               ]
           }
       ],
       "label": "token1-23",
       "flags": [ "split" ]
   }

   If access is approved, the resulting access token is valid for different use cases.  As long as a given
   role fulfills all of its obligations the
   described resource and behaviors as defined by is bound to the
   protocol, GNAP does not make additional requirements on client instance's key (or its structure
   or setup.

   Multiple roles can
   most recent rotation).  The token is labeled "token1-23" and could be fulfilled
   split into multiple access tokens by the same party, and a given party
   can switch roles in different instances of the protocol.  For
   example, AS, if the RO and end-user AS chooses.  The
   token response structure is described in Section 3.2.1.

2.1.2.  Requesting Multiple Access Tokens

   To request multiple access tokens to be returned in many instances are the same person,
   where a user is authorizing single
   response, the client instance to act on their own
   behalf at the RS.  In this case, one party fulfills both sends an array of objects as the RO
   and end-user roles, but value
   of the roles themselves are still defined
   separately from each other "access_token" parameter.  Each object MUST conform to allow the
   request format for other use cases where they
   are fulfilled by different parties.

   For another example, in some complex scenarios, an RS receiving
   requests from one client instance can act as a client instance for single access token request, as specified in
   requesting a
   downstream secondary RS single access token (Section 2.1.1).  Additionally, each
   object in order to fulfill the original request.  In
   this case, one piece of software is both an RS and a client instance
   from different perspectives, array MUST include the "label" field, and it fulfills all values of
   these roles separately
   as far as the overall protocol is concerned.

   A single role need not fields MUST be deployed as a monolithic service.  For
   example, A unique within the request.  If the client
   instance could have components that are installed
   on the end-user's device as well as does not include a back-end system that it
   communicates with.  If both of these components participate "label" value for any entry in the
   delegation protocol, they are both considered part of array,
   or the client
   instance.  If there are several copies values of the client software that
   run separately but all share "label" field are not unique within the same key material, such as a
   deployed cluster, then this cluster is considered a single client
   instance.

   In these cases, array,
   the distinct components of what is considered a GNAP
   client instance may use any number of different communication
   mechanisms between them, all of which would be considered AS MUST return an
   implementation detail of the client instances error.

   The following non-normative example shows a request for two separate
   access tokens, "token1" and out of scope of
   GNAP.

   For another example, an AS could likewise be built out of many
   constituent components "token2".

   "access_token": [
       {
           "label": "token1",
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "dolphin-metadata"
           ]
       },
       {
           "label": "token2",
           "access": [
               {
                   "type": "walrus-access",
                   "actions": [
                       "foo",
                       "bar"
                   ],
                   "locations": [
                       "https://resource.other/"
                   ],
                   "datatypes": [
                       "data",
                       "pictures",
                       "walrus whiskers"
                   ]
               }
           ],
           "flags": [ "bearer" ]
       }
   ]
   All approved access requests are returned in a distributed architecture.  The component
   that the client instance calls directly could be different from multiple access
   token response (Section 3.2.2) structure using the
   component that values of the RO interacts with to drive consent, since API
   calls and user interaction have different security considerations
   "label" fields in
   many environments.  Furthermore, the AS could need to collect
   identity claims request.

2.2.  Requesting Subject Information

   If the client instance is requesting information about the RO from one system that deals with user
   attributes while generating access tokens at another system that
   deals with security rights.  From the perspective of GNAP, all of
   these are pieces of
   the AS and together fulfill AS, it sends a "subject" field as a JSON object.  This object MAY
   contain the role following fields (or additional fields defined in a
   registry TBD (Section 11)).

   formats (array of strings)  An array of subject identifier subject
      types requested for the AS RO, as defined by the protocol.  These pieces may have their own internal
   communications mechanisms which are considered out
      [I-D.ietf-secevent-subject-identifiers].

   assertions (array of scope strings)  An array of GNAP.

1.3.  Elements

   In addition to the roles above, the protocol also involves several
   elements that are acted upon by the roles throughout the process.

   Attribute  characteristics related to a subject.

   Access requested assertion
      formats.  Possible values include "id_token" for an [OIDC] ID
      Token and "saml2" for a data artifact representing SAML 2 assertion.  Additional assertion
      values are defined by a set of rights and/or
      attributes.

      Note: an access token registry TBD (Section 11).  [[ See issue
      #41 (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/41)
      ]]

   "subject": {
      "formats": [ "iss_sub", "opaque" ],
      "assertions": [ "id_token", "saml2" ]
   }

   The AS can be first issued to an client instance
      (requiring authorization by determine the RO) and subsequently rotated.

   Grant  (verb): to permit an instance of client software to receive
      some attributes at a specific time RO's identity and valid permission for a specific
      duration and/or to exercise some set of delegated rights to access
      a protected resource (noun): the act of granting.

   Privilege  right or attribute associated releasing
   this information through interaction with a subject.

      Note: the RO defines and maintains the rights and attributes
      associated to (Section 4), AS
   policies, or assertions presented by the protected resource, and might temporarily
      delegate some set of those privileges to an end-user.  This
      process client instance
   (Section 2.4).  If this is refered to determined positively, the AS MAY return
   the RO's information in its response (Section 3.4) as privilege delegation.

   Protected Resource  protected API (Application Programming Interface)
      served by an RS and that can be accessed requested.

   Subject identifier types requested by a client, if and the client instance serve only
      if a valid access token is provided.

      Note:
   to avoid complex sentences, identify the specification document may
      simply refer to resource instead of protected resource.

   Right  ability given to a subject to perform a given operation on a
      resource under RO in the control context of an RS.

   Subject  person, organization or device.

   Subject Information  statement asserted the AS and can't be used as
   communication channels by an the client instance, as discussed in
   Section 3.4.

   The AS about SHOULD NOT re-use subject identifiers for multiple different
   ROs.

   Note: the "formats" and "assertions" request fields are independent
   of each other, and a subject.

1.4.  Sequences

   GNAP can be used in returned assertion MAY omit a variety of ways to allow requested subject
   identifier.

   [[ See issue #43 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/43) ]]

2.3.  Identifying the core delegation
   process Client Instance

   When sending a non-continuation request to take place.  Many portions of this process are
   conditionally present depending on the context AS, the client
   instance MUST identify itself by including the "client" field of the deployments,
   request and not every step in this overview will happen by signing the request as described in all circumstances. Section 7.3.  Note
   that for a connection between roles in continuation request (Section 5), the client instance is
   identified by its association with the request being continued and so
   this process does field is not
   necessarily indicate that a specific protocol message sent under those circumstances.

   When client instance information is sent across by value, the wire between "client" field
   of the components fulfilling request consists of a JSON object with the roles following fields.

   key (object / string)  The public key of the client instance to be
      used in question, this request as described in Section 7.1 or
   that a particular step is required every time.  For example, for reference to
      a
   client instance interested key as described in only getting subject information
   directly, and not calling an RS, all steps involving the RS below do
   not apply.

   In some circumstances, the information needed at a given stage is
   communicated out of band or Section 7.1.1.  This field is preconfigured between the components
   or entities performing REQUIRED.

   class_id (string)  An identifier string that the roles.  For example, one entity AS can fulfil
   multiple roles, use to
      identify the client software comprising this client instance.  The
      contents and so explicit communication between format of this field are up to the roles AS.  This field is
   not necessary within the protocol flow.  Additionally some components
   may not be involved in all use cases.  For example, a client instance
   could be calling
      OPTIONAL.

   display (object)  An object containing additional information that
      the AS just MAY display to get direct user information the RO during interaction, authorization,
      and have
   no need to get an access token to call an RS.

       +------------+         +------------+
       | End-user   | ~ ~ ~ ~ |  Resource  |
       |            |         | Owner (RO) |
       +------------+         +------------+
           +                         +
           +                         +
          (A)                       (B)
           +                         +
           +                         +
       +--------+                    +          +------------+
       | management.  This field is OPTIONAL.

"client": {
    "key": {
        "proof": "httpsig",
        "jwk": {
                    "kty": "RSA",
                    "e": "AQAB",
                    "kid": "xyz-1",
                    "alg": "RS256",
                    "n": "kOB5rR4Jv0GMeLaY6_It_r3ORwdf8ci_JtffXyaSx8..."
        },
        "cert": "MIIEHDCCAwSgAwIBAgIBATANBgkqhkiG9w0BAQsFA..."
    },
    "class_id": "web-server-1234",
    "display": {
        "name": "My Client | (1)                +          |  Resource  |
       |Instance|                    +          |   Server   |
       |        |       +---------------+       |    (RS)    |
       |        |--(2)->| Authorization |       |            |
       |        |<-(3)--|     Server    |       |            |
       |        |       |      (AS)     |       |            |
       |        |--(4)->|               |       |            |
       |        |<-(5)--|               |       |            |
       |        |--------------(6)------------->|            |
       |        |       |               |   (7) |            |
       |        |<-------------(8)------------->|            |
       |        |--(9)->|               |       |            |
       |        |<-(10)-|               |       |            |
       |        |--------------(11)------------>|            |
       |        |       |               |  (12) |            |
       |        |-(13)->|               |       |            |
       |        |       |               |       |            |
       +--------+       +---------------+       +------------+

   Legend
   + + + indicates Display Name",
        "uri": "https://example.net/client"
    }
}

   Additional fields are defined in a possible interaction registry TBD (Section 11).

   The client instance MUST prove possession of any presented key by the
   "proof" mechanism associated with the key in the request.  Proof
   types are defined in a human
   ----- indicates registry TBD (Section 11) and an interaction between protocol roles
   ~ ~ ~ indicates a potential equivalence or out-of-band
           communication between roles

   *  (A) The end-user interacts with initial set
   of methods is described in Section 7.3.

   Note that the AS MAY know the client instance instance's public key ahead of
   time, and the AS MAY apply different policies to indicate a
      need for resources the request
   depending on behalf of what has been registered against that key.  If the RO.  This could identify same
   public key is sent by value on subsequent access requests, the
      RS AS
   SHOULD treat these requests as coming from the same client instance needs to call,
   for purposes of identification, authentication, and policy
   application.  If the resources needed, or AS does not know the
      RO that is needed to approve client instance's public
   key ahead of time, the request.  Note that AS MAY accept or reject the RO request based on
   AS policy, attestations within the "client" request, and
      end-user are often other
   mechanisms.

   [[ See issue #44 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/44) ]]

2.3.1.  Identifying the Client Instance by Reference

   If the same entity in practice, but some more
      dynamic processes are discussed in
      [I-D.draft-ietf-gnap-resource-servers].

   *  (1) The client instance determines what access is needed and which has an instance identifier that the AS can use
   to approach for access.  Note that for most situations, determine appropriate key information, the client instance is pre-configured with which AS to talk to and
      which kinds can
   send this instance identifier as a direct reference value in lieu of access it needs.

   *  (2)
   the "client" object.  The instance identifier MAY be assigned to a
   client instance requests access at runtime through the Section 3.5 or MAY be obtained
   in another fashion, such as a static registration process at the AS.

   "client": "client-541-ab"

   When the AS receives a request with an instance identifier, the AS
   MUST ensure that the key used to sign the request (Section 2).

   *  (3) The 7.3) is
   associated with the instance identifier.

   If the AS processes does not recognize the instance identifier, the request and determines what
   MUST be rejected with an error.

   If the client instance is needed identified in this manner, the registered
   key for the client instance MAY be a symmetric key known to
      fulfill the request. AS.
   The client instance MUST NOT send a symmetric key by value in the
   request, as doing so would expose the key directly instead of proving
   possession of it.

2.3.2.  Providing Displayable Client Instance Information

   If the client instance has additional information to display to the
   RO during any interactions at the AS, it MAY send that information in
   the "display" field.  This field is a JSON object that declares
   information to present to the RO during any interactive sequences.

   name (string)  Display name of the client software

   uri (string)  User-facing web page of the client software

   logo_uri (string)  Display image to represent the client software

   "display": {
       "name": "My Client Display Name",
       "uri": "https://example.net/client"
   }

   [[ See issue #48 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/48) ]]

   Additional display fields are defined by a registry TBD (Section 11).

   The AS sends its response to the client
      instance (Section 3).

   *  (B) If SHOULD use these values during interaction is required, the AS interacts with the RO
      (Section 4) to gather authorization. RO.  The interactive component
   values are for informational purposes only and MUST NOT be taken as
   authentic proof of the AS can function using a variety of possible mechanisms
      including web page redirects, applications, challenge/response
      protocols, client instance's identity or other methods. source.  The RO approves the request for the AS
   MAY restrict display values to specific client instance being operated instances, as
   identified by the end-user.  Note that the RO
      and end-user are often the same entity their keys in practice.

   *  (4) The client instance continues the grant at Section 2.3.

2.3.3.  Authenticating the AS (Section 5).

   *  (5) Client Instance

   If the presented key is known to the AS determines that access can be granted, it returns and is associated with a
      response to
   single instance of the client instance (Section 3) including an access
      token (Section 3.2) for calling software, the RS process of presenting a
   key and any directly returned
      information (Section 3.4) about proving possession of that key is sufficient to authenticate
   the RO.

   *  (6) The client instance uses the access token (Section 7.2) to
      call the RS.

   *  (7) AS.  The RS determines if the token is sufficient for AS MAY associate policies with
   the request client instance identified by examining the token.  The means of the RS determining this
      access are out of scope of this specification, but some options
      are discussed in [I-D.draft-ietf-gnap-resource-servers].

   *  (8) The key, such as limiting which
   resources can be requested and which interaction methods can be used.
   For example, only specific client instance calls the RS (Section 7.2) using the instances with certain known keys
   might be trusted with access token until the RS or client instance determine that the
      token is no longer valid.

   *  (9) When the token no longer works, tokens without the client instance fetches an
      updated access token (Section 6.1) based on AS interacting
   directly with the rights granted RO as in
      (5).

   *  (10) Appendix D.3.

   The AS issues presentation of a new access token (Section 3.2) key allows the AS to strongly associate
   multiple successive requests from the client
      instance.

   *  (11) The same client instance uses with each
   other.  This is true when the new access token (Section 7.2) AS knows the key ahead of time and can
   use the key to call authenticate the RS.

   *  (12) The RS determines client instance, but also if the new token key
   is sufficient ephemeral and created just for the
      request.  The means of the RS determining this access are out of
      scope of this specification, but some options are discussed in
      [I-D.draft-ietf-gnap-resource-servers].

   *  (13) The client instance disposes series of requests.  As such
   the token (Section 6.2) once
      the AS MAY allow for client instances to make requests with unknown
   keys.  This pattern allows for ephemeral client instances, such as
   single-page applications, and client software with many individual
   long-lived instances, such as mobile applications, to generate key
   pairs per instance has completed its access of the RS and no
      longer needs use the token. keys within the protocol without
   having to go through a separate registration step.  The following sections and Appendix D contain specific guidance on
   how AS MAY limit
   which capabilities are made available to use GNAP in different situations and deployments. client instances with
   unknown keys.  For example, it is possible for the AS could have a policy saying that
   only previously-registered client instance to never instances can request an
   access token and never call an RS, just as it is possible for there
   not particular
   resources, or that all client instances with unknown keys have to be a user involved in
   interactively approved by an RO.

2.4.  Identifying the delegation process.

1.4.1.  Redirect-based Interaction

   In this example flow, User

   If the client instance is a web application that
   wants access to resources on behalf of knows the current user, who acts as
   both identity of the end-user and through one
   or more identifiers or assertions, the resource owner (RO).  Since client instance MAY send that
   information to the AS in the "user" field.  The client instance is capable MAY
   pass this information by value or by reference.

   sub_ids (array of directing objects)  An array of subject identifiers for the user to
      end-user, as defined by [I-D.ietf-secevent-subject-identifiers].

   assertions (object)  An object containing assertions as values keyed
      on the assertion type defined by a registry TBD (Section 11).
      Possible keys include "id_token" for an arbitrary URL [OIDC] ID Token and
   receiving responses from the user's browser, interaction here is
   handled through front-channel redirects using the user's browser.
   The redirection URL used
      "saml2" for interaction is a service hosted SAML 2 assertion.  Additional assertion values are
      defined by a registry TBD (Section 11).  [[ See issue #41
      (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/41) ]]

   "user": {
      "sub_ids": [ {
        "format": "opaque",
        "id": "J2G8G8O4AZ"
      } ],
      "assertions": {
        "id_token": "eyj..."
      }
   }

   Subject identifiers are hints to the AS in this example.  The client instance uses a persistent session
   with the user to ensure determining the same user RO and
   MUST NOT be taken as declarative statements that a particular RO is starting the
   interaction is the user that returns from
   present at the interaction.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         | User |
 |Instance|                                  |        |         |      |
 |        |< (1) + Start Session + + + + + + + + + + + + + + + +|      |
 |        |                                  |        |         |      |
 |        |--(2)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(3)-- Interaction Needed -------|        |         |      |
 |        |                                  |        |         |      |
 |        |+ (4) + Redirect for Interaction + + + + + + + + + > |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (6) +>|      |
 |        |                                  |        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |< (7) + Redirect for Continuation + + + + + + + + + +|      |
 |        |                                  |        |         +------+
 |        |--(8)--- Continue Request ------->|        |
 |        |                                  |        |
 |        |<-(9)----- Grant Access ----------|        |
 |        |                                  |        |
 |        |                                  |        |     +--------+
 |        |--(10)-- Access API ---------------------------->|   RS   |
 |        |                                  |        |     |        |
 |        |<-(11)-- API Response ---------------------------|        |
 |        |                                  |        |     +--------+
 +--------+                                  +--------+

   1.   The client instance establishes a verifiable session to and acting as the
        user, in end-user.
   Assertions SHOULD be validated by the role of AS. [[ See issue #49
   (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/49) ]]

   If the identified end-user does not match the RO present at the AS
   during an interaction step, the AS SHOULD reject the request with an
   error.

   [[ See issue #50 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/50) ]]

   If the AS trusts the end-user.

   2.   The client instance requests access to present verifiable
   assertions, the AS MAY decide, based on its policy, to skip
   interaction with the RO, even if the resource (Section 2).
        The client instance indicates that it provides one or
   more interaction modes in its request.

2.4.1.  Identifying the User by Reference

   The AS can redirect identify the current end-user to an
        arbitrary URL (Section 2.5.1.1) and receive the client instance with
   a redirect from reference which can be used by the
        browser (Section 2.5.2.1).  The client instance stores
        verification information to refer to the
   end-user across multiple requests.  If the client instance has a
   reference for its redirect in the session created
        in (1).

   3.   The AS determines end-user at this AS, the client instance MAY pass
   that interaction is needed and responds
        (Section 3) with reference as a URL string.  The format of this string is opaque to send
   the client instance.

   "user": "XUT2MFM1XBIKJKSDU8QM"

   One means of dynamically obtaining such a user to (Section 3.3.1) and
        information needed to verify reference is from the redirect (Section 3.3.4) in
        (7).  The
   AS also includes information returning an "opaque" subject identifier as described in
   Section 3.4.  Other means of configuring a client instance with a
   user identifier are out of scope of this specification.

   User reference identifiers are not intended to be human-readable user
   identifiers or structured assertions.  For the client instance will
        need to continue
   send either of these, use the full user request object (Section 3.1) in (8).  The 2.4)
   instead.

   If the AS
        associates this continuation information with does not recognize the user reference, it MUST return an ongoing request
        that
   error.

2.5.  Interacting with the User

   Often, the AS will be referenced require interaction with the RO (Section 4) in (4), (6),
   order to approve a requested delegation to the client instance for
   both access to resources and (8).

   4.   The direct subject information.  Many times
   the end-user using the client instance stores is the verification same person as the RO,
   and continuation
        information from (3) in the session from (1).  The client instance then redirects can directly drive interaction with the end
   user to by facilitating the process through means such as redirection to
   a URL (Section 4.1.1)
        given by or launching an application.  Other times, the AS in (3).  The user's browser loads client instance
   can provide information to start the RO's interaction redirect URL.  The AS loads the pending request
        based on the incoming URL generated in (3).

   5.   The user authenticates at the AS, taking on a secondary
   device, or the role of the RO.

   6.   As the RO, client instance will wait for the user authorizes RO to approve the pending
   request from the asynchronously.  The client instance.

   7.   When instance could also be signaled
   that interaction has concluded through a callback mechanism.

   The client instance declares the AS parameters for interaction methods
   that it can support using the "interact" field.

   The "interact" field is done interacting a JSON object with three keys whose values
   declare how the client can initiate and complete the user, request, as well
   as provide hints to the AS redirects
        the about user back (Section 4.2.1) to the preferences such as locale.  A
   client instance using the
        redirect URL provided in (2).  The redirect URL is augmented
        with MUST NOT declare an interaction reference that mode it does not
   support.  The client instance MAY send multiple modes in the same
   request.  There is no preference order specified in this request.  An
   AS associates with MAY respond to any, all, or none of the
        ongoing request created presented interaction
   modes (Section 3.3) in (2) a request, depending on its capabilities and referenced in (4).  The
        redirect URL
   what is also augmented with a hash allowed to fulfill the request.

   start (list of strings/objects)  Indicates how the security
        information provided in (2) and (3).  The client instance loads
        the verification information from (2) and (3) from
      can start an interaction.

   finish (object)  Indicates how the session
        created in (1).  The client instance calculates a hash
        (Section 4.2.3) based on this information and continues only if
        the hash validates.  Note can receive an
      indication that interaction has finished at the client instance needs AS.

   hints (object)  Provides additional information to
        ensure that inform the parameters for
      interaction process at the incoming request match those
        that it is expecting from AS.

   The "interact" field MUST contain the session created in (1). "start" key, and MAY contain
   the "finish" and "hints" keys.  The value of each key is an array
   which contains strings or JSON objects as defined below.

   In this non-normative example, the client instance also needs to be prepared for is indicating that
   it can redirect (Section 2.5.1.1) the end-user never
        being returned to an arbitrary URL
   and can receive a redirect (Section 2.5.2.1) through a browser
   request.

   "interact": {
       "start": ["redirect"],
       "finish": {
           "method": "redirect",
           "uri": "https://client.example.net/return/123455",
           "nonce": "LKLTI25DK82FX4T4QFZC"
       }
   }

   In this non-normative example, the client instance is indicating that
   it can display a user code (Section 2.5.1.3) and handle timeouts
        appropriately.

   8.   The client instance loads direct the continuation information from (3)
        and sends end-user
   to an arbitrary URL (Section 2.5.1.1) on a secondary device, but it
   cannot accept a redirect or push callback.

   "interact": {
       "start": ["redirect", "user_code"]
   }
   If the interaction reference from (7) in client instance does not provide a request to
        continue suitable interaction
   mechanism, the request (Section 5.1).  The AS validates cannot contact the
        interaction reference ensuring that RO asynchronously, and the reference AS
   determines that interaction is associated
        with required, then the request being continued.

   9.   If AS SHOULD return an
   error since the request has been authorized, client instance will be unable to complete the
   request without authorization.

   The AS grants access SHOULD apply suitable timeouts to the
        information in the form of access tokens (Section 3.2) any interaction mechanisms
   provided, including user codes and
        direct subject information (Section 3.4) to the client instance.

   10. redirection URLs.  The client
   instance uses the access token (Section 7.2) SHOULD apply suitable timeouts to call
        the RS.

   11.  The RS validates any callback URLs.

2.5.1.  Start Mode Definitions

   This specification defines the access token and returns following interaction start modes as
   an appropriate
        response for the API.

   An example set array of protocol messages for this method string values under the "start" key:

   "redirect"  Indicates that the client instance can be found in
   Appendix D.1.

1.4.2.  User-code Interaction

   In this example flow, direct the end-
      user to an arbitrary URL for interaction.  Section 2.5.1.1

   "app"  Indicates that the client instance is a can launch an application
      on the end-user's device for interaction.  Section 2.5.1.2

   "user_code"  Indicates that is capable
   of presenting the client instance can communicate a short,
      human-readable short code to the user and directing
   the user to enter that code at end-user for use with a known stable
      URL.  The  Section 2.5.1.3

2.5.1.1.  Redirect to an Arbitrary URL

   If the user enters
   the code at client instance is an interactive service hosted capable of directing the end-user to a URL
   defined by the AS in at runtime, the client instance indicates this
   example. by
   sending the "redirect" field with the boolean value "true".  The
   means by which the client instance will activate this URL is not capable out of presenting
   scope of this specification, but common methods include an
   arbitrary HTTP
   redirect, launching a browser on the end-user's device, providing a
   scannable image encoding, and printing out a URL to the user, nor an interactive
   console.  While this URL is it capable of accepting incoming
   HTTP requests from generally hosted at the AS, the user's browser.  The client
   instance polls the
   AS while it is waiting for the RO can make no assumptions about its contents, composition, or
   relationship to authorize the request.  The
   user's AS grant URL.

   "interact": {
     "start": ["redirect"]
   }

   If this interaction mode is assumed to occur on a secondary device.  In supported for this example it is assumed that the user is both the end-user client instance and RO,
   though the user is not assumed to be interacting with
   request, the AS returns a redirect interaction response
   Section 3.3.1.  The client instance through the same web browser used for manages this interaction at method
   as described in Section 4.1.1.

2.5.1.2.  Open an Application-specific URL

   If the AS.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         | User |
 |Instance|--(1)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(2)-- Interaction Needed -------|        |         |      |
 |        |                                  |        |         |      |
 |        |+ (3) + + Display User Code + + + + + + + + + + + + >|      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (4) + |      |
 |        |                                  |        |Open URI |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |--(9)--- Continue Request (A) --->|        |         |      |
 |        |                                  |        |<+ (6) +>|      |
 |        |<-(10)- Not Yet Granted (Wait) ---|        |  Code   |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (7) +>|      |
 |        |                                  |        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (8) +>|      |
 |        |                                  |        |Completed|      |
 |        |                                  |        |         |      |
 |        |--(11)-- Continue Request (B) --->|        |         +------+
 |        |                                  |        |
 |        |<-(12)----- Grant Access ---------|        |
 |        |                                  |        |
 |        |                                  |        |     +--------+
 |        |--(13)-- Access API ---------------------------->|   RS   |
 |        |                                  |        |     |        |
 |        |<-(14)-- API Response ---------------------------|        |
 |        |                                  |        |     +--------+
 +--------+                                  +--------+
   1.   The client instance requests access to can open a URL associated with an application
   on the end-user's device, the resource (Section 2).
        The client instance indicates that it can display a user code
        (Section 2.5.1.3).

   2. this by
   sending the "app" field with boolean value "true".  The AS means by
   which the client instance determines that interaction is needed and responds
        (Section 3) with a user code to communicate to the user
        (Section 3.3.3).  This could optionally include a URL application to direct
        the user to, but open with
   this URL should be static and so could be
        configured in the client instance's documentation.  The AS also
        includes information the are out of scope of this specification.

   "interact": {
      "start": ["app"]
   }

   If this interaction mode is supported for this client instance will need to continue
        the request (Section 3.1) in (8) and (10).  The
   request, the AS associates
        this continuation information returns an app interaction response with an ongoing request that will
        be referenced in (4), (6), (8), and (10).

   3. app URL
   payload Section 3.3.2.  The client instance stores the continuation information from (2)
        for use manages this interaction
   method as described in (8) and (10).  The Section 4.1.3.

   [[ See issue #54 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/54) ]]

2.5.1.3.  Display a Short User Code

   If the client instance then communicates
        the is capable of displaying or otherwise
   communicating a short, human-entered code to the user (Section 4.1.1) given RO, the client
   instance indicates this by sending the AS in (2).

   4.   The user's directs their browser to "user_code" field with the user code URL.
   boolean value "true".  This URL code is stable and can to be communicated via the client software's
        documentation, the AS documentation, or the client software
        itself.  Since it is assumed that the RO will interact with the
        AS through entered at a secondary device, the client instance static URL
   that does not
        provide a mechanism to launch the RO's browser change at runtime.  While this URL.

   5.   The end-user authenticates URL is generally hosted
   at the AS, taking on the role of client instance can make no assumptions about its
   contents, composition, or relationship to the
        RO.

   6.   The RO enters AS grant URL.

   "interact": {
       "start": ["user_code"]
   }

   If this interaction mode is supported for this client instance and
   request, the AS returns a user code communicated and interaction URL as specified
   in (3) to the AS. Section 3.3.3.  The AS
        validates client instances manages this code against a current request interaction
   method as described in process.

   7.   As the RO, the user authorizes the pending request from Section 4.1.2

2.5.2.  Finish Interaction Modes

   If the client instance.

   8.   When the AS instance is done interacting with the user, capable of receiving a message from the AS indicates
        to the RO
   indicating that the request RO has been completed.

   9.   Meanwhile, completed their interaction, the client
   instance loads indicates this by sending the continuation
        information stored at (3) and continues following members of an object
   under the request (Section 5). "finish" key.

   method (string)  REQUIRED.  The AS determines which ongoing access request is referenced
        here and checks its state.

   10.  If the access request has not yet been authorized by the RO in
        (6), callback method that the AS responds will use
      to contact the client instance to continue instance.  This specification defines the
        request (Section 3.1) at
      following interaction completion methods, with other values
      defined by a future time through additional polled
        continuation requests.  This response can include updated
        continuation information as well as information regarding how
        long registry TBD (Section 11):

      "redirect"  Indicates that the client instance should wait before calling again.  The
        client instance replaces its stored continuation information can receive a
         redirect from the previous response (2).  Note that the AS may need to
        determine that end-user's device after interaction with the
         RO has not approved the request in a
        sufficient amount of time and return an appropriate error to concluded.  Section 2.5.2.1

      "push"  Indicates that the client instance.

   11.  The client instance continues to poll can receive an HTTP
         POST request from the AS (Section 5.2) after interaction with the new continuation information in (9).

   12.  If the request RO has been authorized,
         concluded.  Section 2.5.2.2

   uri (string)  REQUIRED.  Indicates the AS grants access to URI that the
        information in AS will either
      send the form of access tokens (Section 3.2) and
        direct subject information (Section 3.4) RO to after interaction or send an HTTP POST request.
      This URI MAY be unique per request and MUST be hosted by or
      accessible by the client instance.

   13.  The  This URI MUST NOT contain any
      fragment component.  This URI MUST be protected by HTTPS, be
      hosted on a server local to the RO's browser ("localhost"), or use
      an application-specific URI scheme.  If the client instance uses the access token (Section 7.2) needs
      any state information to tie to call the RS.

   14. front channel interaction
      response, it MUST use a unique callback URI to link to that
      ongoing state.  The RS validates the access token allowable URIs and returns an appropriate
        response for the API.

   An example set of protocol messages for this method can URI patterns MAY be found in
   Appendix D.2.

1.4.3.  Asynchronous Authorization

   In this example flow, the end-user and RO roles are fulfilled
      restricted by
   different parties, and the RO does not interact with AS based on the client
   instance. instance's presented key
      information.  The AS reaches out asynchronously callback URI SHOULD be presented to the RO
      during the
   request process to gather the RO's authorization for the client
   instance's request.  The client instance polls the AS while it is
   waiting for the RO interaction phase before redirect.

   nonce (string)  REQUIRED.  Unique value to authorize be used in the request.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         |  RO  |
 |Instance|--(1)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(2)-- Not Yet Granted (Wait) ---|        |         |      |
 |        |                                  |        |<+ (3) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |--(6)--- Continue Request (A) --->|        |         |      |
 |        |                                  |        |<+ (4) +>|      |
 |        |<-(7)-- Not Yet Granted (Wait) ---|        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |Completed|      |
 |        |                                  |        |         |      |
 |        |--(8)--- Continue Request (B) --->|        |         +------+
 |        |                                  |        |
 |        |<-(9)------ Grant Access ---------|        |
 |        |                                  |        |
 |        |                                  |        |     +--------+
 |        |--(10)-- Access API ---------------------------->|   RS   |
 |        |                                  |        |     |        |
 |        |<-(11)-- API Response ---------------------------|        |
 |        |                                  |        |     +--------+
 +--------+                                  +--------+

   1.   The client instance requests access to calculation
      of the resource (Section 2).
        The client instance does not send any interactions modes "hash" query parameter sent to the
        server, indicating that it does not expect callback URL, must be
      sufficiently random to interact with be unguessable by an attacker.  MUST be
      generated by the
        RO.  The client instance can also signal which RO it requires
        authorization from, if known, by using the user request section
        (Section 2.4).

   2. as a unique value for this
      request.

   hash_method (string)  OPTIONAL.  The AS determines that hash calculation mechanism to be
      used for the callback hash in Section 4.2.3.  Can be one of "sha3"
      or "sha2".  If absent, the default value is "sha3".  [[ See issue
      #56 (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/56)
      ]]

   If this interaction mode is needed, but the supported for this client instance cannot interact with and
   request, the RO.  The AS responds
        (Section 3) with the information returns a nonce for use in validating the client instance will need callback
   response (Section 3.3.4).  Requests to continue the request (Section 3.1) callback URI MUST be
   processed as described in (6) Section 4.2, and (8), including
        a signal the AS MUST require
   presentation of an interaction callback reference as described in
   Section 5.1.

   [[ See issue #58 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/58) ]]

   [[ See issue #59 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/59) ]]

2.5.2.1.  Receive an HTTP Callback Through the Browser

   A finish "method" value of "redirect" indicates that the client
   instance should wait before checking will expect a request from the status of RO's browser using the request again.  The AS associates this
        continuation information with an ongoing request that will be
        referenced HTTP
   method GET as described in (3), (4), (5), (6), and (8).

   3.   The AS determines which RO Section 4.2.1.

   "interact": {
       "finish": {
           "method": "redirect",
           "uri": "https://client.example.net/return/123455",
           "nonce": "LKLTI25DK82FX4T4QFZC"
       }
   }

   Requests to contact based on the request callback URI MUST be processed by the client instance
   as described in
        (1), through a combination of Section 4.2.1.

   Since the user incoming request (Section 2.4), to the resources request (Section 2.1), and other policy
        information.  The AS contacts callback URL is from the RO's
   browser, this method is usually used when the RO and authenticates them.

   4.   The RO authorizes end-user are the pending request from
   same entity.  As such, the client instance.

   5.   When instance MUST ensure the AS end-user
   is done interacting with the RO, present on the AS indicates request to
        the RO prevent substitution attacks.

2.5.2.2.  Receive an HTTP Direct Callback

   A finish "method" value of "push" indicates that the request has been completed.

   6.   Meanwhile, the client instance loads the continuation
        information stored at (2) and continues the request (Section 5).
        The AS determines which ongoing access
   will expect a request is referenced
        here and checks its state.

   7.   If from the access request has not yet been authorized by AS directly using the RO HTTP method POST
   as described in
        (6), the AS responds Section 4.2.2.

   "interact": {
       "finish": {
           "method": "push",
           "uri": "https://client.example.net/return/123455",
           "nonce": "LKLTI25DK82FX4T4QFZC"
       }
   }

   Requests to the callback URI MUST be processed by the client instance to continue
   as described in Section 4.2.2.

   Since the incoming request (Section 3.1) at a future time through additional
        polling.  This response can include refreshed credentials as
        well as information regarding how long to the callback URL is from the AS and not
   from the RO's browser, the client instance
        should wait before calling again. MUST NOT require the end-
   user to be present on the incoming HTTP request.

   [[ See issue #60 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/60) ]]

2.5.3.  Hints

   The client instance replaces
        its stored continuation information "hints" key is an object describing one or more suggestions from
   the previous response
        (2).  Note client instance that the AS may need can use to determine help drive user
   interaction.

   This specification defines the following properties under the "hints"
   key:

   ui_locales (array of strings)  Indicates the end-user's preferred
      locales that the AS can use during interaction, particularly
      before the RO has not
        approved the request authenticated.  Section 2.5.3.1

   The following sections detail requests for interaction modes.
   Additional interaction modes are defined in a sufficient amount of time and return
        an appropriate error to registry TBD
   (Section 11).

2.5.3.1.  Indicate Desired Interaction Locales

   If the client instance.

   8.   The instance knows the end-user's locale and language
   preferences, the client instance continues can send this information to poll the AS (Section 5.2) with
   using the new continuation information from (7).

   9. "ui_locales" field with an array of locale strings as
   defined by [RFC5646].

   "interact": {
       "hints": {
           "ui_locales": ["en-US", "fr-CA"]
       }
   }

   If the request has been authorized, possible, the AS grants access SHOULD use one of the locales in the array, with
   preference to the
        information first item in the form array supported by the AS.  If
   none of access tokens (Section 3.2) the given locales are supported, the AS MAY use a default
   locale.

2.5.4.  Extending Interaction Modes

   Additional interaction start modes, finish modes, and
        direct subject information hints are
   defined in a registry TBD (Section 3.4) to the client instance.

   10. 11).

2.6.  Extending The client instance uses the access token Grant Request

   The request object MAY be extended by registering new items in a
   registry TBD (Section 7.2) 11).  Extensions SHOULD be orthogonal to call other
   parameters.  Extensions MUST document any aspects where the RS.

   11.  The RS validates extension
   item affects or influences the access token values or behavior of other request
   and returns an appropriate response for the API.

   An example set of protocol messages for this method can be found in
   Appendix D.4.

1.4.4.  Software-only Authorization objects.

3.  Grant Response

   In this example flow, the AS policy allows the client instance response to
   make a call on its own behalf, without client instance's request, the need for AS responds with a RO to be
   involved at runtime to approve
   JSON object as the decision.  Since there HTTP entity body.  Each possible field is no
   explicit RO, detailed
   in the client instance does not interact with an RO.

   +--------+                            +--------+
   | Client |                            |   AS   |
   |Instance|--(1)--- Request Access --->|        |
   |        |                            |        |
   |        |<-(2)---- Grant Access -----|        |
   |        |                            |        |  +--------+
   |        |--(3)--- Access API ------------------->|   RS   |
   |        |                            |        |  |        |
   |        |<-(4)--- API Response ------------------|        |
   |        |                            |        |  +--------+
   +--------+                            +--------+

   1.  The client instance requests access to sections below

   continue (object)  Indicates that the resource (Section 2).
       The client instance does not send any interactions modes to the
       server.

   2.  The AS determines that can continue
      the request is been authorized, the AS
       grants by making one or more continuation requests.
      Section 3.1

   access_token (object / array of objects)  A single access token or
      set of access tokens that the client instance can use to call the information in
      RS on behalf of the form RO.  Section 3.2.1

   interact (object)  Indicates that interaction through some set of access tokens
       (Section 3.2)
      defined mechanisms needs to take place.  Section 3.3

   subject (object)  Claims about the RO as known and declared by the client instance.  Note that direct subject
       information (Section 3.4) is not generally applicable
      AS, as described in Section 3.4.

   instance_id (string)  An identifier this use
       case, as there is no user involved.

   3.  The client instance uses the access token (Section 7.2) can use to call
      identify itself when making future requests.  Section 3.5

   error (object)  An error code indicating that something has gone
      wrong.  Section 3.6

   In this example, the RS.

   4.  The RS validates AS is returning an interaction URL
   (Section 3.3.1), a callback nonce (Section 3.3.4), and a continuation
   response (Section 3.1).

   NOTE: '\' line wrapping per RFC 8792

   {
       "interact": {
           "redirect": "https://server.example.com/interact/4CF492ML\
             VMSW9MKMXKHQ",
           "finish": "MBDOFXG4Y5CVJCX821LH"
       },
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU",
           },
           "uri": "https://server.example.com/tx"
       }
   }
   In this example, the AS is returning a bearer access token
   (Section 3.2.1) with a management URL and returns an appropriate
       response for a subject identifier
   (Section 3.4) in the API.

   An example set form of protocol messages for this method can be found in
   Appendix D.3.

1.4.5.  Refreshing an Expired Access Token opaque identifier.

   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "flags": ["bearer"],
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
       },
       "subject": {
           "sub_ids": [ {
              "format": "opaque",
              "id": "J2G8G8O4AZ"
           } ]
       }
   }

   In this example flow, example, the client instance receives AS is returning set of subject identifiers
   (Section 3.4), simultaneously as an access token to
   access opaque identifier, an email
   address, and a resource server through some valid GNAP process.  The client
   instance uses decentralized identifier (DID).

   {
       "subject": {
           "sub_ids": [ {
              "subject_type": "opaque",
              "id": "J2G8G8O4AZ"
           }, {
              "format": "email",
              "email": "user@example.com"
           }, {
              "format": "did",
              "url": "did:example:123456"
           } ]
       }
   }

3.1.  Request Continuation

   If the AS determines that token at the RS for some time, but eventually request can be continued with
   additional requests, it responds with the
   access token expires.  The client instance then gets "continue" field.  This
   field contains a new access
   token by rotating JSON object with the expired access token following properties.

   uri (string)  REQUIRED.  The URI at which the AS using the
   token's management URL.

   +--------+                                          +--------+
   | Client |                                          |   AS   |
   |Instance|--(1)--- Request Access ----------------->|        |
   |        |                                          |        |
   |        |<-(2)--- Grant Access --------------------|        |
   |        |                                          |        |
   |        |                             +--------+   |        |
   |        |--(3)--- Access Resource --->|   RS   |   |        |
   |        |                             |        |   |        |
   |        |<-(4)--- Success Response ---|        |   |        |
   |        |                             |        |   |        |
   |        |                             |        |   |        |
   |        |                             |        |   |        |
   |        |--(5)--- Access Resource --->|        |   |        |
   |        |                             |        |   |        |
   |        |<-(6)--- Error Response -----|        |   |        |
   |        |                             +--------+   |        |
   |        |                                          |        |
   |        |--(7)--- Rotate Token ------------------->|        |
   |        |                                          |        |
   |        |<-(8)--- Rotated Token -------------------|        |
   |        |                                          |        |
   +--------+                                          +--------+

   1.  The client instance requests access to can
      make continuation requests.  This URI MAY vary per request, or MAY
      be stable at the resource (Section 2).

   2.  The AS grants access to if the resource (Section 3) with AS includes an access
       token (Section 3.2) usable at the RS. token.  The access token response
       includes
      client instance MUST use this value exactly as given when making a token management URI.

   3.
      continuation request (Section 5).

   wait (integer)  RECOMMENDED.  The amount of time in integer seconds
      the client instance uses the access token (Section 7.2) to call
       the RS.

   4.  The RS validates SHOULD wait after receiving this continuation
      handle and calling the URI.

   access_token (object)  REQUIRED.  A unique access token and returns an appropriate
       response for
      continuing the API.

   5.  Time passes and the client instance uses request, in the format specified in Section 3.2.1.
      This access token MUST be bound to call the RS again.

   6.  The RS validates client instance's key used
      in the request and MUST NOT be a "bearer" token.  As a
      consequence, the "flags" array of this access token MUST NOT
      contain the string "bearer" and determines that the "key" field MUST be omitted.
      This access token is expired The RS responds to MUST NOT be usable at resources outside of the client instance with an
       error.

   7.
      AS.  The client instance calls MUST present the access token management URI returned in
       (2) all
      requests to rotate the access token (Section 6.1). continuation URI as described in Section 7.2.  [[
      See issue #66 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
      issues/66) ]]

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 60
       }
   }

   The client instance uses can use the access token (Section 7.2) in values of this call as well
       as the appropriate key, see the token rotation section for
       details.

   8.  The AS validates field to continue the rotation
   request including the signature and
       keys presented as described in (5) and returns a new access token
       (Section 3.2.1).  The response includes a new access token and
       can also include updated token management information, which Section 5.  Note that the client instance will store
   MUST sign all continuation requests with its key as described in place of
   Section 7.3 and MUST present the values returned access token in
       (2).

1.4.6.  Requesting User Information

   In this scenario, its continuation
   request.

   This field SHOULD be returned when interaction is expected, to allow
   the client instance does not call an RS and does
   not request an to follow up after interaction has been
   concluded.

3.2.  Access Tokens

   If the AS has successfully granted one or more access token.  Instead, tokens to the
   client instance only
   requests and is returned direct subject information (Section 3.4).
   Many different interaction modes can be used in this scenario, so
   these are shown only in the abstract as functions of instance, the AS here.

 +--------+                                  +--------+         +------+
 | Client |                                  |   AS   |         | User |
 |Instance|                                  |        |         |      |
 |        |--(1)--- Request Access --------->|        |         |      |
 |        |                                  |        |         |      |
 |        |<-(2)--- Request Access ----------|        |         |      |
 |        |                                  |        |         |      |
 |        |+ (3) + Facilitate Interaction + + + + + + + + + + > |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (4) +>|      |
 |        |                                  |        |  AuthN  |      |
 |        |                                  |        |         |      |
 |        |                                  |        |<+ (5) +>|      |
 |        |                                  |        |  AuthZ  |      |
 |        |                                  |        |         |      |
 |        |< (6) + Signal Continuation + + + + + + + + + + + + +|      |
 |        |                                  |        |         +------+
 |        |--(7)--- Continue Request ------->|        |
 |        |                                  |        |
 |        |<-(8)----- Grant Access ----------|        |
 |        |                                  |        |
 +--------+                                  +--------+

   1. responds with the "access_token" field.  This
   field contains either a single access token as described in
   Section 3.2.1 or an array of access tokens as described in
   Section 3.2.2.

   The client instance requests uses any access tokens in this response to subject information
       (Section 2).

   2.  The call
   the RS as described in Section 7.2.

3.2.1.  Single Access Token

   If the client instance has requested a single access token and the AS determines
   has granted that interaction is needed and access token, the AS responds
       (Section 3) with appropriate information for facilitating user
       interaction (Section 3.3).

   3.  The client instance facilitates the user interacting
   "access_token" field.  The value of this field is an object with the AS
       (Section 4) as directed in (2).

   4.
   following properties.

   value (string)  REQUIRED.  The user authenticates at value of the AS, taking on access token as a string.
      The value is opaque to the role client instance.  The value SHOULD be
      limited to ASCII characters to facilitate transmission over HTTP
      headers within other protocols without requiring additional
      encoding.

   label (string)  REQUIRED for multiple access tokens, OPTIONAL for
      single access token.  The value of the RO.

   5.  As the RO, "label" the user authorizes client instance
      provided in the pending associated token request from (Section 2.1), if
      present.  If the
       client instance.

   6.  When token has been split by the AS is done interacting with AS, the user, value of the
      "label" field is chosen by the AS returns and the
       user "split" field is
      included and set to "true".

   manage (string)  OPTIONAL.  The management URI for this access token.
      If provided, the client instance MAY manage its access token as
      described in Section 6.  This management URI is a function of the
      AS and signals continuation.

   7.  The is separate from the RS the client instance loads is requesting
      access to.  This URI MUST NOT include the continuation information from (2) access token value and calls the AS to continue
      SHOULD be different for each access token issued in a request.

   access (array of objects/strings)  RECOMMENDED.  A description of the request (Section 5).
      rights associated with this access token, as defined in Section 8.
      If included, this MUST reflect the request has been authorized, rights associated with the AS grants
      issued access to the token.  These rights MAY vary from what was
      requested direct subject information (Section 3.4) to by the client instance.  At this stage, the user is generally considered
       "logged in" to

   expires_in (integer)  OPTIONAL.  The number of seconds in which the
      access will expire.  The client instance based on the identifiers and
       assertions provided by MUST NOT use the AS. access
      token past this time.  An RS MUST NOT accept an access token past
      this time.  Note that the access token MAY be revoked by the AS can restrict or
      RS at any point prior to its expiration.

   key (object / string)  OPTIONAL.  The key that the
       subject information returned and it might not match what token is bound to,
      if different from the client instance's presented key.  The key
      MUST be an object or string in a format described in Section 7.1.
      The client instance requested, see MUST be able to dereference or process the section on subject key
      information
       for details.

2.  Requesting Access

   To start a request, in order to be able to sign the client instance sends JSON [RFC8259] document
   with an object as its root.  Each member request.

   flags (array of strings)  OPTIONAL.  A set of flags that represent
      attributes or behaviors of the request object
   represents a different aspect access token issued by the AS.

   The values of the "flags" field defined by this specification are as
   follows:

   "bearer"  This flag indicates whether the token is bound to the
      client instance's request.  Each
   field key.  If the "bearer" flag is present, the
      access token is described in detail in a section below.

   access_token (object / array of objects)  Describes bearer token, and the rights "key" field in this
      response MUST be omitted.  If the "bearer" flag is omitted and
      properties associated with the requested access token.
      Section 2.1

   subject (object)  Describes
      "key" field in this response is omitted, the information about token is bound the RO that
      key used by the client instance is requesting to be returned directly (Section 2.3) in its request for
      access.  If the
      response from "bearer" flag is omitted, and the AS.  Section 2.2

   client (object / string)  Describes "key" field is
      present, the client instance that token is
      making this request, including bound to the key that the client instance
      will use to protect this request and any continuation requests at proofing mechanism
      indicated in the "key" field.

   "durable"  OPTIONAL.  Flag indicating a hint of AS and any user-facing information about behavior on token
      rotation.  If this flag is present, then the client instance
      used in interactions.  Section 2.3

   user (object / string)  Identifies the end-user can
      expect a previously-issued access token to continue to work after
      it has been rotated (Section 6.1) or the AS underlying grant request
      has been modified (Section 5.3), resulting in the issuance of new
      access tokens.  If this flag is omitted, the client instance can
      anticipate a manner given access token will stop working after token
      rotation or grant request modification.  Note that the AS a token flagged
      as "durable" can verify, either directly still expire or be revoked through any normal
      means.

   "split"  OPTIONAL.  Flag indicating that this token was generated by interacting with the
      end-user
      issuing multiple access tokens in response to determine their status as the RO.  Section 2.4

   interact (object)  Describes one of the modes that client
      instance's token request (Section 2.1) objects.  This behavior
      MUST NOT be used unless the client instance has
      for allowing the RO to interact with the AS and modes for specifically
      requested it by use of the
      client instance to receive updates when interaction is complete.
      Section 2.5 "split" flag.

   Flag values MUST NOT be included more than once.

   Additional members of this request object flags can be defined by extensions to this protocol as described in Section 2.6

   A using a registry TBD
   (Section 11).

   The following non-normative example of shows a grant request is below:

   { single access token bound
   to the client instance's key used in the initial request, with a
   management URL, and that has access to three described resources (one
   using an object and two described by reference strings).

   NOTE: '\' line wrapping per RFC 8792

   "access_token": {
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "dolphin-metadata"
           ]
       },
       "client": {
         "display": {
           "name": "My Client Display Name",
           "uri": "https://example.net/client"
         },
         "key": {
           "proof": "httpsig",
           "jwk": {
                       "kty": "RSA",
                       "e": "AQAB",
                       "kid": "xyz-1",
                       "alg": "RS256",
                       "n": "kOB5rR4Jv0GMeL...."
           }
         }
       },
       "interact": {
           "start": ["redirect"],
           "finish":
       "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
       "manage": "https://server.example.com/token/PRY5NM33O\
           M4TB8N6BW7OZB8CDFONP219RP1L",
       "access": [
           {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
               "type": "photo-api",
               "actions": [
                   "read",
                   "write",
                   "dolphin"
               ],
               "locations": [
                   "https://server.example.net/",
                   "https://resource.local/other"
               ],
               "datatypes": [
                   "metadata",
                   "images"
               ]
           },
       "subject": {
           "formats": ["iss_sub", "opaque"],
           "assertions": ["id_token"]
       }
           "read", "dolphin-metadata"
       ]
   }

   The request and response MUST be sent as following non-normative example shows a JSON object in the body of
   the HTTP POST request with Content-Type "application/json", unless
   otherwise specified by the signature mechanism.

   The authorization server MUST include the HTTP "Cache-Control"
   response header field [RFC7234] single bearer access
   token with a value set to "no-store".

2.1.  Requesting Access access to Resources two described resources.

   "access_token": {
       "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
       "flags": ["bearer"],
       "access": [
           "finance", "medical"
       ]
   }

   If the client instance is requesting one or more access tokens for
   the purpose of accessing an API, the client instance MUST include an
   "access_token" field.  This field MUST be an object (for requested a single access token
   (Section 2.1.1)) or an array of these objects (for 2.1.1), the AS MUST NOT respond with the multiple access tokens (Section 2.1.2)),
   token structure unless the client instance sends the "split" flag as
   described in the
   following sections. Section 2.1.1.  Requesting a Single Access Token

   To request a single access token,

   If the client instance sends an
   "acccess_token" object composed of AS has split the following fields. access (array of objects/strings)  Describes token response, the rights that response MUST
   include the "split" flag.

   [[ See issue #69 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/69) ]]

3.2.2.  Multiple Access Tokens

   If the client instance is requesting for one or more has requested multiple access tokens to be
      used and the
   AS has granted at RS's.  This field is REQUIRED.  Section 8

   label (string)  A unique name chosen by least one of them, the client instance to refer
      to AS responds with the resulting access token.
   "access_token" field.  The value of this field is opaque
      to a JSON array, the AS.  If this field is included
   members of which are distinct access tokens as described in the request, the AS
   Section 3.2.1.  Each object MUST
      include have a unique "label" field,
   corresponding to the same label token labels chosen by the client instance in
   the token response (Section 3.2).  This
      field is REQUIRED if used as part of a multiple access token request (Section 2.1.2), 2.1.2).

   In this non-normative example, two tokens are issued under the names
   "token1" and is OPTIONAL otherwise.

   flags (array of strings)  A set of flags that indicate desired
      attributes or behavior to be attached to "token2", and only the first token has a management URL
   associated with it.

   NOTE: '\' line wrapping per RFC 8792

   "access_token": [
       {
           "label": "token1",
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [ "finance" ]
       },
       {
           "label": "token2",
           "value": "UFGLO2FDAFG7VGZZPJ3IZEMN21EVU71FHCARP4J1",
           "access": [ "medical" ]
       }
   }

   Each access token by corresponds to one of the
      AS.  This field is OPTIONAL.

   The values objects in the
   "access_token" array of the "flags" field defined by this specification client instance's request
   (Section 2.1.2).

   The multiple access token response MUST be used when multiple access
   tokens are as
   follows:

   "bearer"  If this flag is included, the requested, even if only one access token being requested is issued as a bearer token.  If this flag is omitted,
   result of the access token is
      bound request.  The AS MAY refuse to issue one or more of the key used by
   requested access tokens, for any reason.  In such cases the client instance in this request, or refused
   token is omitted from the key's most recent rotation.  Methods for presenting bound response and
      bearer all of the other issued access
   tokens are described included in Section 7.2.  [[ See issue
      #38 (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/38)
      ]]

   "split" the response the requested names appropriate
   names.

   If this flag is included, the client instance is capable of
      receiving a different number of tokens than specified in the token
      request (Section 2.1), including receiving requested multiple access tokens
   (Section 3.2.2) in response to any 2.1.2), the AS MUST NOT respond with a single access token request
      (Section 2.1.1) or
   structure, even if only a different number of single access tokens than
      requested in token is granted.  In such
   cases, the AS responds with a multiple access token request (Section 2.1.2).  The
      "label" fields of the returned additional tokens are chosen by structure
   containing one access token.

   If the
      AS.  The client instance MUST be able to tell from AS has split the access token
      response where and how it can use each of response, the access tokens.  [[
      See issue #37 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
      issues/37) ]]

   Flag values response MUST NOT be included more than once.

   Additional flags can be defined by extensions using a registry TBD
   (Section 11).

   In
   include the following example, "split" flag in the client instance is requesting access to
   a complex resource described by a pair of access request object. "flags" array.

   "access_token": {
       "access": [
       {
               "type": "photo-api",
               "actions": [
                   "read",
                   "write",
                   "delete"
               ],
               "locations": [
                   "https://server.example.net/",
                   "https://resource.local/other"
               ],
               "datatypes":
           "label": "split-1",
           "value": "8N6BW7OZB8CDFONP219-OS9M2PMHKUR64TBRP1LT0",
           "flags": ["split"],
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [
                   "metadata",
                   "images" "fruits" ]
       },
       {
               "type": "walrus-access",
               "actions": [
                   "foo",
                   "bar"
               ],
               "locations": [
                   "https://resource.other/"
               ],
               "datatypes": [
                   "data",
                   "pictures",
                   "walrus whiskers"
               ]
           }
       ],
           "label": "token1-23", "split-2",
           "value": "FG7VGZZPJ3IZEMN21EVU71FHCAR-UFGLO2FDAP4J1",
           "flags": ["split"],
           "access": [ "split" "vegetables" ]
       }

   If
   }

   Each access token MAY be bound to different keys with different
   proofing mechanisms.

   If token management (Section 6) is approved, the resulting allowed, each access token is valid for SHOULD
   have different "manage" URIs.

   [[ See issue #70 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/70) ]]

3.3.  Interaction Modes

   If the
   described resource client instance has indicated a capability to interact with
   the RO in its request (Section 2.5), and the AS has determined that
   interaction is bound both supported and necessary, the AS responds to the
   client instance's key (or its
   most recent rotation).  The token instance with any of the following values in the "interact"
   field of the response.  There is labeled "token1-23" no preference order for interaction
   modes in the response, and could be
   split into multiple access tokens it is up to the client instance to
   determine which ones to use.  All supported interaction methods are
   included in the same "interact" object.

   redirect (string)  Redirect to an arbitrary URL.  Section 3.3.1

   app (string)  Launch of an application URL.  Section 3.3.2

   finish (string)  A nonce used by the AS, if client instance to verify the AS chooses.  The
   token response structure
      callback after interaction is described in completed.  Section 3.2.1.

2.1.2.  Requesting Multiple Access Tokens

   To request multiple access tokens 3.3.4

   user_code (object)  Display a short user code.  Section 3.3.3
   Additional interaction mode responses can be defined in a registry
   TBD (Section 11).

   The AS MUST NOT respond with any interaction mode that the client
   instance did not indicate in its request.  The AS MUST NOT respond
   with any interaction mode that the AS does not support.  Since
   interaction responses include secret or unique information, the AS
   SHOULD respond to be returned each interaction mode only once in a single
   response, an ongoing
   request, particularly if the client instance sends modifies its request
   (Section 5.3).

3.3.1.  Redirection to an array of objects as the value
   of arbitrary URL

   If the "access_token" parameter.  Each object MUST conform client instance indicates that it can redirect to an arbitrary
   URL (Section 2.5.1.1) and the
   request format AS supports this mode for a single access token the client
   instance's request, as specified in
   requesting the AS responds with the "redirect" field, which
   is a single access token (Section 2.1.1).  Additionally, each
   object in string containing the array URL to direct the end-user to.  This URL
   MUST include be unique for the "label" field, request and all values of
   these fields MUST NOT contain any security-
   sensitive information such as user identifiers or access tokens.

   "interact": {
       "redirect": "https://interact.example.com/4CF492MLVMSW9MKMXKHQ"
   }

   The URL returned is a function of the AS, but the URL itself MAY be unique within
   completely distinct from the request.  If URL the client instance uses to request
   access (Section 2), allowing an AS to separate its user-interactive
   functionality from its back-end security functionality.  If the AS
   does not include a "label" value for any entry in directly host the array,
   or functionality accessed through the values of given
   URL, then the "label" field are not unique within means for the array, interaction functionality to communicate
   with the rest of the AS MUST return an error.

   The following non-normative example shows a request for two separate
   access tokens, "token1" and "token2".

   "access_token": [
       {
           "label": "token1",
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "dolphin-metadata"
           ]
       },
       {
           "label": "token2",
           "access": [
               {
                   "type": "walrus-access",
                   "actions": [
                       "foo",
                       "bar"
                   ],
                   "locations": [
                       "https://resource.other/"
                   ],
                   "datatypes": [
                       "data",
                       "pictures",
                       "walrus whiskers"
                   ]
               }
           ],
           "flags": [ "bearer" ]
       }
   ]
   All approved access requests are returned in the multiple access
   token response (Section 3.2.2) structure using the values out of scope for this specification.

   [[ See issue #72 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/72) ]]

   The client instance sends the
   "label" fields in end-user to the request.

2.2.  Requesting Subject Information

   If URL to interact with
   the AS.  The client instance is requesting information about the RO from
   the AS, it sends a "subject" field as a JSON object.  This object MAY
   contain MUST NOT alter the following fields (or additional fields defined URL in a
   registry TBD (Section 11)).

   formats (array of strings)  An array of subject identifier subject
      types requested any way.  The
   means for the RO, as defined by
      [I-D.ietf-secevent-subject-identifiers].

   assertions (array client instance to send the end-user to this URL is out
   of strings)  An array scope of requested assertion
      formats.  Possible values this specification, but common methods include "id_token" for an [OIDC] ID
      Token and "saml2" for a SAML 2 assertion.  Additional assertion
      values are defined by HTTP
   redirect, launching the system browser, displaying a registry TBD (Section 11).  [[ scannable code,
   or printing out the URL in an interactive console.  See issue
      #41 (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/41)
      ]]

   "subject": {
      "formats": [ "iss_sub", "opaque" ],
      "assertions": [ "id_token", "saml2" ]
   }

   The AS details of
   the interaction in Section 4.1.1.

3.3.2.  Launch of an application URL

   If the client instance indicates that it can determine the RO's identity launch an application
   URL (Section 2.5.1.2) and permission for releasing
   this information through interaction with the RO (Section 4), AS
   policies, or assertions presented by supports this mode for the client instance
   (Section 2.4).  If this is determined positively,
   instance's request, the AS MAY return responds with the RO's information in its response (Section 3.4) as requested.

   Subject identifier types requested by "app" field, which is a
   string containing the URL for the client instance serve only to identify the RO in the context of the AS and can't launch.  This
   URL MUST be used as
   communication channels by the client instance, as discussed in
   Section 3.4.

   The AS SHOULD NOT re-use subject identifiers unique for multiple different
   ROs.

   Note: the "formats" and "assertions" request fields are independent
   of each other, and a returned assertion MAY omit a requested subject
   identifier.

   [[ See issue #43 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/43) ]]

2.3.  Identifying MUST NOT contain any security-
   sensitive information such as user identifiers or access tokens.

   "interact": {
       "app": "https://app.example.com/launch?tx=4CF492MLV"
   }

   The means for the Client Instance

   When sending a non-continuation request launched application to communicate with the AS, the AS are
   out of scope for this specification.

   The client instance MUST identify itself by including the "client" field of launches the
   request URL as appropriate on its platform,
   and by signing the request as described in Section 7.3.  Note
   that means for a continuation request (Section 5), the client instance is
   identified by its association with the request being continued and so to launch this field URL is not sent under those circumstances.

   When out of
   scope of this specification.  The client instance information is MUST NOT alter the
   URL in any way.  The client instance MAY attempt to detect if an
   installed application will service the URL being sent by value, before
   attempting to launch the "client" field application URL.  See details of the request consists
   interaction in Section 4.1.3.

   [[ See issue #71 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/71) ]]

3.3.3.  Display of a JSON object with the following fields.

   key (object / string)  The public key of Short User Code

   If the client instance to be
      used in this request as described in Section 7.1 or indicates that it can display a reference to short
   user-typeable code (Section 2.5.1.3) and the AS supports this mode
   for the client instance's request, the AS responds with a key as described in Section 7.1.1. "user_code"
   field.  This field is REQUIRED.

   class_id an object that contains the following members.

   code (string)  An identifier string  REQUIRED.  A unique short code that the AS user can use to
      identify the client software comprising this client instance.  The
      contents and format type
      into an authorization server.  This string MUST be case-
      insensitive, MUST consist of only easily typeable characters (such
      as letters or numbers).  The time in which this field are up to the AS.  This field code will be
      accepted SHOULD be short lived, such as several minutes.  It is
      OPTIONAL.

   display (object)  An object containing additional information
      RECOMMENDED that this code be no more than eight characters in
      length.

   url (string)  RECOMMENDED.  The interaction URL that the AS MAY display to client
      instance will direct the RO during interaction, authorization,
      and management. to.  This field is OPTIONAL.

"client": {
    "key": {
        "proof": "httpsig",
        "jwk": {
                    "kty": "RSA",
                    "e": "AQAB",
                    "kid": "xyz-1",
                    "alg": "RS256",
                    "n": "kOB5rR4Jv0GMeLaY6_It_r3ORwdf8ci_JtffXyaSx8..."
        },
        "cert": "MIIEHDCCAwSgAwIBAgIBATANBgkqhkiG9w0BAQsFA..."
    },
    "class_id": "web-server-1234",
    "display": URL MUST be stable such that
      client instances can be statically configured with it.

   "interact": {
        "name": "My Client Display Name",
        "uri": "https://example.net/client"
       "user_code": {
           "code": "A1BC-3DFF",
           "url": "https://srv.ex/device"
       }
   }

   Additional fields are defined in a registry TBD (Section 11).

   The client instance MUST prove possession of any presented key by communicate the
   "proof" mechanism associated with "code" to the key end-user in
   some fashion, such as displaying it on a screen or reading it out
   audibly.

   The client instance SHOULD also communicate the request.  Proof
   types are defined in URL if possible to
   facilitate user interaction, but since the URL should be stable, the
   client instance should be able to safely decide to not display this
   value.  As this interaction mode is designed to facilitate
   interaction via a registry TBD (Section 11) and an initial set
   of methods secondary device, it is described in Section 7.3.

   Note not expected that the AS MAY know the
   client instance's public key ahead of
   time, and instance redirect the AS MAY apply different policies end-user to the request
   depending on what has been registered against URL given here at
   runtime.  Consequently, the URL needs to be stable enough that key. a
   client instance could be statically configured with it, perhaps
   referring the end-user to the URL via documentation instead of
   through an interactive means.  If the same
   public key client instance is sent by value on subsequent access requests, capable of
   communicating an arbitrary URL to the AS
   SHOULD treat these requests end-user, such as coming from through a
   scannable code, the same client instance can use the "redirect"
   (Section 2.5.1.1) mode for purposes this purpose instead of identification, authentication, and policy
   application. or in addition to
   the user code mode.

   The URL returned is a function of the AS, but the URL itself MAY be
   completely distinct from the URL the client instance uses to request
   access (Section 2), allowing an AS to separate its user-interactive
   functionality from its back-end security functionality.  If the AS
   does not know directly host the client instance's public
   key ahead of time, functionality accessed through the AS MAY accept or reject given
   URL, then the means for the interaction functionality to communicate
   with the rest of the request based on AS policy, attestations within are out of scope for this specification.

   See details of the "client" request, and other
   mechanisms. interaction in Section 4.1.2.

   [[ See issue #44 #72 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/44)
   issues/72) ]]

2.3.1.  Identifying the Client Instance by Reference

3.3.4.  Interaction Finish

   If the client instance has an instance identifier indicates that it can receive a
   post-interaction redirect or push at a URL (Section 2.5.2) and the AS can use
   to determine appropriate key information,
   supports this mode for the client instance can
   send this instance identifier as a direct reference value in lieu of instance's request, the "client" object.  The instance identifier MAY be assigned to AS responds
   with a "finish" field containing a nonce that the client instance at runtime through the Section 3.5 or MAY be obtained
   will use in another fashion, such as a static registration process at validating the AS.

   "client": "client-541-ab" callback as defined in Section 4.2.

   "interact": {
       "finish": "MBDOFXG4Y5CVJCX821LH"
   }

   When the AS receives a request with an instance identifier, the AS
   MUST ensure that the key used to sign the request (Section 7.3) interaction is
   associated with the instance identifier.

   If completed, the AS does not recognize interaction component MUST
   contact the client instance identifier, using either a redirect or launch of the request
   MUST be rejected with
   RO's browser or through an error.

   If HTTP POST to the client instance is identified instance's
   callback URL using the method indicated in this manner, the registered
   key for interaction request
   (Section 2.5.2) as described in Section 4.2.

   If the client instance MAY be AS returns a symmetric key known to nonce, the AS.
   The client instance MUST NOT send continue a symmetric key by value in
   grant request before it receives the
   request, as doing so would expose associated interaction reference
   on the key directly instead of proving
   possession of it.

2.3.2.  Providing Displayable Client Instance callback URI.  See details in Section 4.2.

3.3.5.  Extending Interaction Mode Responses

   Extensions to this specification can define new interaction mode
   responses in a registry TBD (Section 11).  Extensions MUST document
   the corresponding interaction request.

3.4.  Returning Subject Information

   If information about the RO is requested and the AS grants the client
   instance has additional information to display access to that data, the
   RO during any interactions at AS returns the AS, it MAY send that approved information
   in the "display" "subject" response field.  This  The AS MUST return the "subject"
   field only in cases where the AS is a JSON object sure that declares
   information to present to the RO during any interactive sequences.

   name (string)  Display name and the end-user
   are the same party.  This can be accomplished through some forms of
   interaction with the client software

   uri (string)  User-facing web page RO (Section 4).

   This field is an object with the following OPTIONAL properties.

   sub_ids (array of objects)  An array of subject identifiers for the client software

   logo_uri (string)  Display image to represent
      RO, as defined by [I-D.ietf-secevent-subject-identifiers].

   assertions (object)  An object containing assertions as values keyed
      on the client software

       "display": {
           "name": "My Client Display Name",
           "uri": "https://example.net/client"
       }

   [[ See issue #48 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/48) ]]

   Additional display fields are assertion type defined by a registry TBD (Section 11).

   The AS SHOULD use these values during interaction with the RO.  The
   values are for informational purposes only and MUST NOT be taken  [[
      See issue #41 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
      issues/41) ]]

   updated_at (string)  Timestamp as
   authentic proof of an ISO8610 date string, indicating
      when the client instance's identity or source. identified account was last updated.  The AS client instance
      MAY restrict display values use this value to specific client instances, as
   identified by their keys in Section 2.3.

2.3.3.  Authenticating the Client Instance

   If the presented key is known determine if it needs to the AS and is associated with a
   single instance of the client software, the process of presenting a
   key and proving possession request updated
      profile information through an identity API.  The definition of that key
      such an identity API is sufficient to authenticate
   the client instance to out of scope for this specification.

   "subject": {
      "sub_ids": [ {
        "format": "opaque",
        "id": "XUT2MFM1XBIKJKSDU8QM"
      } ],
      "assertions": {
        "id_token": "eyj..."
      }
   }

   Subject identifiers returned by the AS.  The AS MAY associate policies with SHOULD uniquely identify the client instance identified by this key, such as limiting which
   resources can be requested and which interaction methods can be used.
   For example, only specific client instances with certain known keys
   might be trusted with access tokens without
   RO at the AS interacting
   directly with AS.  Some forms of subject identifier are opaque to the RO
   client instance (such as in Appendix D.3.

   The presentation of a key allows the AS subject of an issuer and subject pair),
   while others forms (such as email address and phone number) are
   intended to strongly associate
   multiple successive requests from allow the same client instance to correlate the identifier
   with each
   other.  This is true when other account information at the client instance.  The AS knows the key ahead of time and can
   use MUST
   ensure that the key returned subject identifiers only apply to authenticate the
   authenticated end user.  The client instance, but also if the key
   is ephemeral and created just instance MUST NOT request or use
   any returned subject identifiers for this series communication purposes (see
   Section 2.2).  That is, a subject identifier returned in the format
   of requests.  As such an email address or a phone number only identifies the RO to the
   AS MAY allow and does not indicate that the AS has validated that the
   represented email address or phone number in the identifier is
   suitable for client instances to make requests communication with unknown
   keys.  This pattern allows for ephemeral client instances, the current user.  To get such as
   single-page applications, and
   information, the client software with many individual
   long-lived instances, such as mobile applications, to generate key
   pairs per instance and MUST use the keys within the an identity protocol without
   having to go through a separate registration step.
   request and receive additional identity claims.  The AS MAY limit
   which capabilities details of an
   identity protocol and associated schema are made available to client instances with
   unknown keys.  For example, outside the AS could have scope of this
   specification.

   Extensions to this specification MAY define additional response
   properties in a policy saying that
   only previously-registered registry TBD (Section 11).

3.5.  Returning Dynamically-bound Reference Handles

   Many parts of the client instances can instance's request particular
   resources, can be passed as either a
   value or that all a reference.  The use of a reference in place of a value
   allows for a client instances with unknown keys have instance to optimize requests to be
   interactively approved by an RO.

2.4.  Identifying the User

   If AS.

   Some references, such as for the client instance knows the instance's identity of
   (Section 2.3.1) or the end-user requested resources (Section 8.1), can be
   managed statically through one an admin console or more identifiers developer portal
   provided by the AS or assertions, RS.  The developer of the client instance software can
   include these values in their code for a more efficient and compact
   request.

   If desired, the AS MAY send that
   information also generate and return some of these
   references dynamically to the AS client instance in its response to
   facilitate multiple interactions with the "user" field. same software.  The client
   instance MAY
   pass this information by value or by reference.

   sub_ids (array of objects)  An array SHOULD use these references in future requests in lieu of subject identifiers for
   sending the
      end-user, as defined associated data value.  These handles are intended to be
   used on future requests.

   Dynamically generated handles are string values that MUST be
   protected by [I-D.ietf-secevent-subject-identifiers].

   assertions (object)  An object containing assertions the client instance as secrets.  Handle values keyed
      on the assertion type defined by a registry TBD (Section 11).
      Possible keys include "id_token" for an [OIDC] ID Token MUST be
   unguessable and
      "saml2" for a SAML 2 assertion.  Additional assertion MUST NOT contain any sensitive information.  Handle
   values are opaque to the client instance.

   All dynamically generated handles are returned as fields in the root
   JSON object of the response.  This specification defines the
   following dynamic handle return, additional handles can be defined by in
   a registry TBD (Section 11).  [[ See issue #41
      (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/41) ]]

   "user": {
      "sub_ids": [ {
        "format": "opaque",
        "id": "J2G8G8O4AZ"
      } ],
      "assertions": {
        "id_token": "eyj..."
      }
   }

   Subject identifiers are hints

   instance_id (string)  A string value used to represent the AS
      information in determining the RO and
   MUST NOT be taken as declarative statements "client" object that a particular RO is
   present at the client instance and acting can
      use in a future request, as the end-user.
   Assertions SHOULD be validated by the AS. described in Section 2.3.1.

   This non-normative example shows one handle along side an issued
   access token.

   {
       "instance_id": "7C7C4AZ9KHRS6X63AJAO",
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0"
       }
   }

   [[ See issue #49
   (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/49) #77 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/77) ]]

   [[ See issue #78 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/78) ]]

3.6.  Error Response

   If the identified end-user does not match AS determines that the RO present at request cannot be issued for any
   reason, it responds to the AS
   during client instance with an interaction step, error message.

   error (string)  The error code.

   {

     "error": "user_denied"

   }
   The error code is one of the AS SHOULD reject following, with additional values
   available in a registry TBD (Section 11):

   user_denied  The RO denied the request.

   too_fast  The client instance did not respect the timeout in the wait
      response.

   unknown_request  The request with referenced an
   error. unknown ongoing access
      request.

   [[ See issue #50 #79 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/50)
   issues/79) ]]

   If

3.7.  Extending the AS trusts Response

   Extensions to this specification MAY define additional fields for the
   grant response in a registry TBD (Section 11).

4.  Determining Authorization and Consent

   When the client instance makes its Section 2 to present verifiable
   assertions, the AS MAY decide, based on its policy, for delegated
   access, it is capable of asking for several different kinds of
   information in response:

   *  the access being requested in the "access_token" request parameter

   *  the subject information being requested in the "subject" request
      parameter

   *  any additional requested information defined by extensions of this
      protocol

   The AS determines what authorizations and consents are required to skip
   interaction with
   fulfill this requested delegation.  The details of how the RO, even if AS makes
   this determination are out of scope for this document.  However,
   there are several common patterns defined and supported by GNAP for
   fulfilling these requirements, including information sent by the
   client instance provides one or
   more instance, information gathered through the interaction modes
   process, and information supplied by external parties.  An individual
   AS can define its own policies and processes for deciding when and
   how to gather the necessary authorizations and consent.

   The client instance can supply information directly to the AS in its
   request.

2.4.1.  Identifying  From this information, the User by Reference

   User reference identifiers AS can determine if the
   requested delegation can be dynamically issued by granted immediately.  The client instance
   can send several kinds of things, including:

   *  the AS
   (Section 3.5) to allow identity of the client instance to represent instance, known from the same end- presented keys
      or associated identifiers

   *  the identity of the end user to presented in the AS over subsequent requests.

   If "user" request
      parameter

   *  any additional information presented by the client instance has a reference for in the end-user at
      request, including any extensions

   The AS will verify this AS, presented information in the client instance MAY pass that reference as a string.  The format context of this string is opaque to the
   client instance.

   "user": "XUT2MFM1XBIKJKSDU8QM"

   User reference identifiers are not intended to be human-readable user
   identifiers or structured assertions.  For instance's request and can only trust the client instance to
   send either information as much
   as it trusts the presentation and context of these, use the full user request object (Section 2.4)
   instead.

   [[ See issue #51 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/51) ]] information.  If the
   AS does not recognize determines that the user reference, it MUST return an
   error.

2.5.  Interacting with information presented in the User

   Often, initial request
   is sufficient for granting the requested access, the AS will require interaction with MAY return
   the RO (Section 4) positive results immediately in
   order to approve a requested delegation to the client instance for
   both its Section 3 with access to resources tokens
   and direct subject information.  Many times
   the end-user using

   If the client instance AS determines that additional runtime authorization is
   required, the same person as AS can either deny the RO,
   and request outright or use a number
   of means at its disposal to gather that authorization from the client instance can directly drive
   appropriate ROs, including for example:

   *  starting interaction with the end user facilitated by facilitating the process through means client
      software, such as redirection to a URL redirection or launching an application.  Other times, user code

   *  challenging the client instance
   can provide information to start the RO's interaction on through a secondary
   device, or challenge-response
      mechanism

   *  requesting that the client instance will wait for the present specific additional
      information, such as a user's credential or an assertion

   *  contacting a RO to approve the
   request asynchronously.  The client instance could also be signaled
   that interaction has concluded through an out-of-band mechanism, such as a callback mechanism.

   The client instance declares the parameters for interaction methods
   that it can support using the "interact" field. push
      notification

   *  contacting an auxiliary software process through an out-of-band
      mechanism, such as querying a digital wallet

   The "interact" field authorization and consent gathering process in GNAP is left
   deliberately flexible to allow for a JSON object with three keys whose values
   declare how wide variety of different
   deployments, interactions, and methodologies.  In this process, the client
   AS can initiate and complete gather consent from the request, as well RO as provide hints to necessitated by the access that
   has been requested.  The AS about user preferences can sometimes determine which RO needs to
   consent based on what has been requested by the client instance, such
   as locale.  A
   client instance MUST NOT declare a specific RS record, an interaction mode identified user, or a request requiring
   specific access such as approval by an administrator.  If the AS has
   a means of contacting the RO directly, it does not
   support.  The could do so without
   involving the client instance MAY send multiple modes in its consent gathering process.  For
   example, the same
   request.  There is no preference order specified in this request.  An AS MAY respond could push a notification to any, all, or none of the presented interaction
   modes (Section 3.3) in a request, depending on its capabilities known RO and
   what is allowed to fulfill have the request.

   start (list of strings/objects)  Indicates how
   RO approve the client instance pending request asynchronously.  These interactions
   can start be through an interaction.

   finish (object)  Indicates how interface of the client instance can receive AS itself (such as a hosted web
   page), through another application (such as something installed on
   the RO's device), through a messaging fabric, or any other means.
   When interacting with an
      indication that interaction has finished at RO, the AS.

   hints (object)  Provides additional information AS can do anything it needs to inform
   determine the
      interaction process at authorization of the AS.

   The "interact" field MUST contain requested grant, including:

   *  authenticate the "start" key, and MAY contain RO, through a local account or some other means
      such as federated login

   *  validate the "finish" and "hints" keys.  The value RO through presentation of each key is an array
   which contains strings claims, attributes, or JSON objects as defined below.

   In this non-normative example,
      other information

   *  prompt the client instance is indicating that
   it can redirect (Section 2.5.1.1) RO for consent for the end-user requested delegation

   *  describe to an arbitrary URL
   and can receive a redirect (Section 2.5.2.1) through a browser
   request.

   "interact": {
       "start": ["redirect"],
       "finish": {
           "method": "redirect",
           "uri": "https://client.example.net/return/123455",
           "nonce": "LKLTI25DK82FX4T4QFZC"
       }
   }

   In this non-normative example, the client instance RO what information is indicating that
   it can display a user code (Section 2.5.1.3) being released, to whom,
      and direct the end-user for what purpose

   *  provide warnings to an arbitrary URL (Section 2.5.1.1) on a secondary device, but it
   cannot accept a redirect or push callback.

   "interact": {
       "start": ["redirect", "user_code"]
   }
   If the client instance does not provide a suitable interaction
   mechanism, RO about potential attacks or negative
      effects of allowing the AS cannot contact information

   *  allow the RO asynchronously, and to modify the AS
   determines client instance's requested access,
      including limiting or expanding that interaction is required, then access

   *  provide the AS SHOULD return RO with artifacts such as receipts to facilitate an
   error since
      audit trail of authorizations

   *  allow the client instance will be unable RO to complete deny the
   request without authorization. requested delegation

   The AS SHOULD apply suitable timeouts to any interaction mechanisms
   provided, including user codes and redirection URLs.  The client
   instance SHOULD apply suitable timeouts is also allowed to any callback URLs.

2.5.1.  Start Mode Definitions

   This specification defines request authorization from more than one
   RO, if the following interaction start modes as AS deems fit.  For example, a medical record might need to
   be released by both an array attending nurse and a physician, or both
   owners of string values under the "start" key:

   "redirect"  Indicates that the client instance can direct a bank account need to sign off on a transfer request.
   Alternatively, the end-
      user AS could require N of M possible RO's to an arbitrary URL for interaction.  Section 2.5.1.1

   "app"  Indicates approve a
   given request in order.  The AS could also determine that the client instance can launch an application
      on end
   user is not the end-user's device appropriate RO for interaction.  Section 2.5.1.2

   "user_code"  Indicates that the client instance can communicate a
      human-readable short code given request and reach out to
   the end-user appropriate RO asynchronously.  The details of determining which
   RO's are required for use with a stable
      URL.  Section 2.5.1.3

2.5.1.1.  Redirect to an Arbitrary URL

   If the given request are out of scope for this
   specification.

   The client instance can also indicate that it is capable of directing
   facilitating interaction with the end-user to a URL
   defined by end user, another party, or another
   piece of software through its interaction start (Section 2.5.1)
   request.  In many cases, the AS at runtime, end user is delegating their own access
   as RO to the client instance indicates this by
   sending the "redirect" field with instance.  Here, the boolean value "true".  The
   means by which AS needs to determine the client instance will activate this URL is out of
   scope
   identity of this specification, but common methods include an HTTP
   redirect, launching a browser on the end-user's device, providing a
   scannable image encoding, end user and printing out a URL will often need to interact directly
   with the end user to determine their status as an interactive
   console.  While this URL is generally hosted at RO and collect
   their consent.  If the AS, AS has determined that authorization is
   required and the client
   instance AS can make no assumptions about its contents, composition, support one or
   relationship to more of the AS grant URL.

   "interact": {
     "start": ["redirect"]
   }

   If this requested
   interaction mode is supported for this client instance and
   request, start methods, the AS returns a redirect the associated interaction response
   Section 3.3.1.
   start responses (Section 3.3).  The client instance manages this SHOULD initiate
   one or more of these interaction method
   as described methods (Section 4.1) in Section 4.1.1.

2.5.1.2.  Open an Application-specific URL

   If the client instance can open a URL associated with an application
   on order to
   facilitate the end-user's device, granting of the client instance indicates this by
   sending request.  If more than one interaction
   start method is available, the "app" field with boolean value "true".  The means by which the client instance determines the application chooses
   which methods to open with
   this URL are follow is out of scope of this specification.

   "interact": {
      "start": ["app"]
   }

   If this interaction mode is supported for this client instance and
   request, the AS returns an app interaction response with an app URL
   payload Section 3.3.2.  The
   client instance manages this MUST use each interaction method as described in Section 4.1.3.

   [[ See issue #54 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/54) ]]

2.5.1.3.  Display a Short User Code

   If once at most.

   After starting interaction, the client instance is capable of displaying or otherwise
   communicating can then make a short, human-entered code
   continuation request (Section 5) either in response to a signal
   indicating the RO, finish of the client
   instance indicates this interaction (Section 4.2), through
   polling, or through some other method defined by sending the "user_code" field with the
   boolean value "true".  This code is to be entered at a static URL
   that does not change at runtime.  While an extension of this URL is generally hosted
   at the AS,
   specification.

   If the AS and client instance have not reached a state where the
   delegation can make no assumptions about its
   contents, composition, or relationship to be granted, the AS grant URL.

   "interact": {
       "start": ["user_code"]
   }

   If this interaction mode is supported for this and client instance and
   request, can repeat the AS returns a user code and
   interaction URL process as specified
   in Section 3.3.3.  The long as the AS supplies the client instances manages this instance
   with continuation information (Section 3.1) to facilitate the ongoing
   requests.

4.1.  Interaction Start Methods

   To initiate an interaction start method as described in Section 4.1.2

2.5.2.  Finish Interaction Modes

   If indicated by the interaction
   start responses (Section 3.3) from the AS, the client instance is capable of receiving a message from
   follows the AS
   indicating steps defined by that the RO has completed their interaction, interaction method.  The actions of
   the client instance indicates required for the interaction start modes defined
   in this by sending specification are described in the following members of an object
   under the "finish" key.

   method (string)  REQUIRED.  The callback method that sections.

4.1.1.  Interaction at a Redirected URI

   When the AS will use end user is directed to contact an arbitrary URI through the
   "redirect" (Section 3.3.1) mode, the client instance.  This specification defines instance facilitates
   opening the
      following interaction completion methods, with other values
      defined by a registry TBD (Section 11):

      "redirect"  Indicates that URI through the end user's web browser.  The client
   instance can receive could launch the URI through the system browser, provide a
   clickable link, redirect from the end-user's device after interaction with user through HTTP response codes, or
   display the URI in a form the end user can use to launch such as a
   multidimensional barcode.  With this method, it is common (though not
   required) for the RO has concluded.  Section 2.5.2.1

      "push"  Indicates that to be the same party as the end-user, since the
   client instance can receive an HTTP
         POST request from has to communicate the AS after interaction with redirection URI to the RO has
         concluded.  Section 2.5.2.2

   uri (string)  REQUIRED.  Indicates end-
   user.

   In many cases, the URI that indicates a web page hosted at the AS,
   allowing the AS will either
      send to authenticate the end user as the RO to after interaction or send an HTTP POST request.
      This and
   interactively provide consent.  If the URI MAY be unique per is hosted by the AS, the
   AS MUST determine the grant request being referenced from the URL
   value itself.  If the URL cannot be associated with a currently
   active request, the AS MUST display an error to the RO and MUST be NOT
   attempt to redirect the RO back to any client instance even if a
   redirect finish method is supplied (Section 2.5.2.1).  If the URI is
   not hosted by or
      accessible by the client instance.  This AS directly, the means of communication between the
   AS and this URI are out of scope for this specification.

   The client instance MUST NOT contain any
      fragment component.  This URI MUST be protected by HTTPS, be
      hosted on a server local to modify the RO's browser ("localhost"), or use
      an application-specific URI scheme.  If when launching it, in
   particular the client instance needs MUST NOT add any state information to tie parameters to the front channel interaction
      response, it MUST use a unique callback URI to link to that
      ongoing state.
   URI.  The allowable URIs and URI patterns MAY MUST be
      restricted by reachable from the AS based end user's browser, though
   the URI MAY be opened on a separate device from the client instance's presented key
      information. instance
   itself.  The callback URI SHOULD MUST be presented to accessible from an HTTP GET request and MUST
   be protected by HTTPS or equivalent means.

4.1.2.  Interaction at the RO
      during User Code URI

   When the interaction phase before redirect.

   nonce (string)  REQUIRED.  Unique value end user is directed to be used in enter a short code through the calculation
      of
   "user_code" (Section 3.3.3) mode, the "hash" query parameter sent client instance communicates
   the user code to the callback URL, must be
      sufficiently random end-user and directs the end user to be unguessable by enter that
   code at an attacker.  MUST be
      generated by associated URI.  This mode is used when the client
   instance as a unique value for this
      request.

   hash_method (string)  OPTIONAL.  The hash calculation mechanism is not able to facilitate launching an arbitrary URI.  The
   associated URI could be
      used for statically configured with the callback hash in Section 4.2.3.  Can be one of "sha3" client
   instance or "sha2".  If absent, communicated in the response from the AS, but the default value is "sha3".  [[ See issue
      #56 (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/56)
      ]]

   If this interaction mode is supported for this client
   instance and
   request, communicates that URL to the AS returns end user.  As a nonce for use in validating consequence,
   these URIs SHOULD be short.

   In many cases, the callback
   response (Section 3.3.4).  Requests URI indicates a web page hosted at the AS,
   allowing the AS to authenticate the callback URI MUST be
   processed end user as described in Section 4.2, the RO and
   interactively provide consent.  If the URI is hosted by the AS, the
   AS MUST require
   presentation of an interaction callback reference as described in
   Section 5.1.

   [[ See issue #58 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/58) ]]

   [[ See issue #59 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/59) ]]

2.5.2.1.  Receive an HTTP Callback Through the Browser

   A finish "method" value of "redirect" indicates that determine the client
   instance will expect a grant request being referenced from the RO's browser using user
   code.  If the HTTP
   method GET as described in Section 4.2.1.

   "interact": {
       "finish": {
           "method": "redirect",
           "uri": "https://client.example.net/return/123455",
           "nonce": "LKLTI25DK82FX4T4QFZC"
       }
   }

   Requests user code cannot be associated with a currently active
   request, the AS MUST display an error to the callback URI RO and MUST be processed by NOT attempt
   to redirect the RO back to any client instance
   as described in Section 4.2.1.

   Since even if a redirect
   finish method is supplied (Section 2.5.2.1).  If the incoming request to interaction
   component at the callback URL user code URI is from not hosted by the RO's
   browser, this method is usually used when AS directly, the RO
   means of communication between the AS and end-user this URI, including
   communication of the user code itself, are out of scope for this
   specification.

   When the
   same entity.  As such, RO enters this code at the client instance MUST ensure user code URI, the end-user
   is present on AS MUST
   uniquely identify the pending request to prevent substitution attacks.

2.5.2.2.  Receive an HTTP Direct Callback

   A finish "method" value of "push" indicates that the client instance
   will expect a request from code was associated
   with.  If the AS directly using does not recognize the HTTP method POST
   as described in Section 4.2.2.

   "interact": {
       "finish": {
           "method": "push",
           "uri": "https://client.example.net/return/123455",
           "nonce": "LKLTI25DK82FX4T4QFZC"
       }
   }

   Requests to entered code, the callback URI interaction
   component MUST be processed by display an error to the user.  If the AS detects too
   many unrecognized code enter attempts, the interaction component
   SHOULD display an error to the user and MAY take additional actions
   such as slowing down the input interactions.  The user should be
   warned as such an error state is approached, if possible.

   The client instance
   as described MUST NOT modify the URI when launching it, in Section 4.2.2.

   Since
   particular the incoming request client instance MUST NOT add any parameters to the callback URL is from the AS and not
   URI.  The user code URI MUST be reachable from the RO's end user's
   browser, though the client instance MUST NOT require the end-
   user to URI is usually be present opened on a separate device
   from the incoming HTTP request.

   [[ See issue #60 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/60) ]]

2.5.3.  Hints client instance itself.  The "hints" key is URI MUST be accessible from an object describing one
   HTTP GET request and MUST be protected by HTTPS or more suggestions from equivalent means.

4.1.3.  Interaction through an Application URI

   When the client instance that the AS can use is directed to help drive user
   interaction.

   This specification defines the following properties under the "hints"
   key:

   ui_locales (array of strings)  Indicates the end-user's preferred
      locales that the AS can use during interaction, particularly
      before launch an application through
   the RO has authenticated.  Section 2.5.3.1

   The following sections detail requests for interaction modes.
   Additional interaction modes are defined in a registry TBD "app" (Section 11).

2.5.3.1.  Indicate Desired Interaction Locales

   If 3.3.2) mode, the client instance knows launches the end-user's locale and language
   preferences, URL as
   appropriate to the client instance can send this information system, such as through a deep link or custom URI
   scheme registered to a mobile application.  The means by which the AS
   using
   and the "ui_locales" field launched application communicate with an array each other and perform
   any of locale strings as
   defined by [RFC5646].

   "interact": {
       "hints": {
           "ui_locales": ["en-US", "fr-CA"]
       }
   }

   If possible, the AS SHOULD use one required actions are out of the locales in the array, scope for this specification.

4.2.  Post-Interaction Completion

   If an interaction "finish" (Section 3.3.4) method is associated with
   preference to
   the first item in current request, the array supported by AS MUST follow the AS.  If
   none appropriate method at
   upon completion of the given locales are supported, the AS MAY use a default
   locale.

2.5.4.  Extending Interaction Modes

   Additional interaction start modes, finish modes, and hints are
   defined in a registry TBD (Section 11).

2.6.  Extending The Grant Request

   The request object MAY be extended by registering new items in a
   registry TBD (Section 11).  Extensions SHOULD be orthogonal order to other
   parameters.  Extensions MUST document any aspects where the extension
   item affects or influences signal the values or behavior of other request
   and response objects.

3.  Grant Response

   In response client instance
   to continue, except for some limited error cases discussed below.  If
   a client instance's request, finish method is not available, the AS responds with a
   JSON object as the HTTP entity body.  Each possible field is detailed
   in SHOULD instruct the sections below

   continue (object)  Indicates that RO to
   return to the client instance can continue
      the request by making one or more continuation requests.
      Section 3.1

   access_token (object / array of objects)  A single access token or
      set of access tokens upon completion.

   The AS MUST create an interaction reference and associate that
   reference with the client instance can use to call the
      RS on behalf of current interaction and the RO.  Section 3.2.1

   interact (object)  Indicates that underlying pending
   request.  This interaction through some set of
      defined mechanisms needs reference value MUST be sufficiently
   random so as not to take place.  Section 3.3

   subject (object)  Claims about be guessable by an attacker.  The interaction
   reference MUST be one-time-use to prevent interception and replay
   attacks.

   The AS MUST calculate a hash value based on the RO as known client instance and
   AS nonces and declared by the
      AS. interaction reference, as described in
   Section 3.4

   instance_id (string)  An identifier this 4.2.3.  The client instance can will use this value to
      identify itself validate
   the "finish" call.

   The AS MUST send the hash and interaction reference based on the
   interaction finish mode as described in the following sections.

   Note that the "finish" method still occurs in many error cases, such
   as when making future requests.  Section 3.5

   user_handle (string)  An identifier this the RO has denied access.  This pattern allows the client
   instance can use to
      identify its current end-user when making future requests.
      Section 3.5

   error (object)  An potentially recover from the error code indicating that something has gone
      wrong.  Section 3.6

   In this example, state by modifying its
   request or providing additional information directly to the AS is returning an interaction URL
   (Section 3.3.1), a callback nonce (Section 3.3.4), and in a
   continuation
   response (Section 3.1).

   {
       "interact": {
           "redirect": "https://server.example.com/interact/4CF492ML\
             VMSW9MKMXKHQ",
           "finish": "MBDOFXG4Y5CVJCX821LH"
       },
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU",
           },
           "uri": "https://server.example.com/tx"
       }
   }
   In this example, request.  The AS MUST NOT follow the "finish" method in
   the following circumstances:

   *  The AS has determined that any URIs involved with the finish
      method are dangerous or blocked.

   *  The AS cannot determine which ongoing grant request is returning a bearer access token
   (Section 3.2.1) being
      referenced.

   *  The ongoing grant request has been cancelled or otherwise blocked.

4.2.1.  Completing Interaction with a management URL and a subject identifier
   (Section 3.4) in Browser Redirect to the form of an opaque identifier.

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "flags": ["bearer"],
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
       },
       "subject": {
           "sub_ids": [ {
              "format": "opaque",
              "id": "J2G8G8O4AZ"
           } ]
       }
   }

   In this example, Callback
        URI

   When using the AS is returning set of subject identifiers "redirect" interaction finish method (Section 3.4), simultaneously as an opaque identifier, an email
   address, and a decentralized identifier (DID).

   {
       "subject": {
           "sub_ids": [ {
              "subject_type": "opaque",
              "id": "J2G8G8O4AZ"
           }, {
              "format": "email",
              "email": "user@example.com"
           }, {
              "format": "did",
              "url": "did:example:123456"
           } ]
       }
   }

3.1.  Request Continuation

   If 3.3.4),
   the AS determines signals to the client instance that interaction is complete
   and the request can be continued with
   additional requests, it responds with the "continue" field.  This
   field contains a JSON object with by directing the following properties.

   uri (string)  REQUIRED.  The URI at which RO (in their
   browser) back to the client instance can
      make continuation requests.  This URI MAY vary per request, or MAY
      be stable at the AS if instance's redirect URL sent in the AS includes an access token.  The
      client instance MUST use this value exactly as given when making a
      continuation
   callback request (Section 5).

   wait (integer)  RECOMMENDED. 2.5.2.1).

   The amount of time in integer seconds
      the client instance SHOULD wait after receiving AS secures this continuation
      handle and calling the URI.

   access_token (object)  REQUIRED.  A unique access token for
      continuing the request, in redirect by adding the format specified in Section 3.2.1.
      This access token MUST be bound hash and interaction
   reference as query parameters to the client instance's key used redirect URL.

   hash  REQUIRED.  The interaction hash value as described in
      Section 4.2.3.

   interact_ref  REQUIRED.  The interaction reference generated for this
      interaction.

   The means of directing the request and MUST NOT be a "bearer" token.  As a
      consequence, the "flags" array RO to this URL are outside the scope of
   this access token MUST NOT
      contain specification, but common options include redirecting the string "bearer" RO
   from a web page and launching the "key" field MUST be omitted.
      This access token MUST NOT be usable at resources outside of system browser with the target URL.

   NOTE: '\' line wrapping per RFC 8792

   https://client.example.net/return/123455\
     ?hash=p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2\
       HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A\
     &interact_ref=4IFWWIKYBC2PQ6U56NL1

   When receiving the request, the
      AS.  The client instance MUST present parse the access token in all
      requests query
   parameters to calculate and validate the continuation URI hash value as described in
   Section 7.2.  [[
      See issue #66 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
      issues/66) ]]

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 60
       }
   }

   The 4.2.3.  If the hash validates, the client instance can use the values of this field sends a
   continuation request to continue the
   request AS as described in Section 5.  Note that 5.1 using the client instance
   MUST sign all continuation requests
   interaction reference value received here.

4.2.2.  Completing Interaction with its key as described in
   Section 7.3 and MUST present a Direct HTTP Request Callback

   When using the access token in its continuation
   request.

   This field SHOULD be returned when "callback" interaction is expected, mode (Section 3.3.4) with the
   "push" method, the AS signals to allow the client instance to follow up after that interaction has been
   concluded.

3.2.  Access Tokens

   If
   is complete and the AS has successfully granted one or more access tokens request can be continued by sending an HTTP POST
   request to the client instance, the AS responds with instance's callback URL sent in the "access_token" field.  This
   field contains either callback
   request (Section 2.5.2.2).

   The entity message body is a single access token as described in
   Section 3.2.1 or an array JSON object consisting of access tokens the following
   two fields:

   hash (string)  REQUIRED.  The interaction hash value as described in
      Section 3.2.2. 4.2.3.

   interact_ref (string)  REQUIRED.  The interaction reference generated
      for this interaction.

   NOTE: '\' line wrapping per RFC 8792

   POST /push/554321 HTTP/1.1
   Host: client.example.net
   Content-Type: application/json

   {
     "hash": "p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R\
       2HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A",
     "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
   }

   When receiving the request, the client instance uses any access tokens in this response to call MUST parse the RS JSON
   object and validate the hash value as described in Section 7.2.

3.2.1.  Single Access Token 4.2.3.  If
   the hash validates, the client instance has requested sends a single access token and the AS
   has granted that access token, continuation request
   to the AS responds with as described in Section 5.1 using the
   "access_token" field.  The interaction reference
   value of this field is an object with received here.

4.2.3.  Calculating the
   following properties.

   value (string)  REQUIRED. interaction hash

   The value of "hash" parameter in the access token as a string.
      The value is opaque request to the client instance.  The value SHOULD be
      limited instance's callback
   URL ties the front channel response to ASCII characters an ongoing request by using
   values known only to facilitate transmission over HTTP
      headers within other protocols without requiring additional
      encoding.

   label (string)  REQUIRED for multiple access tokens, OPTIONAL for the parties involved.  This security mechanism
   allows the client instance to protect itself against several kinds of
   session fixation and injection attacks.  The AS MUST always provide
   this hash, and the client instance MUST validate the hash when
   received.

   To calculate the "hash" value, the party doing the calculation
   creates a hash string by concatenating the following values in the
   following order using a single access token.  The value of newline ("\\n") character to separate
   them:

   *  the "label" "nonce" value sent by the client instance
      provided in the associated token interaction
      "finish" section of the initial request (Section 2.1), if
      present.  If the token has been split by the AS, 2.5.2)

   *  the AS's nonce value of from the
      "label" field is chosen by interaction finish response
      (Section 3.3.4)

   *  the "interact_ref" returned from the AS and as part of the "split" field is
      included and set to "true".

   manage (string)  OPTIONAL.  The management URI for this access token.
      If provided, interaction
      finish method (Section 4.2)

   *  the grant endpoint URL the client instance MAY manage used to make its access token as
      described in Section 6.  This management URI
      initial request (Section 2)

   There is a function no padding or whitespace before or after any of the
      AS lines,
   and is separate from no trailing newline character.

   VJLO6A4CAYLBXHTR0KRO
   MBDOFXG4Y5CVJCX821LH
   4IFWWIKYBC2PQ6U56NL1
   https://server.example.com/tx

   The party then hashes this string with the RS appropriate algorithm
   based on the client instance is requesting
      access to.  This URI MUST NOT include "hash_method" parameter of the access token "callback".  If the
   "hash_method" value and
      SHOULD be different for each access token issued is not present in a request.

   access (array of objects/strings)  RECOMMENDED.  A description the client instance's request,
   the algorithm defaults to "sha3".

   [[ See issue #56 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/56) ]]

4.2.3.1.  SHA3-512

   The "sha3" hash method consists of hashing the
      rights associated input string with this access token, as defined in Section 8.
      If included, this MUST reflect the rights associated
   512-bit SHA3 algorithm.  The byte array is then encoded using URL
   Safe Base64 with no padding.  The resulting string is the
      issued access token.  These rights MAY vary from what was
      requested by the client instance.

   expires_in (integer)  OPTIONAL. hash value.

   NOTE: '\' line wrapping per RFC 8792

   p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2HZT8BOWYHcLmObM\
     7XHPAdJzTZMtKBsaraJ64A

4.2.3.2.  SHA2-512

   The number "sha2" hash method consists of seconds in which hashing the
      access will expire.  The client instance MUST NOT use input string with the access
      token past this time.  An RS MUST NOT accept an access token past
      this time.  Note that
   512-bit SHA2 algorithm.  The byte array is then encoded using URL
   Safe Base64 with no padding.  The resulting string is the access token MAY be revoked by hash value.

   NOTE: '\' line wrapping per RFC 8792

   62SbcD3Xs7L40rjgALA-ymQujoh2LB2hPJyX9vlcr1H6ecChZ8BNKkG_HrOKP_Bp\
     j84rh4mC9aE9x7HPBFcIHw

5.  Continuing a Grant Request

   While it is possible for the AS or
      RS at any point prior to its expiration.

   key (object / string)  OPTIONAL.  The key that the token is bound to,
      if different from return a Section 3 with all the
   client instance's presented key.  The key
      MUST be an object or string in a format described in Section 7.1.
      The requested information (including access tokens
   (Section 3.2) and direct user information (Section 3.4)), it's more
   common that the AS and the client instance MUST be able to dereference or process the key
      information in order to be able will need to sign communicate
   several times over the request.

   flags (array of strings)  OPTIONAL.  A set of flags that represent
      attributes or behaviors lifetime of the an access token issued by the AS.

   The values of the "flags" field defined by this specification are as
   follows:

   "bearer" grant.  This flag indicates whether the token is bound often
   part of facilitating interaction (Section 4), but it could also be
   used to allow the AS and client instance's key.  If the "bearer" flag is present, instance to continue negotiating the
      access token is a bearer token, and
   parameters of the "key" field in original grant request (Section 2).

   To enable this
      response MUST be omitted.  If ongoing negotiation, the "bearer" flag is omitted and AS provides a continuation
   API to the
      "key" client software.  The AS returns a "continue" field in this response is omitted, the token is bound the
      key used by
   response (Section 3.1) that contains information the client instance (Section 2.3) in its request for
      access.  If the "bearer" flag is omitted, and the "key" field is
      present,
   needs to access this API, including a URI to access as well as an
   access token to use during the continued requests.

   The access token is initially bound to the same key and proofing mechanism
      indicated in method the "key" field.

   "durable"  OPTIONAL.  Flag indicating
   client instance used to make the initial request.  As a hint of AS behavior on token
      rotation.  If this flag is present, then consequence,
   when the client instance can
      expect a previously-issued access token to continue makes any calls to work after
      it has been rotated (Section 6.1) or the underlying grant request
      has been modified (Section 5.3), resulting in the issuance of new
      access tokens.  If this flag is omitted, continuation URL, the
   client instance can
      anticipate a given MUST present the access token will stop working after token
      rotation or grant request modification.  Note that a token flagged as "durable" can still expire or be revoked through any normal
      means.

   "split"  OPTIONAL.  Flag indicating that this token was generated by
      issuing multiple access tokens described in response to one
   Section 7.2 and present proof of the client instance's token request (Section 2.1) objects.  This behavior
      MUST NOT be used unless the client instance has specifically
      requested it key (or its
   most recent rotation) by use of signing the "split" flag.

   Flag values request as described in
   Section 7.3.  The AS MUST NOT be included more than once.

   Additional flags can be defined validate all keys presented by extensions using a registry TBD
   (Section 11).

   The following non-normative example shows a single access token bound
   to the client instance's key used
   instance or referenced in an ongoing request for each call within
   that request.

   [[ See issue #85 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/85) ]]

   For example, here the initial request, with client instance makes a
   management URL, and that has access POST request to three described resources (one
   using an object and two described by reference strings).

   "access_token": {
       "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
       "manage": "https://server.example.com/token/PRY5NM33O\
           M4TB8N6BW7OZB8CDFONP219RP1L",
       "access": [
           {
               "type": "photo-api",
               "actions": [
                   "read",
                   "write",
                   "dolphin"
               ],
               "locations": [
                   "https://server.example.net/",
                   "https://resource.local/other"
               ],
               "datatypes": [
                   "metadata",
                   "images"
               ]
           },
           "read", "dolphin-metadata"
       ]
   }

   The following non-normative example shows a single bearer access
   token
   unique URI and signs the request with access HTTP Message Signatures:

   POST /continue/KSKUOMUKM HTTP/1.1
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Host: server.example.com
   Signature-Input: sig1=...
   Signature: sig1=...

   The AS MUST be able to two described resources.

   "access_token": {
       "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
       "flags": ["bearer"],
       "access": [
           "finance", "medical"
       ]
   }

   If tell from the client instance requested instance's request which
   specific ongoing request is being accessed, using a single access token
   (Section 2.1.1), combination of
   the AS MUST NOT respond with continuation URL, the multiple provided access
   token structure unless token, and the client
   instance sends identified by the "split" flag as
   described in Section 2.1.1. key signature.  If the AS has split cannot determine
   a single active grant request to map the access token response, continuation request to, the response
   AS MUST
   include the "split" flag.

   [[ See issue #69 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/69) ]]

3.2.2.  Multiple Access Tokens

   If return an error.

   The ability to continue an already-started request allows the client
   instance has requested multiple access tokens and the
   AS has granted at least one of them, to perform several important functions, including presenting
   additional information from interaction, modifying the AS responds with initial
   request, and getting the
   "access_token" field.  The value current state of this field is a JSON array, the
   members of which are distinct access tokens as described in
   Section 3.2.1.  Each object MUST have a unique "label" field,
   corresponding request.

   All requests to the token labels chosen continuation API are protected by this bound
   access token.  For example, here the client instance in
   the multiple access token makes a POST
   request to a stable continuation endpoint URL with the interaction
   reference (Section 2.1.2).

   In this non-normative example, two tokens are issued under 5.1), includes the names
   "token1" and "token2", access token, and only the first token has a management URL
   associated signs with it.

   "access_token": [
       {
           "label": "token1",
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [ "finance" ]
       },
   HTTP Message Signatures:

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
           "label": "token2",
           "value": "UFGLO2FDAFG7VGZZPJ3IZEMN21EVU71FHCARP4J1",
           "access": [ "medical" ]
       }
     "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
   }

   Each access token corresponds to one of the objects

   If a "wait" parameter was included in the
   "access_token" array of continuation response
   (Section 3.1), the client instance's request
   (Section 2.1.2).

   The multiple access token response instance MUST be used when multiple access
   tokens are requested, even if only one access token is issued as a
   result of NOT call the request.  The AS MAY refuse continuation URI
   prior to issue one or more waiting the number of seconds indicated.  If no "wait"
   period is indicated, the
   requested access tokens, for any reason.  In such cases client instance SHOULD wait at least 5
   seconds.  If the refused
   token is omitted from client instance does not respect the given wait
   period, the AS MUST return an error. [[ See issue #86
   (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/86) ]]

   The response from the AS is a JSON object and all MAY contain any of the other issued access
   tokens are included
   fields described in Section 3, as described in more detail in the response the requested names appropriate
   names.
   sections below.

   If the AS determines that the client instance requested multiple access tokens
   (Section 2.1.2), can make a further
   continuation request, the AS MUST NOT respond with include a single access token
   structure, even if only new "continue" response
   (Section 3.1).  The new "continue" response MUST include a single bound
   access token is granted.  In such
   cases, the AS responds with as well, and this token SHOULD be a multiple new access token structure
   containing one token,
   invalidating the previous access token.  If the AS has split the access token does not return a
   new "continue" response, the response MUST
   include the "split" flag in the "flags" array.

   "access_token": [
       {
           "label": "split-1",
           "value": "8N6BW7OZB8CDFONP219-OS9M2PMHKUR64TBRP1LT0",
           "flags": ["split"],
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [ "fruits" ]
       },
       {
           "label": "split-2",
           "value": "FG7VGZZPJ3IZEMN21EVU71FHCAR-UFGLO2FDAP4J1",
           "flags": ["split"],
           "access": [ "vegetables" ]
       }
   }

   Each access token MAY be bound to different keys with different
   proofing mechanisms. client instance MUST NOT make an
   additional continuation request.  If token management (Section 6) is allowed, each access token SHOULD
   have different "manage" URIs. a client instance does so, the
   AS MUST return an error. [[ See issue #70 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/70) #87 (https://github.com/ietf-
   wg-gnap/gnap-core-protocol/issues/87) ]]

3.3.  Interaction Modes

   If

   For continuation functions that require the client instance has indicated a capability to interact with
   the RO in its request (Section 2.5), and send a
   message body, the AS has determined that
   interaction is both supported and necessary, body MUST be a JSON object.

5.1.  Continuing After a Completed Interaction

   When the AS responds to the client instance's "finish" method as in
   Section 4.2.1, this response includes an interaction reference.  The
   client instance with any of MUST include that value as the following values field "interact_ref"
   in a POST request to the "interact"
   field of continuation URI.

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
     "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
   }

   Since the response.  There is no preference order for interaction
   modes in the response, and it reference is up to a one-time-use value as described
   in Section 4.2.1, if the client instance needs to
   determine which ones to use.  All supported interaction methods are
   included in the same "interact" object.

   redirect (string)  Redirect to an arbitrary URL.  Section 3.3.1

   app (string)  Launch of an application URL.  Section 3.3.2

   finish (string)  A nonce used by make additional
   continuation calls after this request, the client instance to verify MUST NOT
   include the
      callback after interaction is completed.  Section 3.3.4

   user_code (object)  Display reference.  If the AS detects a short user code.  Section 3.3.3
   Additional client
   instance submitting the same interaction mode responses can be defined in a registry
   TBD (Section 11).

   The reference multiple times,
   the AS MUST NOT respond with any interaction mode that return an error and SHOULD invalidate the client
   instance did not indicate in its ongoing
   request.

   The AS MUST Section 3 MAY contain any newly-created access tokens
   (Section 3.2) or newly-released subject claims (Section 3.4).  The
   response MAY contain a new "continue" response (Section 3.1) as
   described above.  The response SHOULD NOT respond
   with contain any interaction mode that the AS does not support.  Since
   interaction
   responses include secret or unique information, (Section 3.3). [[ See issue #89 (https://github.com/ietf-
   wg-gnap/gnap-core-protocol/issues/89) ]]
   For example, if the request is successful in causing the AS
   SHOULD respond to each interaction mode only once in an ongoing
   request, particularly if issue
   access tokens and release opaque subject claims, the response could
   look like this:

   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
       },
       "subject": {
           "sub_ids": [ {
              "format": "opaque",
              "id": "J2G8G8O4AZ"
           } ]
       }
   }

   With this example, the client instance modifies its request
   (Section 5.3).

3.3.1.  Redirection to can not make an arbitrary URL

   If additional
   continuation request because a "continue" field is not included.

   [[ See issue #88 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/88) ]]

5.2.  Continuing During Pending Interaction

   When the client instance indicates that it can redirect does not include a "finish" parameter, the
   client instance will often need to an arbitrary
   URL (Section 2.5.1.1) and poll the AS supports this mode for until the client
   instance's request, RO has
   authorized the AS responds with request.  To do so, the "redirect" field, which
   is client instance makes a string containing the URL POST
   request to direct the end-user to.  This URL
   MUST be unique for the request and MUST NOT continuation URI as in Section 5.1, but does not
   include a message body.

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...

   The Section 3 MAY contain any security-
   sensitive information such as user identifiers or newly-created access tokens.

   "interact": {
       "redirect": "https://interact.example.com/4CF492MLVMSW9MKMXKHQ"
   } tokens
   (Section 3.2) or newly-released subject claims (Section 3.4).  The URL returned
   response MAY contain a new "continue" response (Section 3.1) as
   described above.  If a "continue" field is included, it SHOULD
   include a function of "wait" field to facilitate a reasonable polling rate by the AS, but
   client instance.  The response SHOULD NOT contain interaction
   responses (Section 3.3).

   For example, if the URL itself MAY be
   completely distinct from request has not yet been authorized by the URL RO,
   the AS could respond by telling the client instance uses to make another
   continuation request
   access (Section 2), allowing an AS to separate its user-interactive
   functionality from its back-end security functionality.  If the AS
   does not directly host the functionality accessed through the given
   URL, then in the means future.  In this example, a new, unique
   access token has been issued for the interaction functionality to communicate
   with the rest of call, which the AS are out of scope for this specification. client instance
   will use in its next continuation request.

   {
       "continue": {
           "access_token": {
               "value": "33OMUKMKSKU80UPRY5NM"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       }
   }

   [[ See issue #72 #90 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/72)
   issues/90) ]]

   The client instance sends

   [[ See issue #91 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/91) ]]

   If the end-user to request is successful in causing the URL AS to interact with issue access tokens
   and release subject claims, the AS. response could look like this
   example:

   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
       },
       "subject": {
           "sub_ids": [ {
              "format": "opaque",
              "id": "J2G8G8O4AZ"
           } ]
       }
   }

5.3.  Modifying an Existing Request

   The client instance MUST NOT alter the URL in any way.  The
   means for might need to modify an ongoing request, whether
   or not tokens have already been issued or claims have already been
   released.  In such cases, the client instance makes an HTTP PATCH
   request to send the end-user continuation URI and includes any fields it needs to this URL is out
   of scope of this specification, but common methods include an HTTP
   redirect, launching
   modify.  Fields that aren't included in the system browser, displaying a scannable code,
   or printing out request are considered
   unchanged from the URL in an interactive console.  See details of original request.

   The client instance MAY include the interaction "access_token" and "subject"
   fields as described in Section 4.1.1.

3.3.2.  Launch 2.1 and Section 2.2.  Inclusion of an application URL

   If
   these fields override any values in the client instance indicates that it can launch an application
   URL (Section 2.5.1.2) initial request, which MAY
   trigger additional requirements and policies by the AS supports this mode for AS.  For example,
   if the client
   instance's request, instance is asking for more access, the AS responds could
   require additional interaction with the "app" field, which is a
   string containing the URL for RO to gather additional
   consent.  If the client instance to launch.  This
   URL MUST be unique for the request and MUST NOT contain any security-
   sensitive information such as user identifiers or access tokens.

   "interact": {
       "app": "https://app.example.com/launch?tx=4CF492MLV"
   }

   The means is asking for more limited access,
   the launched application AS could determine that sufficient authorization has been granted
   to communicate with the AS are
   out of scope for this specification. client instance and return the more limited access rights
   immediately. [[ See issue #92 (https://github.com/ietf-wg-gnap/gnap-
   core-protocol/issues/92) ]]

   The client instance launches MAY include the URL "interact" field as appropriate on its platform,
   and the means for described in
   Section 2.5.  Inclusion of this field indicates that the client
   instance to launch this URL is out of
   scope capable of driving interaction with the RO, and this specification.
   field replaces any values from a previous request.  The client instance MUST NOT alter AS MAY
   respond to any of the
   URL interaction responses as described in any way.
   Section 3.3, just like it would to a new request.

   The client instance MAY attempt to detect if an
   installed application will service include the URL being sent before
   attempting "user" field as described in
   Section 2.4 to launch present new assertions or information about the application URL. end-
   user. [[ See details issue #93 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/93) ]]

   The client instance MUST NOT include the "client" section of the
   interaction in Section 4.1.3.
   request. [[ See issue #71 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/71) #94 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/94) ]]

3.3.3.  Display of a Short User Code

   If the

   The client instance indicates that it can display MAY include post-interaction responses such as
   described in Section 5.1. [[ See issue #95 (https://github.com/ietf-
   wg-gnap/gnap-core-protocol/issues/95) ]]

   Modification requests MUST NOT alter previously-issued access tokens.
   Instead, any access tokens issued from a short
   user-typeable code (Section 2.5.1.3) and the AS supports this mode
   for the client instance's request, the continuation are considered
   new, separate access tokens.  The AS responds with MAY revoke existing access
   tokens after a "user_code"
   field.  This field is an object that contains the following members.

   code (string)  REQUIRED.  A unique short code that modification has occurred. [[ See issue #96
   (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/96) ]]
   If the user modified request can type
      into an authorization server.  This string MUST be case-
      insensitive, MUST consist of only easily typeable characters (such
      as letters granted immediately by the AS, the
   Section 3 MAY contain any newly-created access tokens (Section 3.2)
   or numbers). newly-released subject claims (Section 3.4).  The time in which this code will be
      accepted SHOULD be short lived, such response MAY
   contain a new "continue" response (Section 3.1) as several minutes.  It is
      RECOMMENDED that this code be no more than eight characters in
      length.

   url (string)  RECOMMENDED.  The described above.
   If interaction URL that the client
      instance will direct the RO to.  This URL MUST be stable such that
      client instances can be statically configured with it.

   "interact": {
       "user_code": {
           "code": "A1BC-3DFF",
           "url": "https://srv.ex/device"
       }
   }

   The client instance MUST communicate the "code" to occur, the end-user in
   some fashion, such response SHOULD contain interaction
   responses (Section 3.3) as displaying it on well.

   For example, a screen or reading it out
   audibly.

   The client instance SHOULD also communicate the URL if possible to
   facilitate user interaction, but since the URL should be stable, the client instance should be able to safely decide to not display this
   value.  As this interaction mode initially requests a set of resources
   using references:

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read", "write"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       },
       "client": "987YHGRT56789IOLK"
   }

   Access is designed to facilitate
   interaction via granted by the RO, and a secondary device, it token is not expected that the
   client instance redirect the end-user to issued by the URL given here at
   runtime.  Consequently, AS.  In its
   final response, the URL needs to be stable enough that AS includes a
   client instance could be statically configured with it, perhaps
   referring the end-user to "continue" field, which includes a
   separate access token for accessing the URL via documentation instead of
   through an interactive means.  If continuation API:

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       },
       "access_token": {
           "value": "RP1LT0-OS9M2P_R64TB",
           "access": [
               "read", "write"
           ]
       }
   }

   This "continue" field allows the client instance is capable of
   communicating an arbitrary URL to make an eventual
   continuation call.  In the end-user, such as through a
   scannable code, future, the client instance can use the "redirect"
   (Section 2.5.1.1) mode realizes that
   it no longer needs "write" access and therefore modifies its ongoing
   request, here asking for this purpose just "read" access instead of or in addition to
   the user code mode. both "read"
   and "write" as before.

   PATCH /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read"
           ]
       }
       ...
   }

   The URL returned is a function of the AS, but AS replaces the URL itself MAY be
   completely distinct previous "access" from the URL the client instance uses to request
   access (Section 2), first request,
   allowing an the AS to separate its user-interactive
   functionality from its back-end security functionality.  If determine if any previously-granted consent
   already applies.  In this case, the AS
   does not directly host the functionality accessed through would likely determine that
   reducing the given
   URL, then breadth of the requested access means for the interaction functionality that new access
   tokens can be issued to communicate
   with the rest of the client instance.  The AS are out of scope for this specification.

   See details of would likely
   revoke previously-issued access tokens that had the interaction in Section 4.1.2.

   [[ See issue #72 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/72) ]]

3.3.4.  Interaction Finish

   If greater access
   rights associated with them, unless they had been issued with the
   "durable" flag.

   {
       "continue": {
           "access_token": {
               "value": "M33OMUK80UPRY5NMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       },
       "access_token": {
           "value": "0EVKC7-2ZKwZM_6N760",
           "access": [
               "read"
           ]
       }
   }

   For another example, the client instance indicates that it can receive a
   post-interaction redirect or push at a URL (Section 2.5.2) and the AS
   supports initially requests read-only
   access but later needs to step up its access.  The initial request
   could look like this mode for the client instance's request, example.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       },
       "client": "987YHGRT56789IOLK"
   }

   Access is granted by the AS responds
   with a "finish" field containing RO, and a nonce that token is issued by the client instance
   will use in validating AS.  In its
   final response, the callback as defined in Section 4.2.

   "interact": AS includes a "continue" field:

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       },
       "access_token": {
       "finish": "MBDOFXG4Y5CVJCX821LH"
           "value": "RP1LT0-OS9M2P_R64TB",
           "access": [
               "read"
           ]
       }

   When the interaction is completed, the interaction component MUST
   contact
   }

   This allows the client instance using either a redirect or launch of the
   RO's browser or through an HTTP POST to the make an eventual continuation
   call.  The client instance's
   callback URL using the method indicated in the interaction request
   (Section 2.5.2) as described instance later realizes that it now needs "write"
   access in Section 4.2.

   If addition to the AS returns a nonce, "read" access.  Since this is an expansion
   of what it asked for previously, the client instance MUST NOT continue also includes a
   grant request before it receives the associated interaction reference
   on the callback URI.  See details in Section 4.2.

3.3.5.  Extending Interaction Mode Responses

   Extensions to this specification can define
   new interaction mode
   responses section in a registry TBD (Section 11).  Extensions MUST document
   the corresponding interaction request.

3.4.  Returning User Information

   If information about the RO is requested and case the AS grants needs to interact with the client
   instance access RO
   again to gather additional authorization.  Note that data, the AS returns client
   instance's nonce and callback are different from the approved information initial request.
   Since the original callback was already used in the "subject" response field.  This field is an object with initial exchange,
   and the
   following OPTIONAL properties.

   sub_ids (array of objects)  An array of subject identifiers callback is intended for the
      RO, as defined by [I-D.ietf-secevent-subject-identifiers].

   assertions (object)  An object containing assertions as values keyed
      on the assertion type defined by one-time-use, a registry TBD (Section 11). new one needs to be
   included in order to use the callback again.

   [[ See issue #41 #97 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
      issues/41)
   issues/97) ]]

   updated_at (string)  Timestamp as an ISO8610 date string, indicating
      when the identified account was last updated.  The client instance
      MAY use this value to determine if it needs to request updated
      profile information through an identity API.  The definition of
      such an identity API is out of scope for this specification.

   "subject":
   PATCH /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
      "sub_ids":
       "access_token": {
           "access": [
               "read", "write"
           ]
       },
       "interact": {
        "format": "opaque",
        "id": "J2G8G8O4AZ"
      } ],
      "assertions":
           "start": ["redirect"],
           "finish": {
        "id_token": "eyj..."
               "method": "redirect",
               "uri": "https://client.example.net/return/654321",
               "nonce": "K82FX4T4LKLTI25DQFZC"
           }
       }

   The
   }

   From here, the AS MUST return can determine that the "subject" field only in cases where client instance is asking
   for more than it was previously granted, but since the client
   instance has also provided a mechanism to interact with the RO, the
   AS is
   sure can use that to gather the RO and additional consent.  The protocol
   continues as it would with a new request.  Since the end-user old access
   tokens are the same party.  This can be
   accomplished through some forms good for a subset of interaction with the RO
   (Section 4).

   Subject identifiers returned by rights requested here, the AS SHOULD uniquely identify the
   RO at
   might decide to not revoke them.  However, any access tokens granted
   after this update process are new access tokens and do not modify the AS.  Some forms
   rights of subject identifier are opaque existing access tokens.

5.4.  Canceling a Grant Request

   If the client instance wishes to cancel an ongoing grant request, it
   makes an HTTP DELETE request to the
   client instance (such as continuation URI.

   DELETE /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...

   If the subject of request is successfully cancelled, the AS responds with an issuer and subject pair),
   while others forms (such
   HTTP 202.  The AS SHOULD revoke all associated access tokens.

6.  Token Management

   If an access token response includes the "manage" parameter as email address and phone number) are
   intended to allow
   described in Section 3.2.1, the client instance MAY call this URL to correlate
   manage the identifier access token with other account information at any of the client instance.  The AS MUST
   ensure that actions defined in the returned subject identifiers only apply to
   following sections.  Other actions are undefined by this
   specification.

   The access token being managed acts as the
   authenticated end user. access element for its own
   management API.  The client instance MUST NOT request or use
   any returned subject identifiers for communication purposes (see
   Section 2.2).  That is, a subject identifier returned in the format present proof of an email address or a phone number only identifies
   appropriate key along with the RO to access token.

   If the
   AS and does token is sender-constrained (i.e., not indicate that a bearer token), it
   MUST be sent with the AS has validated that appropriate binding for the
   represented email address or phone number in access token
   (Section 7.2).

   If the identifier token is
   suitable for communication with the current user.  To get such
   information, a bearer token, the client instance MUST use an identity protocol to
   request and receive additional identity claims.  The details present
   proof of an
   identity protocol and associated schema are outside the scope of this
   specification.

   Extensions to this specification MAY define additional response
   properties same key identified in a registry TBD (Section 11).

3.5.  Returning Dynamically-bound Reference Handles

   Many parts of the client instance's initial request can be passed (Section 2.3)
   as described in Section 7.3.

   The AS MUST validate the proof and assure that it is associated with
   either a
   value the token itself or a reference.  The use of a reference in place of a value
   allows for a the client instance to optimize requests to the AS.

   Some references, such token was issued
   to, as appropriate for the client instance's identity
   (Section 2.3.1) or the requested resources (Section 8.1), can be
   managed statically through an admin console or developer portal
   provided by token's presentation type.

6.1.  Rotating the AS or RS. Access Token

   The developer of the client software can
   include these values in their code for a more efficient and compact
   request.

   If desired, the AS MAY also generate and return some of these
   references dynamically to the client instance in its response makes an HTTP POST to
   facilitate multiple interactions with the same software.  The client
   instance SHOULD use these references in future requests in lieu of token management URI,
   sending the associated data value.  These handles are intended to be
   used on future requests.

   Dynamically generated handles are string values that MUST be
   protected by access token in the client instance as secrets.  Handle values MUST be
   unguessable appropriate header and MUST NOT contain any sensitive information.  Handle
   values are opaque to signing the client instance.

   All dynamically generated handles are returned as fields in
   request with the appropriate key.

   POST /token/PRY5NM33OM4TB8N6BW7OZB8CDFONP219RP1L HTTP/1.1
   Host: server.example.com
   Authorization: GNAP OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   The AS validates that the root
   JSON object of token presented is associated with the response.  This specification defines
   management URL, that the
   following dynamic handle returns, additional handles can be defined
   in a registry TBD (Section 11).

   instance_id (string)  A string value used to represent AS issued the
      information in token to the "client" object given client
   instance, and that the client instance can
      use in a future request, as described in Section 2.3.1.

   user_handle (string)  A string value used presented key is appropriate to represent the current
      user.  The client instance can use in a future request, as
      described in Section 2.4.1.

   This non-normative example shows two handles along side an issued
   access token.

   {
       "user_handle": "XUT2MFM1XBIKJKSDU8QM",
       "instance_id": "7C7C4AZ9KHRS6X63AJAO",
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0"
       }
   }

   [[ See issue #77 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/77) ]]

   [[ See issue #78 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/78) ]]

3.6.  Error Response

   If the access token has expired, the AS determines that SHOULD honor the rotation
   request cannot be issued for any
   reason, it responds to the token management URL since it is likely that the
   client instance with an error message.

   error (string)  The error code.

   {

     "error": "user_denied"

   }

   The error code is one attempting to refresh the expired token.  To
   support this, the AS MAY apply different lifetimes for the use of the following, with additional values
   available
   token in management vs. its use at an RS.  An AS MUST NOT honor a registry TBD (Section 11):

   user_denied  The RO denied
   rotation request for an access token that has been revoked, either by
   the AS or by the request.

   too_fast  The client instance did not respect through the timeout in token management URI
   (Section 6.2).

   If the wait
      response.

   unknown_request  The request referenced an unknown ongoing access
      request.

   [[ See issue #79 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/79) ]]

3.7.  Extending token is validated and the Response

   Extensions to this specification MAY define additional fields key is appropriate for the
   grant request,
   the AS MUST invalidate the current access token associated with this
   URL, if possible, and return a new access token response as described
   in a registry TBD (Section 11).

4.  Determining Authorization and Consent

   When the client instance makes its Section 2 to 3.2.1, unless the AS for delegated
   access, it "multi_token" flag is capable of asking for several different kinds of
   information specified in response:

   * the access being requested in
   request.  The value of the "access_token" request parameter

   * access token MUST NOT be the subject information being requested in same as the "subject" request
      parameter

   *  any additional requested information defined by extensions
   current value of this
      protocol

   The AS determines what authorizations and consents are required the access token used to
   fulfill this requested delegation.  The details of how access the AS makes
   this determination are out of scope for this document.  However,
   there are several common patterns defined management API.
   The response MAY include an updated access token management URL as
   well, and supported by GNAP for
   fulfilling these requirements, including information sent by if so, the client instance, information gathered through instance MUST use this new URL to manage
   the new access token. [[ See issue #101 (https://github.com/ietf-wg-
   gnap/gnap-core-protocol/issues/101) ]]

   [[ See issue #102 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/102) ]]
   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "value": "FP6A8H6HY37MH13CK76LBZ6Y1UADG6VEUPEER5H2",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "read", "dolphin-metadata"
           ]
       }
   }

   [[ See issue #103 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/103) ]]

6.2.  Revoking the interaction
   process, and information supplied by external parties.  An individual
   AS can define its own policies and processes for deciding when and
   how to gather Access Token

   If the necessary authorizations and consent.

   The client instance can supply information directly wishes to revoke the AS in its
   request.  From this information, the AS can determine if access token proactively,
   such as when a user indicates to the
   requested delegation can be granted immediately.  The client instance
   can send several kinds of things, including:

   *  the identity of the client instance, known from the presented keys that they no
   longer wish for it to have access or associated identifiers

   *  the identity of the end user presented in the "user" request
      parameter

   *  any additional information presented by the client instance in the
      request, including any extensions

   The AS will verify this presented information in the context of application
   detects that it is being uninstalled, the client instance's request and instance can only trust the information as much
   as it trusts the presentation and context of use the information.  If
   token management URI to indicate to the AS determines that the information presented in AS should
   invalidate the initial request
   is sufficient access token for granting the requested access, all purposes.

   The client instance makes an HTTP DELETE request to the AS MAY return token
   management URI, presenting the positive results immediately in its Section 3 with access tokens token and subject information.

   If the AS determines that additional runtime authorization is
   required, the AS can either deny signing the request outright or use a number
   of means at its disposal to gather that authorization from
   with the appropriate ROs, including for example:

   *  starting interaction key.

   DELETE /token/PRY5NM33OM4TB8N6BW7OZB8CDFONP219RP1L HTTP/1.1
   Host: server.example.com
   Authorization: GNAP OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0
   Signature-Input: sig1=...
   Signature: sig1=...

   If the key presented is associated with the end user facilitated by token (or the client
      software, such as a redirection or user code

   *  challenging
   instance, in the client instance through case of a challenge-response
      mechanism

   *  requesting that bearer token), the client instance present specific additional
      information, such as a user's credential or an assertion

   *  contacting a RO through an out-of-band mechanism, such as a push
      notification

   *  contacting AS MUST invalidate the
   access token, if possible, and return an auxiliary software process through HTTP 204 response code.

   204 No Content

   Though the AS MAY revoke an out-of-band
      mechanism, such as querying a digital wallet

   The authorization and consent gathering process in GNAP is left
   deliberately flexible to allow access token at any time for a wide variety of different
   deployments, interactions, and methodologies.  In this process, any reason,
   the
   AS can gather consent from token management function is specifically for the RO as necessitated by client
   instance's use.  If the access that token has been requested.  The AS can sometimes determine which RO needs to
   consent based on what already expired or has been requested by
   revoked through other means, the client instance, such
   as a specific RS record, an identified user, or a AS SHOULD honor the revocation
   request requiring
   specific access such to the token management URL as approval by an administrator.  If valid, since the AS has
   a means of contacting end result is
   still the token not being usable.

7.  Securing Requests from the RO directly, it could do so without
   involving Client Instance

   In GNAP, the client instance in secures its consent gathering process.  For
   example, requests to the AS could push a notification to and RS by
   presenting an access token, presenting proof of a known RO key that it
   possesses, or both an access token and have the
   RO approve the pending request asynchronously.  These interactions
   can be through key proof together.

   *  When an interface access token is used with a key proof, this is a bound
      token request.  This type of request is used for calls to the AS itself (such RS
      as a hosted web
   page), through another application (such well as something installed on the RO's device), through a messaging fabric, or any other means. AS during negotiation.

   *  When interacting a key proof is used with an RO, no access token, this is a non-
      authorized signed request.  This type of request is used for calls
      to the AS can do anything it needs to
   determine the authorization of the requested grant, including:

   *  authenticate the RO, through initiate a local account or some other means
      such as federated login negotiation.

   *  validate the RO through presentation  When an access token is used with no key proof, this is a bearer
      token request.  This type of claims, attributes, or
      other information

   *  prompt the RO for consent request is used only for the requested delegation

   *  describe calls to the RO what information is being released, to whom,
      RS, and for what purpose only with access tokens that are not bound to any key as
      described in Section 3.2.1.

   *  provide warnings  When neither an access token nor key proof are used, this is an
      unsecured request.  This type of request is used optionally for
      calls to the RO about potential attacks or negative
      effects RS as part of allowing the information

   *  allow an RS-first discovery process as
      described in Section 9.1.

7.1.  Key Formats

   Several different places in GNAP require the RO presentation of key
   material by value.  Proof of this key material MUST be bound to modify the client instance's requested access,
      including limiting or expanding that access

   *  provide a
   request, the RO with artifacts such as receipts to facilitate an
      audit trail nature of authorizations

   *  allow which varies with the RO to deny location in the requested delegation

   The AS is also allowed to request authorization from more than one
   RO, if protocol
   the AS deems fit. key is used.  For example, a medical record might need to
   be released by both an attending nurse and a physician, or both
   owners key used as part of a bank account need to sign off on a transfer client instance's
   initial request in Section 2.3, the key value is the client
   instance's public key, and proof of that key MUST be presented in
   that request.
   Alternatively,  For a key used as part of an access token response in
   Section 3.2.1, the AS could require N proof of M possible RO's to approve that key MUST be used when presenting the
   access token.

   A key presented by value MUST be a
   given request public key in order.  The AS could also determine at least one
   supported format.  If a key is sent in multiple formats, all the key
   format values MUST be equivalent.  Note that while most formats
   present the end
   user is not full value of the appropriate RO for public key, some formats present a given request and reach out to
   value cryptographically derived from the appropriate RO asynchronously. public key.

   proof (string)  The details of determining which
   RO's are required for a given request are out form of scope for this
   specification.

   The proof that the client instance can also indicate that it is capable of
   facilitating interaction with will use
      when presenting the end user, another party, or another
   piece key.  The valid values of software through its interaction start (Section 2.5.1)
   request.  In many cases, this field and the end user
      processing requirements for each are detailed in Section 7.3.  The
      "proof" field is delegating their own access REQUIRED.

   jwk (object)  The public key and its properties represented as RO to the client instance.  Here, a JSON
      Web Key [RFC7517].  A JWK MUST contain the AS needs "alg" (Algorithm) and
      "kid" (Key ID) parameters.  The "alg" parameter MUST NOT be
      "none".  The "x5c" (X.509 Certificate Chain) parameter MAY be used
      to determine provide the
   identity X.509 representation of the end user and will often need provided public key.

   cert (string)  PEM serialized value of the certificate used to interact directly sign
      the request, with optional internal whitespace per [RFC7468].  The
      PEM header and footer are optionally removed.

   cert#S256 (string)  The certificate thumbprint calculated as per
      OAuth-MTLS [RFC8705] in base64 URL encoding.  Note that this
      format does not include the end user full public key.

   Additional key formats are defined in a registry TBD (Section 11).

   This non-normative example shows a single key presented in multiple
   formats.  This example key is intended to determine their status be used with the HTTP
   Message Signatures ({{httpsig-binding}}) proofing mechanism, as an RO and collect
   their consent.  If
   indicated by the AS has determined that authorization is
   required and "httpsig" value of the AS "proof" field.

  "key": {
      "proof": "httpsig",
      "jwk": {
                  "kty": "RSA",
                  "e": "AQAB",
                  "kid": "xyz-1",
                  "alg": "RS256",
                  "n": "kOB5rR4Jv0GMeLaY6_It_r3ORwdf8ci_JtffXyaSx8xY..."
      },
      "cert": "MIIEHDCCAwSgAwIBAgIBATANBgkqhkiG9w0BAQsFA..."
  }

7.1.1.  Key References

   Keys in GNAP can support one or more of also be passed by reference such that the requested
   interaction start methods, party
   receiving the AS returns reference will be able to determine the associated interaction
   start responses (Section 3.3). appropriate
   keying material for use in that part of the protocol.

       "key": "S-P4XJQ_RYJCRTSU1.63N3E"

   Keys referenced in this manner MAY be shared symmetric keys.  The client instance SHOULD initiate
   one key
   reference MUST NOT contain any unencrypted private or more of these interaction methods (Section 4.1) shared
   symmetric key information.

   Keys referenced in order this manner MUST be bound to
   facilitate the granting of the request.  If more than one interaction
   start method is available, the a single proofing
   mechanism.

   The means by which the client chooses
   which methods to follow is of dereferencing this value are out of scope of for this
   specification.

7.2.  Presenting Access Tokens

   The
   client instance MUST use each interaction method once at most.

   After starting interaction, the client instance can then make uses to send an access token depends
   on whether the token is bound to a
   continuation request (Section 5) either key, and if so which proofing
   method is associated with the key.  This information is conveyed in response to a signal
   indicating
   the finish of "bound" and "key" parameters in the interaction single (Section 4.2), through
   polling, or through some other method defined by an extension of this
   specification. 3.2.1) and
   multiple access tokens (Section 3.2.2) responses.

   If the AS and client instance have "flags" field does not reached a state where the
   delegation can be granted, contain the AS "bearer" flag and client instance can repeat the
   interaction process as long as "key"
   is absent, the AS supplies access token MUST be sent using the same key and
   proofing mechanism that the client instance
   with continuation information (Section 3.1) to facilitate used in its initial
   request (or its most recent rotation).

   If the ongoing
   requests.

4.1.  Interaction Start Methods

   To initiate an interaction start method indicated by "flags" field does not contain the interaction
   start responses (Section 3.3) from "bearer" flag and the AS, "key"
   value is an object as described in Section 7.1, the client instance
   follows access token MUST
   be sent using the steps key and proofing mechanism defined by that interaction method.  The actions the value of
   the client instance required for "proof" field within the interaction start modes defined
   in this specification are described in key object.

   The access token MUST be sent using the following sections.

4.1.1.  Interaction at HTTP "Authorization" request
   header field and the "GNAP" authorization scheme along with a Redirected URI

   When key
   proof as described in Section 7.3 for the end user is directed key bound to an arbitrary URI through the
   "redirect" (Section 3.3.1) mode, the client instance facilitates
   opening the URI through access
   token.  For example, an "httpsig"-bound access token is sent as
   follows:

   Authorization: GNAP OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0
   Signature-Input: sig1=(authorization);...
   Signature: sig1=...

   If the end user's web browser.  The client
   instance could launch "flags" field contains the URI through "bearer" flag, the system browser, provide access token is
   a
   clickable link, redirect the user through HTTP response codes, or
   display bearer token that MUST be sent using the URI "Authorization Request
   Header Field" method defined in a form the end user can use to launch such [RFC6750].

   Authorization: Bearer OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0

   The "Form-Encoded Body Parameter" and "URI Query Parameter" methods
   of [RFC6750] MUST NOT be used.

   [[ See issue #104 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/104) ]]

   The client software MUST reject as an error a
   multidimensional barcode.  With this method, it is common (though not
   required) for situation where the RO to be
   "flags" field contains the same party as "bearer" flag and the end-user, since "key" field is
   present with any value.

7.3.  Proving Possession of a Key with a Request

   Any keys presented by the client instance has to communicate the redirection URI to the end-
   user.

   In many cases, the URI indicates a web page hosted at AS or RS MUST be
   validated as part of the AS,
   allowing request in which they are presented.  The
   type of binding used is indicated by the AS to authenticate proof parameter of the end user key
   object in Section 7.1.  Values defined by this specification are as
   follows:

   httpsig  HTTP Signing signature header

   mtls  Mutual TLS certificate verification

   jwsd  A detached JWS signature header

   jws  Attached JWS payload

   Additional proofing methods are defined by a registry TBD
   (Section 11).

   All key binding methods used by this specification MUST cover all
   relevant portions of the request, including anything that would
   change the RO and
   interactively provide consent.  If nature of the URI is hosted by request, to allow for secure validation of
   the AS, request.  Relevant aspects include the
   AS MUST determine URI being called, the grant request HTTP
   method being referenced from used, any relevant HTTP headers and values, and the URL
   value HTTP
   message body itself.  If  The verifier of the URL cannot be associated signed message MUST
   validate all components of the signed message to ensure that nothing
   has been tampered with or substituted in a currently
   active request, way that would change the AS MUST display an error
   nature of the request.  Key binding method definitions SHOULD
   enumerate how these requirements are fulfilled.

   When a key proofing mechanism is bound to an access token, the RO key
   being presented MUST be the key associated with the access token and
   the access token MUST NOT
   attempt to redirect be covered by the RO back to any client instance even if a
   redirect finish signature method is supplied (Section 2.5.2.1).  If of the URI is
   not hosted
   proofing mechanism.

   The key binding methods in this section MAY be used by other
   components making calls as part of GNAP, such as the AS directly, extensions
   allowing the means of communication between RS to make calls to the AS and this URI are out of scope for defined in {{I-D.ietf-gnap-
   resource-servers}}. To facilitate this specification.

   The client instance MUST NOT modify extended use, the URI when launching it, sections
   below are defined in
   particular generic terms of the client instance MUST NOT add any parameters to "sender" and "verifier" of
   the
   URI.  The URI MUST be reachable from HTTP message.  In the end user's browser, though core functions of GNAP, the URI MAY be opened on a separate device from "sender" is the
   client instance
   itself.  The URI MUST be accessible from an HTTP GET request and MUST
   be protected by HTTPS or equivalent means.

4.1.2.  Interaction at the User Code URI "verifier" is the AS or RS, as appropriate.

   When used for delegation in GNAP, these key binding mechanisms allow
   the end user is directed AS to enter a short code through ensure that the
   "user_code" (Section 3.3.3) mode, keys presented by the client instance communicates in
   the user code to initial request are in control of the end-user and directs party calling any follow-up
   or continuation requests.  To facilitate this requirement, the end user
   continuation response (Section 3.1) includes an access token bound to enter
   the client instance's key (Section 2.3), and that
   code at an associated URI.  This mode is used when key (or its most
   recent rotation) MUST be proved in all continuation requests
   Section 5.  Token management requests Section 6 are similarly bound
   to either the access token's own key or, in the case of bearer
   tokens, the client
   instance instance's key.

   [[ See issue #105 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/105) ]]

   In the following sections, unless otherwise noted, the "RS256" JOSE
   Signature Algorithm is applied using the following RSA key (presented
   here in JWK format):

   NOTE: '\' line wrapping per RFC 8792

   {
       "kid": "gnap-rsa",
       "p": "xS4-YbQ0SgrsmcA7xDzZKuVNxJe3pCYwdAe6efSy4hdDgF9-vhC5gjaRk\
           i1wWuERSMW4Tv44l5HNrL-Bbj_nCJxr_HAOaesDiPn2PnywwEfg3Nv95Nn-\
           eilhqXRaW-tJKEMjDHu_fmJBeemHNZI412gBnXdGzDVo22dvYoxd6GM",
       "kty": "RSA",
       "q": "rVdcT_uy-CD0GKVLGpEGRR7k4JO6Tktc8MEHkC6NIFXihk_6vAIOCzCD6\
           LMovMinOYttpRndKoGTNdJfWlDFDScAs8C5n2y1STCQPRximBY-bw39-aZq\
           JXMxOLyPjzuVgiTOCBIvLD6-8-mvFjXZk_eefD0at6mQ5qV3U1jZt88",
       "d": "FHlhdTF0ozTliDxMBffT6aJVKZKmbbFJOVNten9c3lXKB3ux3NAb_D2dB\
           7inp9EV23oWrDspFtvCvD9dZrXgRKMHofkEpo_SSvBZfgtH-OTkbY_TqtPF\
           FLPKAw0JX5cFPnn4Q2xE4n-dQ7tpRCKl59vZLHBrHShr90zqzFp0AKXU5fj\
           b1gC9LPwsFA2Fd7KXmI1drQQEVq9R-o18Pnn4BGQNQNjO_VkcJTiBmEIVT_\
           KJRPdpVJAmbgnYWafL_hAfeb_dK8p85yurEVF8nCK5oO3EPrqB7IL4UqaEn\
           5Sl3u0j8x5or-xrrAoNz-gdOv7ONfZY6NFoa-3f8q9wBAHUuQ",
       "e": "AQAB",
       "qi": "ogpNEkDKg22Rj9cDV_-PJBZaXMk66Fp557RT1tafIuqJRHEufSOYnsto\
           bWPJ0gHxv1gVJw3gm-zYvV-wTMNgr2wVsBSezSJjPSjxWZtmT2z68W1DuvK\
           kZy15vz7Jd85hmDlriGcXNCoFEUsGLWkpHH9RwPIzguUHWmTt8y0oXyI",
       "dp": "dvCKGI2G7RLh3WyjoJ_Dr6hZ3LhXweB3YcY3qdD9BnxZ71mrLiMQg4c_\
           EBnwqCETN_5sStn2cRc2JXnvLP3G8t7IFKHTT_i_TSTacJ7uT04MSa053Y3\
           RfwbvLjRNPR0UKAE3ZxROUoIaVNuU_6-QMf8-2ilUv2GIOrCN87gP_Vk",
       "alg": "RS256",
       "dq": "iMZmELaKgT9_W_MRT-UfDWtTLeFjIGRW8aFeVmZk9R7Pnyt8rNzyN-IQ\
           M40ql8u8J6vc2GmQGfokLlPQ6XLSCY68_xkTXrhoU1f-eDntkhP7L6XawSK\
           Onv5F2H7wyBQ75HUmHTg8AK2B_vRlMyFKjXbVlzKf4kvqChSGEz4IjQ",
       "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8BfYdHsFzAt\
           YKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZGYX\
           jHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZx\
           e0jRETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0\
           bunS0K3bA_3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kO\
           zywzwPTuq-cVQDyEN7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
   }

7.3.1.  HTTP Message Signing

   This method is not able to facilitate launching indicated by "httpsig" in the "proof" field.  The
   sender creates an arbitrary URI. HTTP Message Signature as described in
   [I-D.ietf-httpbis-message-signatures].

   The
   associated URI could be statically configured with covered content of the client
   instance or communicated in signature MUST include the response from following:

   @request-target:  the AS, but target of the client
   instance communicates that URL to HTTP request

   digest:  The Digest header as defined in [RFC3230].  When the end user.  As request
      message has a consequence,
   these URIs SHOULD be short.

   In many cases, body, the URI indicates a web page hosted at signer MUST calculate this header value
      and the AS,
   allowing verifier MUST validate this header.

   When the AS request is bound to authenticate an access token, the end user as covered content
   MUST also include:

   authorization:  The Authorization header used to present the RO and
   interactively provide consent. access
      token as discussed in Section 7.2.

   Other covered content MAY also be included.

   If the URI signer's key presented is hosted by a JWK, the AS, "keyid" parameter of the
   AS
   signature MUST determine be set to the grant request being referenced from "kid" value of the user
   code.  If JWK, the user code cannot signing
   algorithm used MUST be associated with a currently active
   request, the AS MUST display an error to JWS algorithm denoted by the RO key's "alg"
   field, and the explicit "alg" signature parameter MUST NOT attempt
   to redirect be
   included.

   In this example, the RO back to any client instance even if a redirect
   finish method message body is supplied (Section 2.5.2.1).  If the interaction
   component at the user code URI following JSON object:

   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "httpsig",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   This body is not hosted by the AS directly, the
   means of communication between the AS and this URI, including
   communication of the user code itself, are out of scope hashed for this
   specification.

   When the RO enters this code at the user code URI, the AS MUST
   uniquely identify the pending request that the code was associated
   with.  If the AS does not recognize Digest header using SHA-256 into the entered code,
   following encoded value:

   SHA-256=98QzyNVYpdgTrWBKpC4qFSCmmR+CrwwvUoiaDCSjKxw=

   The HTTP message signature input string is calculated to be the interaction
   component MUST display an error
   following:

   NOTE: '\' line wrapping per RFC 8792

   "@request-target": post /gnap
   "host": server.example.com
   "content-type": application/json
   "digest": SHA-256=98QzyNVYpdgTrWBKpC4qFSCmmR+CrwwvUoiaDCSjKxw=
   "content-length": 986
   "@signature-params": ("@request-target" "host" "content-type" \
     "digest" "content-length");created=1618884475;keyid="gnap-rsa"

   This leads to the user. following full HTTP message request:

   NOTE: '\' line wrapping per RFC 8792

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Content-Length: 986
   Digest: SHA-256=98QzyNVYpdgTrWBKpC4qFSCmmR+CrwwvUoiaDCSjKxw=
   Signature-Input: sig1=("@request-target" "host" "content-type" \
     "digest" "content-length");created=1618884475;keyid="gnap-rsa"
   Signature: \
     sig1=:axj8FLOvEWBcwh+Xk6VTTKXxqo4XNygleTDJ8h3ZJfi1sSmWrRtyo9RG/dc\
     miZmdszRjWbg+/ixVZpA4BL3AOwEOxxtmHAXNB8uJ0I3tfbs6Suyk4sEo8zPr+MJq\
     MjxdJEUgAQAy2AH+wg5a7CKq4IdLTulFK9njUIeG7MygHumeiumM3DbDQAHgF46dV\
     q5UC6KJnqhGM1rFC128jd2D0sgWKCUgKGCHtfR159zfKWcEO9krsLoOnCdTzm1UyD\
     DMjkIjqeN/1j8PdMJaRAwV4On079O0DVu6bl1jVtkzo/e/ZmwPr/X436V4xiw/hZt\
     w4sfNsSbmsT0+UAQ20X/xaw==:

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "httpsig",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   If the AS detects too
   many unrecognized code enter attempts, the interaction component
   SHOULD display an error to the user and MAY take additional actions
   such as slowing down HTTP Message includes a message body, the input interactions.  The user should be
   warned as such an error state is approached, if possible.

   The client instance verifier MUST NOT modify
   calculate and verify the URI when launching it, in
   particular value of the client instance "Digest" header.  The verifier
   MUST NOT add any parameters to ensure that the
   URI. signature includes all required covered content.
   The user code URI verifier MUST be reachable from validate the end user's
   browser, though signature against the URI is usually be opened on a separate device
   from expected key of
   the client instance itself.  The URI MUST be accessible from an
   HTTP GET request and MUST be protected signer.

7.3.2.  Mutual TLS

   This method is indicated by HTTPS or equivalent means.

4.1.3.  Interaction through an Application URI

   When "mtls" in the "proof" field.  The signer
   presents its TLS client instance is directed to launch an application through
   the "app" (Section 3.3.2) mode, certificate during TLS negotiation with the client launches
   verifier.

   In this example, the URL as
   appropriate certificate is communicated to the system, such as application
   through the "Client-Cert" header from a deep link or custom URI
   scheme registered TLS reverse proxy, leading to a mobile application.  The means by which the AS
   and the launched application communicate with each other and perform
   any of the required actions are out of scope for this specification.

4.2.  Post-Interaction Completion

   If an interaction "finish" (Section 3.3.4) method is associated with
   the current request, following full HTTP request message:

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/jose
   Content-Length: 1567
   Client-Cert: \
     :MIIC6jCCAdKgAwIBAgIGAXjw74xPMA0GCSqGSIb3DQEBCwUAMDYxNDAyBgNVBAMM\
     K05JWU15QmpzRGp5QkM5UDUzN0Q2SVR6a3BEOE50UmppOXlhcEV6QzY2bVEwHhcN\
     MjEwNDIwMjAxODU0WhcNMjIwMjE0MjAxODU0WjA2MTQwMgYDVQQDDCtOSVlNeUJq\
     c0RqeUJDOVA1MzdENklUemtwRDhOdFJqaTl5YXBFekM2Nm1RMIIBIjANBgkqhkiG\
     9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhYOJ+XOKISdMMShn/G4W9m20mT0VWtQBsmBB\
     kI2cmRt4Ai8BfYdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8I\
     kZ8NMwSrcUIBZGYXjHpwjzvfGvXH/5KJlnR3/uRUp4Z4Ujk2bCaKegDn11V2vxE4\
     1hqaPUnhRZxe0jRETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo+\
     uv4BC0bunS0K3bA/3UgVp7zBlQFoFnLTO2uWp/muLEWGl67gBq9MO3brKXfGhi3k\
     OzywzwPTuq+cVQDyEN7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQIDAQABMA0GCSqG\
     SIb3DQEBCwUAA4IBAQBnYFK0eYHy+hVf2D58usj39lhL5znb/q9G35GBd/XsWfCE\
     wHuLOSZSUmG71bZtrOcx0ptle9bp2kKl4HlSTTfbtpuG5onSa3swRNhtKtUy5NH9\
     W/FLViKWfoPS3kwoEpC1XqKY6l7evoTCtS+kTQRSrCe4vbNprCAZRxz6z1nEeCgu\
     NMk38yTRvx8ihZpVOuU+Ih+dOtVe/ex5IAPYxlQsvtfhsUZqc7IyCcy72WHnRHlU\
     fn3pJm0S5270+Yls3Iv6h3oBAP19i906UjiUTNH3g0xMW+V4uLxgyckt4wD4Mlyv\
     jnaQ7Z3sR6EsXMocAbXHIAJhwKdtU/fLgdwL5vtx:

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jws",
         "key": {
           "cert": "MIIC6jCCAdKgAwIBAgIGAXjw74xPMA0GCSqGSIb3DQEBCwUAMD\
     YxNDAyBgNVBAMMK05JWU15QmpzRGp5QkM5UDUzN0Q2SVR6a3BEOE50UmppOXlhcEV\
     6QzY2bVEwHhcNMjEwNDIwMjAxODU0WhcNMjIwMjE0MjAxODU0WjA2MTQwMgYDVQQD\
     DCtOSVlNeUJqc0RqeUJDOVA1MzdENklUemtwRDhOdFJqaTl5YXBFekM2Nm1RMIIBI\
     jANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhYOJ+XOKISdMMShn/G4W9m20mT\
     0VWtQBsmBBkI2cmRt4Ai8BfYdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8\
     KowlyVy8IkZ8NMwSrcUIBZGYXjHpwjzvfGvXH/5KJlnR3/uRUp4Z4Ujk2bCaKegDn\
     11V2vxE41hqaPUnhRZxe0jRETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDad\
     z8BkPo+uv4BC0bunS0K3bA/3UgVp7zBlQFoFnLTO2uWp/muLEWGl67gBq9MO3brKX\
     fGhi3kOzywzwPTuq+cVQDyEN7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQIDAQABMA0\
     GCSqGSIb3DQEBCwUAA4IBAQBnYFK0eYHy+hVf2D58usj39lhL5znb/q9G35GBd/Xs\
     WfCEwHuLOSZSUmG71bZtrOcx0ptle9bp2kKl4HlSTTfbtpuG5onSa3swRNhtKtUy5\
     NH9W/FLViKWfoPS3kwoEpC1XqKY6l7evoTCtS+kTQRSrCe4vbNprCAZRxz6z1nEeC\
     guNMk38yTRvx8ihZpVOuU+Ih+dOtVe/ex5IAPYxlQsvtfhsUZqc7IyCcy72WHnRHl\
     Ufn3pJm0S5270+Yls3Iv6h3oBAP19i906UjiUTNH3g0xMW+V4uLxgyckt4wD4Mlyv\
     jnaQ7Z3sR6EsXMocAbXHIAJhwKdtU/fLgdwL5vtx"
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },

       },
       "subject": {
           "formats": ["iss_sub", "opaque"]
       }
   }

   The verifier compares the AS MUST follow TLS client certificate presented during
   mutual TLS negotiation to the appropriate method at
   upon completion expected key of interaction in order to signal the client instance
   to continue, except for some limited error cases discussed below.  If
   a finish method is not available, signer.  Since the AS SHOULD instruct
   TLS connection covers the RO to
   return entire message, there are no additional
   requirements to the client instance upon completion.

   The AS MUST create an interaction reference and associate check.

   Note that
   reference with the current interaction and in many instances, the underlying pending
   request.  This interaction reference value MUST be sufficiently
   random so as verifier will not to be guessable by an attacker.  The interaction
   reference MUST be one-time-use to prevent interception and replay
   attacks.

   The AS MUST calculate do a hash value based on the client instance and
   AS nonces and the interaction reference, as described in
   Section 4.2.3.  The client instance will use this value to validate
   the "finish" call.

   The AS MUST send the hash and interaction reference based on full
   certificate chain validation of the
   interaction finish mode presented TLS client certificate,
   as described in the following sections.

   Note that the "finish" method still occurs means of trust for this certificate could be in many error cases, something
   other than a PKI system, such as when the RO has denied access. a static registration or trust-on-
   first-use.

   [[ See issue #110 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/110) ]]

7.3.3.  Detached JWS

   This pattern allows method is indicated by "jwsd" in the client
   instance to potentially recover from "proof" field.  A JWS
   [RFC7515] object is created as follows:

   To protect the error state by modifying its
   request or providing additional information directly to request, the AS in a
   continuation request.  The AS MUST NOT follow JOSE header of the "finish" method in signature contains the
   following circumstances:

   * parameters:

   kid (string)  The AS has determined that any URIs involved with key identifier.  RECOMMENDED.  If the finish
      method are dangerous or blocked.

   *  The AS cannot determine which ongoing grant request key is being
      referenced.

   *  The ongoing grant request has been cancelled or otherwise blocked.

4.2.1.  Completing Interaction with a Browser Redirect to
      presented in JWK format, this MUST be the Callback
        URI

   When using value of the "redirect" interaction finish method (Section 3.3.4), "kid" field
      of the AS signals key.

   alg (string)  The algorithm used to sign the client instance that interaction is complete
   and the request can request.  REQUIRED.
      MUST be continued by directing the RO (in their
   browser) back appropriate to the client instance's redirect URL sent in the
   callback request (Section 2.5.2.1).

   The AS secures this redirect by adding key presented.  If the hash and interaction
   reference key is presented
      as query parameters a JWK, this MUST be equal to the client instance's redirect URL.

   hash  REQUIRED. "alg" parameter of the key.
      MUST NOT be "none".

   typ (string)  The interaction hash type header, value as described in
      Section 4.2.3.

   interact_ref  REQUIRED. "gnap-binding+jwsd".  REQUIRED

   htm (string)  The interaction reference generated for HTTP Method used to make this
      interaction. request, as an
      uppercase ASCII string.  REQUIRED

   uri (string)  The means of directing the RO to HTTP URI used for this URL are outside the scope request, including all path
      and query components and no fragment component.  REQUIRED

   created (integer)  A timestamp of
   this specification, but common options include redirecting when the RO
   from signature was created, in
      integer seconds since UNIX Epoch

   ath (string)  When a web page and launching request is bound to an access token, the system browser with access
      token hash value.  The value MUST be the target URL.

   https://client.example.net/return/123455\
     ?hash=p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2\
       HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A\
     &interact_ref=4IFWWIKYBC2PQ6U56NL1

   When receiving result of Base64url
      encoding (with no padding) the request, SHA-256 digest of the client instance MUST parse ASCII
      encoding of the query
   parameters to calculate and validate associated access token's value.  REQUIRED if the hash value as described in
   Section 4.2.3.
      request protects an access token.

   If the hash validates, the client instance sends a
   continuation HTTP request to the AS as described in Section 5.1 using the
   interaction reference value received here.

4.2.2.  Completing Interaction with has a Direct message body, such as an HTTP Request Callback

   When using the "callback" interaction mode (Section 3.3.4) with the
   "push" POST or PUT
   method, the AS signals to payload of the client instance that interaction JWS object is complete and the Base64url encoding
   (without padding) of the SHA256 digest of the bytes of the body.  If
   the request can be continued by sending being made does not have a message body, such as an HTTP POST
   request to
   GET, OPTIONS, or DELETE method, the JWS signature is calculated over
   an empty payload.

   The client instance's callback URL sent instance presents the signed object in compact form
   [RFC7515] in the callback
   request (Section 2.5.2.2). Detached-JWS HTTP Header field.

   In this example, the JOSE Header contains the following parameters:

   {
       "alg": "RS256",
       "kid": "gnap-rsa",
       "uri": "https://server.example.com/gnap",
       "htm": "POST",
       "typ": "gnap-binding+jwsd",
       "created": 1618884475
   }

   The entity message request body is a the following JSON object consisting of object:

   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jwsd",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   This is hashed to the following
   two fields:

   hash (string)  REQUIRED.  The interaction hash value as described in
      Section 4.2.3.

   interact_ref (string)  REQUIRED.  The interaction reference generated
      for this interaction. Base64 encoded value:

   PGiVuOZUcN1tRtUS6tx2b4cBgw9mPgXG3IPB3wY7ctc

   This leads to the following full HTTP request message:

   NOTE: '\' line wrapping per RFC 8792

   POST /push/554321 /gnap HTTP/1.1
   Host: client.example.net server.example.com
   Content-Type: application/json
   Content-Length: 983
   Detached-JWS: eyJhbGciOiJSUzI1NiIsImNyZWF0ZWQiOjE2MTg4ODQ0NzUsImh0b\
     SI6IlBPU1QiLCJraWQiOiJnbmFwLXJzYSIsInR5cCI6ImduYXAtYmluZGluZytqd3\
     NkIiwidXJpIjoiaHR0cHM6Ly9zZXJ2ZXIuZXhhbXBsZS5jb20vZ25hcCJ9.PGiVuO\
     ZUcN1tRtUS6tx2b4cBgw9mPgXG3IPB3wY7ctc.fUq-SV-A1iFN2MwCRW_yolVtT2_\
     TZA2h5YeXUoi5F2Q2iToC0Tc4drYFOSHIX68knd68RUA7yHqCVP-ZQEd6aL32H69e\
     9zuMiw6O_s4TBKB3vDOvwrhYtDH6fX2hP70cQoO-47OwbqP-ifkrvI3hVgMX9TfjV\
     eKNwnhoNnw3vbu7SNKeqJEbbwZfpESaGepS52xNBlDNMYBQQXxM9OqKJaXffzLFEl\
     -Xe0UnfolVtBraz3aPrPy1C6a4uT7wLda3PaTOVtgysxzii3oJWpuz0WP5kRujzDF\
     wX_EOzW0jsjCSkL-PXaKSpZgEjNjKDMg9irSxUISt1C1T6q3SzRgfuQ

   {
     "hash": "p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R\
       2HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A",
     "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jwsd",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   When receiving the request, verifier receives the client instance Detached-JWS header, it MUST parse the JSON
   object and
   validate the hash value as described in Section 4.2.3.  If JWS object.  The signature MUST be validated against the hash validates,
   expected key of the client instance sends a continuation signer.  All required fields MUST be present and
   their values MUST be valid.  If the HTTP message request
   to contains a
   body, the AS verifier MUST calculate the hash of body just as described in Section 5.1 using the interaction reference
   value received here.

4.2.3.  Calculating signer
   does, with no normalization or transformation of the interaction hash

   The "hash" parameter request.

7.3.4.  Attached JWS

   This method is indicated by "jws" in the request to "proof" field.  A JWS
   [RFC7515] object is created as follows:

   The JOSE header MUST contain the client instance's callback
   URL ties "kid" parameter of the front channel response to an ongoing request by using
   values known only key bound to the parties involved.  This security mechanism
   allows the
   this client instance to protect itself against several kinds of
   session fixation and injection attacks. for this request.  The AS "alg" parameter MUST always provide
   this hash, be
   set to a value appropriate for the key identified by kid and MUST NOT
   be "none".

   To protect the client instance request, the JWS header MUST validate contain the hash following
   additional parameters.

   typ (string)  The type header, value "gnap-binding+jws".

   htm (string)  The HTTP Method used to make this request, as an
      uppercase ASCII string.

   uri (string)  The HTTP URI used for this request, including all path
      and query components and no fragment component.

   created (integer)  A timestamp of when
   received.

   To calculate the "hash" value, the party doing the calculation
   creates a hash string by concatenating the following values signature was created, in the
   following order using
      integer seconds since UNIX Epoch

   ath (string)  When a single newline ("\\n") character request is bound to separate
   them:

   * an access token, the "nonce" access
      token hash value.  The value sent by the client instance in MUST be the interaction
      "finish" section result of Base64url
      encoding (with no padding) the initial request (Section 2.5.2)

   *  the AS's nonce value from the interaction finish response
      (Section 3.3.4)

   *  the "interact_ref" returned from the AS as part SHA-256 digest of the interaction
      finish method (Section 4.2)

   * ASCII
      encoding of the grant endpoint URL associated access token's value.

   If the client instance used to make its
      initial HTTP request (Section 2)

   There is no padding or whitespace before has a message body, such as an HTTP POST or after any of the lines,
   and no trailing newline character.

   VJLO6A4CAYLBXHTR0KRO
   MBDOFXG4Y5CVJCX821LH
   4IFWWIKYBC2PQ6U56NL1
   https://server.example.com/tx

   The party then hashes this string with the appropriate algorithm
   based on PUT
   method, the "hash_method" parameter payload of the "callback".  If the
   "hash_method" value JWS object is not present in the client instance's JSON serialized body of
   the request, and the algorithm defaults object is signed according to "sha3".

   [[ See issue #56 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/56) ]]

4.2.3.1.  SHA3-512 JWS and serialized
   into compact form [RFC7515].  The "sha3" hash method consists of hashing client instance presents the input string with JWS as
   the
   512-bit SHA3 algorithm.  The byte array is then encoded using URL
   Safe Base64 body of the request along with no padding. a content type of "application/
   jose".  The resulting string is AS MUST extract the hash value.

   p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2HZT8BOWYHcLmObM\
     7XHPAdJzTZMtKBsaraJ64A

4.2.3.2.  SHA2-512

   The "sha2" hash method consists payload of hashing the input string with JWS and treat it as
   the
   512-bit SHA2 algorithm.  The byte array request body for further processing.

   If the request being made does not have a message body, such as an
   HTTP GET, OPTIONS, or DELETE method, the JWS signature is then encoded using URL
   Safe Base64 with no padding. calculated
   over an empty payload and passed in the "Detached-JWS" header as
   described in Section 7.3.3.

   In this example, the JOSE header contains the following parameters:

   {
       "alg": "RS256",
       "kid": "gnap-rsa",
       "uri": "https://server.example.com/gnap",
       "htm": "POST",
       "typ": "gnap-binding+jwsd",
       "created": 1618884475
   }

   The resulting string is request body, used as the hash value.

   62SbcD3Xs7L40rjgALA-ymQujoh2LB2hPJyX9vlcr1H6ecChZ8BNKkG_HrOKP_Bp\
     j84rh4mC9aE9x7HPBFcIHw

5.  Continuing a Grant Request

   While it JWS Payload, is possible for the AS following JSON
   object:

   NOTE: '\' line wrapping per RFC 8792

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jws",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       },
       "subject": {
           "formats": ["iss_sub", "opaque"]
       }
   }

   This leads to return a Section 3 with all the
   client instance's requested information (including access tokens
   (Section 3.2) and direct user information (Section 3.4)), it's more
   common that following full HTTP request message:

   NOTE: '\' line wrapping per RFC 8792

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/jose
   Content-Length: 1047

   eyJhbGciOiJSUzI1NiIsImNyZWF0ZWQiOjE2MTg4ODQ0NzUsImh0bSI6IlBPU1QiLCJ\
   raWQiOiJnbmFwLXJzYSIsInR5cCI6ImduYXAtYmluZGluZytqd3NkIiwidXJpIjoiaH\
   R0cHM6Ly9zZXJ2ZXIuZXhhbXBsZS5jb20vZ25hcCJ9.CnsKICAgICJhY2Nlc3NfdG9r\
   ZW4iOiB7CiAgICAgICAgImFjY2VzcyI6IFsKICAgICAgICAgICAgImRvbHBoaW4tbWV\
   0YWRhdGEiCiAgICAgICAgXQogICAgfSwKICAgICJpbnRlcmFjdCI6IHsKICAgICAgIC\
   Aic3RhcnQiOiBbInJlZGlyZWN0Il0sCiAgICAgICAgImZpbmlzaCI6IHsKICAgICAgI\
   CAgICAgIm1ldGhvZCI6ICJyZWRpcmVjdCIsCiAgICAgICAgICAgICJ1cmkiOiAiaHR0\
   cHM6Ly9jbGllbnQuZm9vL2NhbGxiYWNrIiwKICAgICAgICAgICAgIm5vbmNlIjogIlZ\
   KTE82QTRDQVlMQlhIVFIwS1JPIgogICAgICAgIH0KICAgIH0sCiAgICAiY2xpZW50Ij\
   ogewogICAgICAicHJvb2YiOiAiandzIiwKICAgICAgImtleSI6IHsKICAgICAgICAia\
   ndrIjogewogICAgICAgICAgICAia2lkIjogImduYXAtcnNhIiwKICAgICAgICAgICAg\
   Imt0eSI6ICJSU0EiLAogICAgICAgICAgICAiZSI6ICJBUUFCIiwKICAgICAgICAgICA\
   gImFsZyI6ICJSUzI1NiIsCiAgICAgICAgICAgICJuIjogImhZT0otWE9LSVNkTU1TaG\
   5fRzRXOW0yMG1UMFZXdFFCc21CQmtJMmNtUnQ0QWk4QmZZZEhzRnpBdFlLT2pwQlIxU\
   nBLcEptVkt4SUdOeTBnNlozYWQyWFlzaDhLb3dseVZ5OElrWjhOTXdTcmNVSUJaR1lY\
   akhwd2p6dmZHdlhIXzVLSmxuUjNfdVJVcDRaNFVqazJiQ2FLZWdEbjExVjJ2eEU0MWh\
   xYVBVbmhSWnhlMGpSRVRkZHpzRTNtdTFTSzhkVENST2p3VWwxNG1VTm84aVRyVG00bj\
   BxRGFkejhCa1BvLXV2NEJDMGJ1blMwSzNiQV8zVWdWcDd6QmxRRm9GbkxUTzJ1V3Bfb\
   XVMRVdHbDY3Z0JxOU1PM2JyS1hmR2hpM2tPenl3endQVHVxLWNWUUR5RU43YUwwU3hD\
   YjNIYzRJZHFEYU1nOHFIVXlPYnBQaXREUSIKICAgICAgICB9CiAgICAgIH0KICAgICA\
   gImRpc3BsYXkiOiB7CiAgICAgICAgIm5hbWUiOiAiTXkgQ2xpZW50IERpc3BsYXkgTm\
   FtZSIsCiAgICAgICAgInVyaSI6ICJodHRwczovL2NsaWVudC5mb28vIgogICAgICB9L\
   AogICAgfSwKICAgICJzdWJqZWN0IjogewogICAgICAgICJmb3JtYXRzIjogWyJpc3Nf\
   c3ViIiwgIm9wYXF1ZSJdCiAgICB9Cn0K.MwNoVMQp5hVxI0mCs9LlOUdFtkDXaA1_eT\
   vOXq7DOGrtDKH7q4vP2xUq3fH2jRAZqnobo0WdPP3eM3NH5QUjW8pa6_QpwdIWkK7r-\
   u_52puE0lPBp7J4U2w4l9gIbg8iknsmWmXeY5F6wiGT8ptfuEYGgmloAJd9LIeNvD3U\
   LW2h2dz1Pn2eDnbyvgB0Ugae0BoZB4f69fKWj8Z9wvTIjk1LZJN1PcL7_zT8Lrlic9a\
   PyzT7Q9ovkd1s-4whE7TrnGUzFc5mgWUn_gsOpsP5mIIljoEEv-FqOW2RyNYulOZl0Q\
   8EnnDHV_vPzrHlUarbGg4YffgtwkQhdK72-JOxYQ

   [[ See issue #109 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/109) ]]

   When the AS verifier receives an attached JWS request, it MUST parse and
   validate the client instance will need to communicate
   several times over JWS object.  The signature MUST be validated against the lifetime of an access grant.  This is often
   part
   expected key of facilitating interaction (Section 4), but it could also be
   used to allow the AS signer.  All required fields MUST be present and client instance to continue negotiating
   their values MUST be valid.  If the
   parameters HTTP message request contains a
   body, the verifier MUST decode the payload of the original grant request (Section 2).

   To enable JWS object and
   treat this ongoing negotiation, as the AS HTTP message body.

8.  Resource Access Rights

   GNAP provides a continuation
   API to rich structure for describing the protected resources
   hosted by RSs and accessed by client software.  The AS returns a "continue" field in the
   response (Section 3.1) that contains information  This structure is
   used when the client instance
   needs to access this API, including a URI to access as well as requests an access token to use during the continued requests.

   The (Section 2.1)
   and when an access token is initially bound to the same key and method returned (Section 3.2).

   The root of this structure is a JSON array.  The elements of the
   client instance used to make JSON
   array represent rights of access that are associated with the initial request.  As a consequence,
   when the client instance makes any calls to
   access token.  The resulting access is the continuation URL, union of all elements
   within the
   client instance MUST present array.

   The access associated with the access token as is described in
   Section 7.2 and present proof using
   objects that each contain multiple dimensions of access.  Each object
   contains a REQUIRED "type" property that determines the client instance's key (or its
   most recent rotation) by signing type of API
   that the token is used for.

   type (string)  The type of resource request as described a string.  This field
      MAY define which other fields are allowed in
   Section 7.3.  The AS MUST validate all keys presented by the client
   instance or referenced in an ongoing request for each call within
   that request.

   [[ See issue #85 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/85) ]]

   For example, here object.
      This field is REQUIRED.

   The value of the client instance makes a POST request to a
   unique URI and signs "type" field is under the request with HTTP Message Signatures:

   POST /continue/KSKUOMUKM HTTP/1.1
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Host: server.example.com
   Signature-Input: sig1=...
   Signature: sig1=...

   The AS control of the AS.  This
   field MUST be able to tell from the client instance's request which
   specific ongoing request is being accessed, compared using a combination an exact byte match of the continuation URL, the provided access token, and string value
   against known types by the client
   instance identified AS.  The AS MUST ensure that there is no
   collision between different authorization data types that it
   supports.  The AS MUST NOT do any collation or normalization of data
   types during comparison.  It is RECOMMENDED that designers of
   general-purpose APIs use a URI for this field to avoid collisions
   between multiple API types protected by the key signature.  If the AS cannot determine a single active grant request to map AS.

   While it is expected that many APIs will have their own properties, a
   set of common properties are defined here.  Specific API
   implementations SHOULD NOT re-use these fields with different
   semantics or syntax.  The available values for these properties are
   determined by the continuation request to, API being protected at the
   AS MUST return an error. RS.

   actions (array of strings)  The ability to continue an already-started request allows types of actions the client instance to perform several important functions, including presenting
   additional information from interaction, modifying the initial
   request, and getting
      will take at the current state RS as an array of the request.

   All requests to the continuation API are protected by this bound
   access token. strings.  For example, here the a client
      instance makes a POST
   request to asking for a stable continuation endpoint URL with the interaction
   reference (Section 5.1), includes the access token, combination of "read" and signs with
   HTTP Message Signatures:

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
     "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
   }

   If a "wait" parameter was included in the continuation response
   (Section 3.1), "write" access.

   locations (array of strings)  The location of the client instance MUST NOT call RS as an array of
      strings.  These strings are typically URIs identifying the continuation URI
   prior to waiting
      location of the number RS.

   datatypes (array of seconds indicated.  If no "wait"
   period is indicated, strings)  The kinds of data available to the
      client instance SHOULD wait at least 5
   seconds.  If the client instance does not respect the given wait
   period, the AS MUST return RS's API as an error. [[ See issue #86
   (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/86) ]]

   The response from the AS is a JSON object and MAY contain any array of the
   fields described in Section 3, as described in more detail in the
   sections below.

   If the AS determines that the strings.  For
      example, a client instance can make asking for access to raw "image" data
      and "metadata" at a further
   continuation request, photograph API.

   identifier (string)  A string identifier indicating a specific
      resource at the AS MUST include RS.  For example, a new "continue" response
   (Section 3.1).  The new "continue" response MUST include patient identifier for a bound
   access token as well, and this token SHOULD be
      medical API or a new access token,
   invalidating the previous access token.  If the AS does not return bank account number for a
   new "continue" response, financial API.

   privileges (array of strings)  The types or levels of privilege being
      requested at the client instance MUST NOT make an
   additional continuation request.  If resource.  For example, a client instance does so, asking
      for administrative level access, or access when the
   AS MUST return an error. [[ See issue #87 (https://github.com/ietf-
   wg-gnap/gnap-core-protocol/issues/87) ]]

   For continuation functions that require resource owner
      is no longer online.

   The following non-normative example is describing three kinds of
   access (read, write, delete) to each of two different locations and
   two different data types (metadata, images) for a single access token
   using the fictitious "photo-api" type definition.

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read",
               "write",
               "delete"
           ],
           "locations": [
               "https://server.example.net/",
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata",
               "images"
           ]
       }
   ]

   The access requested for a given object when using these fields is
   the client instance cross-product of all fields of the object.  That is to send a
   message body, say, the body MUST be
   object represents a JSON request for all "actions" listed to be used at
   all "locations" listed for all possible "datatypes" listed within the
   object.

5.1.  Continuing After a Completed Interaction

   When  Assuming the AS responds to request above was granted, the client instance's "finish" method as in
   Section 4.2.1, this response includes an interaction reference.  The
   client instance MUST include
   could assume that value as it would be able to do a "read" action against the field "interact_ref"
   in
   "images" on the first server as well as a POST request to "delete" action on the continuation URI.

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
     "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
   }

   Since
   "metadata" of the interaction reference is second server, or any other combination of these
   fields, using the same access token.

   To request a one-time-use value different combination of access, such as described
   in Section 4.2.1, if requesting one
   of the client instance needs to make additional
   continuation calls after this request, possible "actions" against one of the client instance MUST NOT
   include possible "locations" and
   a different choice of possible "actions" against a different one of
   the interaction reference.  If possible "locations", the AS detects a client instance submitting the same interaction reference can include multiple times,
   separate objects in the AS MUST return an error and SHOULD invalidate "resources" array.  The following non-
   normative example uses the same fictitious "photo-api" type
   definition to request a single access token with more specifically
   targeted access rights by using two discrete objects within the ongoing
   request.

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read"
           ],
           "locations": [
               "https://server.example.net/"
           ],
           "datatypes": [
               "images"
           ]
       },
       {
           "type": "photo-api",
           "actions": [
               "write",
               "delete"
           ],
           "locations": [
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata"
           ]
       }
   ]

   The Section 3 MAY contain any newly-created access tokens
   (Section 3.2) requested here is for "read" access to "images" on one
   server while simultaneously requesting "write" and "delete" access
   for "metadata" on a different server, but importantly without
   requesting "write" or newly-released subject claims (Section 3.4).  The
   response MAY contain "delete" access to "images" on the first
   server.

   It is anticipated that API designers will use a new "continue" response (Section 3.1) combination of common
   fields defined in this specification as
   described above. well as fields specific to
   the API itself.  The response SHOULD NOT contain any interaction
   responses (Section 3.3). [[ See issue #89 (https://github.com/ietf-
   wg-gnap/gnap-core-protocol/issues/89) ]]
   For example, if following non-normative example shows the use of
   both common and API-specific fields as part of two different
   fictitious API "type" values.  The first access request is successful in causing includes the AS to issue
   "actions", "locations", and "datatypes" fields specified here as well
   as the API-specific "geolocation" field.  The second access tokens request
   includes the "actions" and release opaque subject claims, "identifier" fields specified here as well
   as the response could
   look like this:

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
       },
       "subject": API-specific "currency" field.

   "access": [
       {
           "sub_ids":
           "type": "photo-api",
           "actions": [
               "read",
               "write"
           ],
           "locations": [
               "https://server.example.net/",
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata",
               "images"
           ],
           "geolocation": [
               {
              "format": "opaque",
              "id": "J2G8G8O4AZ" lat: -32.364, lng: 153.207 },
               { lat: -35.364, lng: 158.207 }
           ]
       },
       {
           "type": "financial-transaction",
           "actions": [
               "withdraw"
           ],
           "identifier": "account-14-32-32-3",
           "currency": "USD"
       }
   }

   With
   ]

   If this example, the client instance can not make an additional
   continuation request because a "continue" field is not included.

   [[ See issue #88 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/88) ]]

5.2.  Continuing During Pending Interaction

   When the client instance does not include a "finish" parameter, approved, the
   client instance resulting access token
   (Section 3.2.1)'s access rights will often need to poll be the AS until union of the RO has
   authorized requested
   types of access for each of the request.  To do so, two APIs, just as above.

8.1.  Requesting Resources By Reference

   Instead of sending an object describing the client instance makes requested resource
   (Section 8), access rights MAY be communicated as a POST
   request string known to
   the continuation URI as in Section 5.1, but does not
   include a message body.

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...

   The Section 3 MAY contain any newly-created access tokens
   (Section 3.2) AS or newly-released subject claims (Section 3.4).  The
   response MAY contain a new "continue" response (Section 3.1) as
   described above.  If RS representing the access being requested.  Each string
   SHOULD correspond to a "continue" field specific expanded object representation at the
   AS.

   "access": [
       "read", "dolphin-metadata", "some other thing"
   ]
   This value is included, it SHOULD opaque to the client instance and MAY be any valid JSON
   string, and therefore could include a "wait" field spaces, unicode characters, and
   properly escaped string sequences.  However, in some situations the
   value is intended to facilitate a reasonable polling rate be seen and understood by the client instance.  The response software's
   developer.  In such cases, the API designer choosing any such human-
   readable strings SHOULD NOT contain interaction
   responses (Section 3.3).

   For example, if take steps to ensure the request has string values are
   not yet been authorized easily confused by a developer, such as by limiting the RO, strings
   to easily disambiguated characters.

   This functionality is similar in practice to OAuth 2.0's "scope"
   parameter [RFC6749], where a single string represents the AS could respond set of
   access rights requested by telling the client instance to make another
   continuation request instance.  As such, the
   reference string could contain any valid OAuth 2.0 scope value as in
   Appendix D.5.  Note that the future. reference string here is not bound to
   the same character restrictions as in OAuth 2.0's "scope" definition.

   A single "access" array MAY include both object-type and string-type
   resource items.  In this non-normative example, the client instance
   is requesting access to a new, unique "photo-api" and "financial-transaction" API
   type as well as the reference values of "read", "dolphin-metadata",
   and "some other thing".

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read",
               "write",
               "delete"
           ],
           "locations": [
               "https://server.example.net/",
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata",
               "images"
           ]
       },
       "read",
       "dolphin-metadata",
       {
           "type": "financial-transaction",
           "actions": [
               "withdraw"
           ],
           "identifier": "account-14-32-32-3",
           "currency": "USD"
       },
       "some other thing"
   ]

   The requested access token has been issued is the union of all elements of the array,
   including both objects and reference strings.

9.  Discovery

   By design, the protocol minimizes the need for any pre-flight
   discovery.  To begin a request, the client instance only needs to
   know the call, which endpoint of the client instance AS and which keys it will use in its next continuation request.

   {
       "continue": {
           "access_token": {
               "value": "33OMUKMKSKU80UPRY5NM"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       }
   }

   [[ See issue #90 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/90) ]]

   [[ See issue #91 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/91) ]]

   If to sign the request is successful
   request.  Everything else can be negotiated dynamically in causing the course
   of the protocol.

   However, the AS to issue access tokens
   and release subject claims, can have limits on its allowed functionality.  If the response could look like this
   example:

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
       },
       "subject": {
           "sub_ids": [ {
              "format": "opaque",
              "id": "J2G8G8O4AZ"
           } ]
       }
   }

5.3.  Modifying an Existing Request

   The
   client instance might need wants to optimize its calls to modify an ongoing request, whether
   or not tokens have already been issued or claims have already been
   released.  In such cases, the client instance makes AS before making a
   request, it MAY send an HTTP PATCH OPTIONS request to the continuation URI and includes any fields it needs grant request
   endpoint to
   modify.  Fields that aren't included in retrieve the request are considered
   unchanged from server's discovery information.  The AS MUST
   respond with a JSON document containing the original request. following information:

   grant_request_endpoint (string)  REQUIRED.  The client instance MAY include location of the "access_token" AS's
      grant request endpoint.  The location MUST be a URL [RFC3986] with
      a scheme component that MUST be https, a host component, and "subject"
   fields as described in Section 2.1
      optionally, port, path and Section 2.2.  Inclusion of
   these fields override any values in the initial request, which MAY
   trigger additional requirements query components and policies by no fragment
      components.  This URL MUST match the AS.  For example,
   if URL the client instance is asking used
      to make the discovery request.

   interaction_start_modes_supported (array of strings)  OPTIONAL.  A
      list of the AS's interaction start methods.  The values of this
      list correspond to the possible values for more access, the AS could
   require additional interaction with start
      section (Section 2.5.1) of the RO request.

   interaction_finish_methods_supported (array of strings)  OPTIONAL.  A
      list of the AS's interaction finish methods.  The values of this
      list correspond to gather additional
   consent.  If the client instance is asking possible values for more limited access, the AS could determine that sufficient authorization has been granted
   to method element of
      the client instance and return interaction finish section (Section 2.5.2) of the more limited access rights
   immediately.  [[ See issue #92 (https://github.com/ietf-wg-gnap/gnap-
   core-protocol/issues/92) ]] request.

   key_proofs_supported (array of strings)  OPTIONAL.  A list of the
      AS's supported key proofing mechanisms.  The client instance MAY include values of this list
      correspond to possible values of the "interact" "proof" field as described in
   Section 2.5.  Inclusion of the key
      section (Section 7.1) of the request.

   subject_formats_supported (array of strings)  OPTIONAL.  A list of
      the AS's supported subject identifier types.  The values of this field indicates that
      list correspond to possible values of the client
   instance is capable subject identifier
      section (Section 2.2) of driving interaction with the RO, and request.

   assertions_supported (array of strings)  OPTIONAL.  A list of the
      AS's supported assertion formats.  The values of this
   field replaces any list
      correspond to possible values from a previous of the subject assertion section
      (Section 2.2) of the request.

   The information returned from this method is for optimization
   purposes only.  The AS MAY
   respond to deny any request, or any portion of the interaction responses as described in
   Section 3.3, just like a
   request, even if it would to lists a new request.

   The capability as supported.  For example, a
   given client instance MAY include can be registered with the "user" field as described in
   Section 2.4 to present new assertions or information about "mtls" key proofing
   mechanism, but the end-
   user.  [[ See issue #93 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/93) ]]

   The AS also returns other proofing methods, then the
   AS will deny a request from that client instance MUST NOT include the "client" section using a different
   proofing mechanism.

9.1.  RS-first Method of AS Discovery

   If the
   request. [[ See issue #94 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/94) ]]

   The client instance MAY include post-interaction responses such as
   described in Section 5.1. [[ See issue #95 (https://github.com/ietf-
   wg-gnap/gnap-core-protocol/issues/95) ]]

   Modification requests MUST NOT alter previously-issued access tokens.
   Instead, any calls an RS without an access tokens issued from a continuation are considered
   new, separate token, or with
   an invalid access tokens.  The AS token, the RS MAY revoke existing access
   tokens after a modification has occurred.  [[ See issue #96
   (https://github.com/ietf-wg-gnap/gnap-core-protocol/issues/96) ]]

   If respond to the modified request can client instance
   with an authentication header indicating that GNAP needs to be granted immediately by used
   to access the AS, resource.  The address of the
   Section 3 MAY contain any newly-created access tokens (Section 3.2)
   or newly-released subject claims (Section 3.4). GNAP endpoint MUST be
   sent in the "as_uri" parameter.  The response RS MAY
   contain additionally return a new "continue" response (Section 3.1) as described above.
   If interaction can occur,
   resource reference that the response SHOULD contain interaction
   responses (Section 3.3) as well.

   For example, a client instance initially requests a set of resources
   using references:

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read", "write"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       },
       "client": "987YHGRT56789IOLK"
   }

   Access is granted by the RO, and a token is issued by the AS.  In MAY use in its
   final response, the AS includes a "continue" field, which includes a
   separate access
   token request.  This resource reference MUST be sufficient for accessing at
   least the continuation API:

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       },
       "access_token": {
           "value": "RP1LT0-OS9M2P_R64TB",
           "access": [
               "read", "write"
           ]
       }
   }
   This "continue" field allows action the client instance was attempting to make an eventual
   continuation call.  In the future, take at the client instance realizes that
   it no longer needs "write" access RS
   and therefore modifies its ongoing
   request, here asking MAY be more powerful.  The means for just "read" access instead the RS to determine the
   resource reference are out of both "read"
   and "write" as before.

   PATCH /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: scope of this specification, but some
   dynamic methods are discussed in
   [I-D.draft-ietf-gnap-resource-servers].  The content of the resource
   reference is opaque to the client instance.

   NOTE: '\' line wrapping per RFC 8792

   WWW-Authenticate: \
     GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read"
           ]
       }
       ...
   } as_uri=https://server.example/tx,access=FWWIKYBQ6U56NL1

   The AS replaces client instance then makes a request to the previous "access" from "as_uri" as described
   in Section 2, with the first request,
   allowing value of "access" as one of the AS to determine if any previously-granted consent
   already applies.  In this case, members of the AS would likely determine that
   reducing
   "access" array in the breadth "access_token" portion of the requested access means that new access
   tokens can be issued to the request.  The
   client instance. instance MAY request additional resources and other
   information.  The AS would likely
   revoke previously-issued access tokens that had the greater client instance MAY request multiple access
   rights associated with them, unless they had been issued with the
   "durable" flag.

   {
       "continue": {
           "access_token": {
               "value": "M33OMUK80UPRY5NMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       },
       "access_token": {
           "value": "0EVKC7-2ZKwZM_6N760",
           "access": [
               "read"
           ]
       }
   }
   For another tokens.

   In this non-normative example, the client instance initially requests read-only is requesting a
   single access but later needs token using the resource reference "FWWIKYBQ6U56NL1"
   received from the RS in addition to step up its access.  The initial request
   could look like this example. the "dolphin-metadata" resource
   reference that the client instance has been configured with out of
   band.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read"
               "FWWIKYBQ6U56NL1",
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       },
       "client": "987YHGRT56789IOLK" "KHRS6X63AJ7C7C4AZ9AO"
   }

   Access is granted by

   If issued, the RO, and a resulting access token is issued by would contain sufficient access
   to be used at both referenced resources.

10.  Acknowledgements

   The editors would like to thank the AS.  In its
   final response, feedback of the AS includes a "continue" field:

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 30
       },
       "access_token": {
           "value": "RP1LT0-OS9M2P_R64TB",
           "access": [
               "read"
           ]
       }
   }
   This allows following
   individuals for their reviews, implementations, and contributions:
   Aeke Axeland, Aaron Parecki, Adam Omar Oueidat, Annabelle Backman,
   Dick Hardt, Dmitri Zagidulin, Dmitry Barinov, Fabien Imbault, Francis
   Pouatcha, George Fletcher, Haardik Haardik, Hamid Massaoud, Jacky
   Yuan, Joseph Heenan, Justin Richer, Kathleen Moriarty, Mike Jones,
   Mike Varley, Nat Sakimura, Takahiko Kawasaki, Takahiro Tsuchiya.

   The editors would also like to thank the client instance GNAP working group design
   team of Kathleen Moriarty, Fabien Imbault, Dick Hardt, Mike Jones,
   and Justin Richer, who incorporated elements from the XAuth and XYZ
   proposals to make an eventual continuation
   call. create the first version of this document.

   In addition, the editors would like to thank Aaron Parecki and Mike
   Jones for insights into how to integrate identity and authentication
   systems into the core protocol, and Justin Richer and Dick Hardt for
   the use cases, diagrams, and insights provided in the XYZ and XAuth
   proposals that have been incorporated here.  The client instance later realizes editors would like
   to especially thank Mike Varley and the team at SecureKey for
   feedback and development of early versions of the XYZ protocol that it now needs "write"
   access
   fed into this standards work.

11.  IANA Considerations

   [[ TBD: There are a lot of items in addition the document that are expandable
   through the use of value registries. ]]

12.  Security Considerations

12.1.  TLS Protection in Transit

   All requests in GNAP have to be made over TLS or equivalent as
   outlined in [BCP195] to protect the "read" access.  Since this is an expansion contents of what it asked for previously, the request and
   response from manipulation and interception by an attacker.  This
   includes all requests from a client instance to the AS, all requests
   from the client instance also includes to an RS, any requests back to a
   new interaction section in case client
   instance such as the push-based interaction finish method, and any
   back-end communications such as from an RS to an AS needs as described in
   [I-D.draft-ietf-gnap-resource-servers].  Additionally, all requests
   between a browser and other components, such as during redirect-based
   interaction, need to interact with be made over TLS or use equivalent protection.

   Even though requests from the RO
   again client instance to gather additional authorization.  Note that the client
   instance's nonce and callback AS are different signed,
   the signature method alone does not protect the request from
   interception by an attacker.  TLS protects the initial request.
   Since response as well as
   the original callback was already used request, preventing an attacker from intercepting requested
   information as it is returned.  This is particularly important in the initial exchange,
   core protocol for security artifacts such as nonces and for personal
   information such as subject information.

   The use of key-bound access tokens does not negate the callback is intended requirement
   for one-time-use, a new one needs protecting calls to the RS with TLS.  While the keys and
   signatures associated a bound access token will prevent an attacker
   from using a stolen token, without TLS an attacker would be
   included in order able to use
   watch the callback again.

   [[ See issue #97 (https://github.com/ietf-wg-gnap/gnap-core-protocol/
   issues/97) ]]

   PATCH /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read", "write"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/654321",
               "nonce": "K82FX4T4LKLTI25DQFZC"
           }
       }
   }

   From here, data being sent to the AS can determine that RS and returned from the RS during
   legitimate use of the client instance is asking
   for more than it was previously granted, but since under attack.  Additionally,
   without TLS an attacker would be able to profile the calls made
   between the client instance has also provided a mechanism to interact with and RS, possibly gaining information
   about the RO, functioning of the
   AS can use that to gather API between the additional consent.  The protocol
   continues as it client software and RS
   software that would with a new request.  Since the old access
   tokens are good for a subset of be otherwise unknown to the rights requested here, attacker.

   TLS or equivalent protection also needs to be used between the AS
   might decide
   browser and any other components.  This applies during initial
   redirects to not revoke them.  However, an AS's components during interaction, during any access tokens granted
   after this update process are new access tokens
   interaction with the resource owner, and do not modify during any redirect back to
   the
   rights client instance.  Without TLS protection on these portions of existing access tokens.

5.4.  Canceling a Grant Request

   If the client instance wishes to cancel an ongoing grant request, it
   makes
   process, an HTTP DELETE attacker could wait for a valid request to start and then
   take over the continuation URI.

   DELETE /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...

   If the request is successfully cancelled, the AS responds resource owner's interaction session.

12.2.  Protection of Client Instance Key Material

   Client instances are identified by their unique keys, and anyone with an
   HTTP 202.  The AS SHOULD revoke all associated
   access tokens.

6.  Token Management

   If an access token response includes the "manage" parameter as
   described in Section 3.2.1, the to a client instance's key material will be able to
   impersonate that client instance MAY call this URL to
   manage the access token with any of the actions defined in all parties.  This is true for
   both calls to the
   following sections.  Other actions are undefined by this
   specification.

   The access token being managed acts AS as the well as calls to an RS using a key-bound
   access element token.

   Different types of client software have different methods available
   for its creating, managing, and registering keys.  GNAP explicitly allows
   for ephemeral clients, such as SPAs, and single-user clients, such as
   mobile applications, to create and present their own
   management API. keys during the
   initial grant request.  The client instance MUST software can securely generate a
   keypair on-device and present proof of an
   appropriate key the public key, along with proof of
   holding that public key, to the access token.

   If AS as part of the token is sender-constrained (i.e., not a bearer token), it
   MUST initial request.
   To facilitate trust in these ephemeral keys, GNAP further allows for
   an extensible set of client information to be sent passed with the appropriate binding for
   request.  This information can include device posture and third-party
   attestations of the access token
   (Section 7.2).

   If client software's provenance and authenticity,
   depending on the token needs and capabilities of the client software and
   its deployment.

   From GNAP's perspective, each distinct key is a bearer token, the different client instance MUST present
   proof
   instance.  However, multiple client instances can be grouped together
   by an AS policy and treated similarly to each other.  For instance,
   if an AS knows of several different keys for different servers within
   a cluster, the same key identified in the initial request (Section 2.3)
   as described in Section 7.3.

   The AS MUST validate can decide that authorization of one of these
   servers applies to all other servers within the proof and assure cluster.  An AS that it is associated
   chooses to do this needs to be careful with
   either the token itself or the how it groups different
   client instance keys together in its policy, since the token was issued
   to, as appropriate for breach of one instance
   would have direct effects on the token's presentation type.

6.1.  Rotating others in the Access Token

   The cluster.

   Additionally, if an end user controls multiple instances of a single
   type of client instance makes software, such as having an HTTP POST application installed on
   multiple devices, each of these instances is expected to have a
   separate key and be issued separate access tokens.  However, if the token management URI,
   sending
   AS is able to group these separate instances together as described
   above, it can streamline the access token in authorization process for new instances
   of the appropriate header and signing same client software.  For example, if two client instances
   can present proof of a valid installation of a piece of client
   software, the
   request with AS would be able to associate the appropriate key.

   POST /token/PRY5NM33OM4TB8N6BW7OZB8CDFONP219RP1L HTTP/1.1
   Host: server.example.com
   Authorization: GNAP OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=... approval of the first
   instance of this software to all related instances.  The AS validates that the token presented is associated with could
   then choose to bypass an explicit prompt of the
   management URL, resource owner for
   approval during authorization, since such approval has already been
   given.  An AS doing such a process would need to take assurance
   measures that the AS issued different instances are in fact correlated and
   authentic, as well as ensuring the token to expected resource owner is in
   control of the given client
   instance, and that the presented key is appropriate to instance.

   Finally, if multiple instances of client software each have the token.

   If same
   key, then from GNAP's perspective, these are functionally the access token same
   client instance as GNAP has expired, no reasonable way to differentiate
   between them.  This situation could happen if multiple instances
   within a cluster can securely share secret information among
   themselves.  Even though there are multiple copies of the AS SHOULD honor software,
   the rotation
   request shared key makes these copies all present as a single instance.
   It is considered bad practice to the token management URL since it share keys between copies of
   software unless they are very tightly integrated with each other and
   can be closely managed.  It is likely that the particularly bad practice to allow an
   end-user to copy keys between client instance is attempting instances and to refresh the expired token.  To
   support this, the AS MAY apply different lifetimes for the willingly use of
   the
   token same key in management vs. its use at an RS.  An multiple instances.

12.3.  Protection of Authorization Server

   The AS MUST NOT honor a
   rotation request for an performs critical functions in GNAP, including authenticating
   client software, managing interactions with end-users to gather
   consent and provide notice, and issuing access token that has been revoked, either by
   the AS or by the tokens for client instance through
   instances to present to resource servers.  As such, protecting the token management URI
   (Section 6.2). AS
   is central to any GNAP deployment.

   If the token an attacker is validated able to gain control over an AS, they would be able
   to create fraudulent tokens and the key is appropriate manipulate registration information
   to allow for malicious clients.  These tokens and clients would be
   trusted by other components in the request, ecosystem under the AS MUST invalidate protection of
   the current access token associated with this
   URL, if possible, and return a new access token response as described
   in Section 3.2.1, unless AS.

   If the "multi_token" flag AS is specified using signed access tokens, an attacker in the
   request.  The value control of
   the access token MUST NOT AS's signing keys would be able to manufacture fraudulent tokens
   for use at RS's under the same as the
   current value protection of the access token used AS.

   If an attacker is able to access the management API.
   The response MAY include impersonate an updated access token management URL as
   well, AS, they would be able to
   trick legitimate client instances into making signed requests for
   information which could potentially be proxied to a real AS.  To
   combat this, all communications to the AS need to be made over TLS or
   its equivalent, and if so, the client instance MUST use this new URL software making the connection has to manage
   validate the new access token. [[ See issue #101 (https://github.com/ietf-wg-
   gnap/gnap-core-protocol/issues/101) ]]

   [[ See issue #102 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/102) ]]
   {
       "access_token": {
           "value": "FP6A8H6HY37MH13CK76LBZ6Y1UADG6VEUPEER5H2",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "read", "dolphin-metadata"
           ]
       }
   }

   [[ See issue #103 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/103) ]]

6.2.  Revoking certificate chain of the Access Token

   If host it is connecting to.

   Consequently, protecting, monitoring, and auditing the client instance wishes AS is
   paramount to revoke preserving the access token proactively,
   such as when security of a user indicates GNAP-protected ecosystem.

12.4.  Symmetric and Asymmetric Client Instance Keys

   The cryptographic methods used by GNAP for key-proofing can support
   both asymmetric and symmetric cryptography, and can be extended to the client instance that
   use a wide variety of mechanisms.  While symmetric cryptographic
   systems have some benefits in speed and simplicity, they no
   longer wish for it to have access or the client instance application
   detects a
   distinct drawback that it is being uninstalled, the client instance can use the
   token management URI both parties need access to indicate the same key in
   order to do both signing and verification of the AS message.  This means
   that when the AS should
   invalidate the access token for all purposes.

   The client instance makes an HTTP DELETE request to the token
   management URI, presenting the access token and signing calls the AS to request
   with the appropriate key.

   DELETE /token/PRY5NM33OM4TB8N6BW7OZB8CDFONP219RP1L HTTP/1.1
   Host: server.example.com
   Authorization: GNAP OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0
   Signature-Input: sig1=...
   Signature: sig1=...

   If the key presented is associated with the token (or the client
   instance, in the case of a bearer token), the AS MUST invalidate the
   access token, if possible, and return an HTTP 204 response code.

   204 No Content

   Though the AS MAY revoke an access token at any time for any reason,
   needs to know the token management function is specifically for exact value of the client instance's use.  If the access token has already expired or has been
   revoked through other means, the AS SHOULD honor the revocation
   request key (or be
   able to derive it) in order to validate the token management URL as valid, since the end result is
   still the token not being usable.

7.  Securing Requests from the Client Instance

   In GNAP, key proof signature.
   With asymmetric keys, the client instance secures needs only to send its requests public key to
   the AS and RS by
   presenting an access token, presenting proof to allow for verification that the client holds the associated
   private key, regardless of a key whether that it
   possesses, or both an access token and key proof together.

   * was pre-registered or not
   with the AS.

   When used to bind to an access token is used with token, a key proof, this is a bound
      token request.  This type of request is used for calls to value must be known by
   the RS
      as well as in order to validate the AS during negotiation.

   *  When a key proof is used with no access token, this is a non-
      authorized signed signature on the request.  This type of request is used
   Common methods for calls
      to the AS to initiate communicating these proofing keys include putting
   information in a negotiation.

   *  When an structured access token is used with no and allowing the RS to look
   up the associated key proof, this is a bearer
      token request.  This type material against the value of request is used only for calls the access token.
   With symmetric cryptography, both of these methods would expose the
   signing key to the RS, and only with access tokens that are not bound to any key as
      described in Section 3.2.1.

   *  When neither the case of an structured access token nor key proof are used, this is an
      unsecured request.  This type of request is used optionally for
      calls token,
   potentially to any party that can see the RS as part of an RS-first discovery process as
      described in Section 9.1.

7.1.  Key Formats

   Several different places in GNAP require access token itself unless
   the presentation of key
   material by value.  Proof token's payload has been encrypted.  Any of this key material MUST these parties would
   then be bound able to make calls using the access token by creating a
   request, valid
   signature.  With asymmetric cryptography, the nature of which varies RS only needs to know
   the public key associated with the location token in order to validate, and
   therefore cannot create any new calls.

   Symmetric keys also have the protocol
   the key is used.  For a key used as part expected advantage of a client instance's
   initial request providing better
   protection against quantum threats in Section 2.3, the future.  Also, these types
   of keys (and their secure derivations) are widely supported among
   many cloud-based key value is management systems.

   While both signing approaches are allowed, GNAP treats these two
   classes of keys somewhat differently.  Only the client
   instance's public key, and proof portion of that key MUST
   asymmetric keys are allowed to be presented sent by value in
   that request.  For requests to the AS
   when establishing a connection.  Since sending a symmetric key used as part (or
   the private portion of an access token response in
   Section 3.2.1, asymmetric key) would expose the proof signing
   material to any parties on the request path, including any attackers,
   sending these kinds of that key MUST keys is prohibited.  Symmetric keys can still
   be used when presenting by client instances, but only a reference to the
   access token.

   A key presented by and not
   its value MUST can be a public sent.  This allows the AS to use pre-registered
   symmetric keys as well as key in at least one
   supported format.  If a derivation schemes to take advantage of
   symmetric cryptography but without requiring key is sent distribution at
   runtime, which would expose the keys in multiple formats, all transit.

   Both the AS and client software can use systems such as hardware
   security modules to strengthen their key
   format values MUST security storage and
   generation for both asymmetric and symmetric keys.

12.5.  Generation of Access Tokens

   The content of access tokens need to be equivalent.  Note such that while most formats
   present only the full value of generating
   AS would be able to create them, and the public key, some formats present contents cannot be
   manipulated by an attacker to gain different or additional access
   rights.

   One method for accomplishing this is to use a
   value cryptographically derived from
   random value for the public key.

   proof (string) access token, generated by the AS using a secure
   randomization function with sufficiently high entropy.  The form odds of proof that
   an attacker guessing the client instance will use
      when presenting output of the key.  The randomization function to
   collide with a valid values of this field access token are exceedingly small, and even
   then the
      processing requirements attacker would not have any control over what the access
   token would represent since that information would be held close by
   the AS.

   Another method for each are detailed in Section 7.3.  The
      "proof" field accomplishing this is REQUIRED.

   jwk (object)  The public key and its properties represented as to use a JSON
      Web Key [RFC7517].  A JWK MUST contain structured token
   that is cryptographically signed.  In this case, the "alg" (Algorithm) and
      "kid" (Key ID) parameters.  The "alg" parameter MUST NOT be
      "none".  The "x5c" (X.509 Certificate Chain) parameter MAY be used payload of the
   access token declares to provide the X.509 representation of RS what the provided public key.

   cert (string)  PEM serialized value of token is good for, but the certificate used to sign
   signature applied by the request, with optional internal whitespace per [RFC7468].  The
      PEM header AS during token generation covers this
   payload.  Only the AS can create such a signature and footer are optionally removed.

   cert#S256 (string) therefore only
   the AS can create such a signed token.  The certificate thumbprint calculated as per
      OAuth-MTLS [RFC8705] in base64 URL encoding.  Note odds of an attacker being
   able to guess a signature value with a useful payload are exceedingly
   small.  This technique only works if all targeted RS's check the
   signature of the access token.  Any RS that this
      format does not include validate the full public key.

   Additional key formats are defined in a registry TBD (Section 11).

   This non-normative example shows a single key
   signature of all presented in multiple
   formats.  This example key is intended to tokens would be used with the HTTP
   Message Signatures ({{httpsig-binding}}) proofing mechanism, as
   indicated by the "httpsig" value susceptible to injection
   of a modified or falsified token.  Furthermore, an AS has to
   carefully protect the "proof" field.

  "key": {
      "proof": "httpsig",
      "jwk": {
                  "kty": "RSA",
                  "e": "AQAB",
                  "kid": "xyz-1",
                  "alg": "RS256",
                  "n": "kOB5rR4Jv0GMeLaY6_It_r3ORwdf8ci_JtffXyaSx8xY..."
      },
      "cert": "MIIEHDCCAwSgAwIBAgIBATANBgkqhkiG9w0BAQsFA..."
  }

7.1.1.  Key References

   Keys in GNAP keys used to sign access tokens, since anyone
   with access to these signing keys would be able to create seemingly-
   valid access tokens using them.

12.6.  Bearer Access Tokens

   Bearer access tokens can also be passed used by reference such any party that has access to the party
   receiving
   token itself, without any additional information.  As a natural
   consequence, any RS that a bearer token is presented to has the reference will be able
   technical capability of presenting that bearer token to determine another RS,
   as long as the appropriate
   keying material for use in token is valid.  It also means that part any party that is
   able capture of the protocol.

       "key": "S-P4XJQ_RYJCRTSU1.63N3E"

   Keys referenced token value in this manner MAY be shared symmetric keys.  The key
   reference MUST NOT contain any unencrypted private storage or shared
   symmetric key information.

   Keys referenced in this manner MUST be bound transit is able to a single proofing
   mechanism.

   The means of dereferencing this value
   use the access token.  While bearer tokens are out of scope for inherently simpler,
   this
   specification.

7.2.  Presenting Access Tokens

   The method simplicity has been misapplied and abused in making needlessly
   insecure systems.

   In GNAP, key-bound access tokens are the client instance uses default due to send an their higher
   security properties.  While bearer tokens can be used in GNAP, their
   use should be limited onto to cases where the simplicity benefits
   outweigh the significant security downsides.

12.7.  Key-Bound Token Access Tokens

   Key-bound access token depends
   on whether tokens, as the token is name suggests, are bound to a key,
   specific key and if so which proofing
   method is associated must be presented along with proof of that key
   during use.  The key itself is not presented at the key. same time as the
   token, so even if a token value is captured, it cannot be used to
   make a new request.  This information is conveyed in particularly true for an RS, which will
   see the "bound" and "key" parameters in token value but will not see the single (Section 3.2.1) and
   multiple keys used to make the
   request.

   Key-bound access tokens (Section 3.2.2) responses.

   If provide this additional layer of protection
   only when the "flags" field does not contain RS checks the "bearer" flag and signature of the "key"
   is absent, message presented with
   the token.  Acceptance of an invalid presentation signature, or
   failure to check the signature entirely, would allow an attacker to
   make calls with a captured access token MUST be sent using without having access to the same
   related signing key and
   proofing mechanism material.

   In addition to validating the signature of the presentation message
   itself, the RS also needs to ensure that the client instance signing key used in its initial
   request (or its most recent rotation).

   If is
   appropriate for the "flags" field presented token.  If an RS does not contain the "bearer" flag and ensure that
   the "key"
   value is right keys were used to sign a message with a specific token, an
   attacker would be able to capture an object as described in Section 7.1, the access token MUST
   be sent and sign the
   request with their own keys, thereby negating the benefits of using
   key-bound access tokens.

   The RS also needs to ensure that a sufficient portions of the key and proofing mechanism defined message
   are covered by the value of signature.  Any items outside the "proof" field within signature could
   still affect the key object.

   The access token MUST API's processing decisions, but these items would
   not be sent using strongly bound to the token presentation.  As such, an
   attacker could capture a valid request, then manipulate portions of
   the HTTP "Authorization" request
   header field and outside of the "GNAP" authorization scheme along with a key
   proof as described signature envelope in Section 7.3 for the key bound order to cause
   unwanted actions at the access
   token.  For example, an "httpsig"-bound access token is sent as
   follows:

   Authorization: GNAP OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0
   Signature-Input: sig1=(authorization);...
   Signature: sig1=...

   If the "flags" field contains protected API.

   Some key-bound tokens are susceptible to replay attacks, depending on
   the "bearer" flag, details of the access token is signing method used.  If a bearer token that MUST be sent using the "Authorization Request
   Header Field" signature method defined in [RFC6750].

   Authorization: Bearer OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0

   The "Form-Encoded Body Parameter" and "URI Query Parameter" methods covers
   only portions of [RFC6750] MUST NOT a given request, that same signature proof can be used.

   [[ See issue #104 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/104) ]]

   The client software MUST reject as
   used by an error attacker to make a situation where the
   "flags" field contains the "bearer" flag and similar call, potentially even varying
   elements that are outside of the "key" field is
   present with any value.

7.3.  Proving Possession protection of a the signature.  Key
   proofing mechanisms used with a Request

   Any keys presented by the client instance access tokens therefore need to use
   replay protection mechanisms covered under the AS or RS MUST be
   validated signature such as part of the request in which they are presented. a
   per-message nonce, a reasonably short time validity window, or other
   uniqueness constraints.  The
   type of binding used is indicated by the proof parameter details of using these will vary
   depending on the key
   object proofing mechanism in Section 7.1.  Values defined by this specification are as
   follows:

   httpsig use, but for example, HTTP Signing signature header

   mtls  Mutual TLS certificate verification

   jwsd  A detached JWS signature header

   jws  Attached JWS payload

   Additional proofing methods are defined by
   Message Signatures has both a registry TBD
   (Section 11).

   All key binding methods used by this specification MUST "created" and "nonce" signature
   parameter as well as the ability to cover all
   relevant significant portions of the request, including anything that would
   change
   HTTP message.

12.8.  Exposure of End-user Credentials to Client Instance

   As a delegation protocol, one of the nature main goals of GNAP is to prevent
   the request, client software from being exposed to allow for secure validation any credentials or
   information about the end-user or resource owner as a requirement of
   the request.  Relevant aspects include delegation process.  By using the URI being called, variety of interaction
   mechanisms, the HTTP
   method being used, any relevant HTTP headers resource owner can interact with the AS without ever
   authenticating to the client software, and values, without the client
   software having to impersonate the resource owner through replay of
   their credentials.

   Consequently, no interaction methods defined in the GNAP core require
   the end-user to enter their credentials, but it is technologically
   possible for an extension to be defined to carry such values.  Such
   an extension would be dangerous as it would allow rogue client
   software to directly collect, store, and replay the HTTP
   message body itself. end-user's
   credentials outside of any legitimate use within a GNAP request.

   The verifier concerns of the signed message MUST
   validate all components such an extension could be mitigated through use of the signed message to ensure that nothing
   has been tampered with or substituted in a way that would change
   challenge and response unlocked by the
   nature of end user's credentials.  For
   example, the request.  Key binding method definitions SHOULD
   enumerate how these requirements are fulfilled.

   When AS presents a key proofing mechanism is bound to challenge as part of an access token, interaction start
   method, and the client instance signs that challenge using a key
   being
   derived from a password presented MUST be the key associated with the access token and
   the access token MUST be covered by the signature method of end user.  It would be
   possible for the
   proofing mechanism.

   The key binding methods in client software to collect this section MAY be used by other
   components making calls as part password in a secure
   software enclave without exposing the password to the rest of GNAP, such as the extensions
   allowing
   client software or putting it across the RS to make calls wire to the AS.  The AS defined in {{I-D.ietf-gnap-
   resource-servers}}. To facilitate can
   validate this extended use, challenge response against a known password for the sections
   below are defined in generic terms
   identified end user.  While an approach such as this does not remove
   all of the "sender" concerns surrounding such a password-based scheme, it is
   at least possible to implement in a more secure fashion than simply
   collecting and "verifier" of replaying the HTTP message.  In password.  Even so, such schemes should
   only ever be used by trusted clients due to the core functions ease of GNAP, the "sender" is the abusing them.

12.9.  Mixing Up Authorization Servers

   If a client instance and the "verifier" is the AS or RS, as appropriate.

   When used able to work with multiple AS's
   simultaneously, it is more possible for delegation in GNAP, these key binding mechanisms allow
   the an attacker to add a
   compromised AS to ensure that the keys presented by the client instance in instance's configuration and cause the initial
   client software to start a request are in control of at the party calling any follow-up
   or continuation requests.  To facilitate this requirement, compromised AS.  This AS
   could then proxy the
   continuation response (Section 3.1) includes an access token bound client's request to
   the client instance's key (Section 2.3), and that key (or its most
   recent rotation) MUST be proved a valid AS in all continuation requests
   Section 5.  Token management requests Section 6 are similarly bound order to either
   attempt to get the resource owner to approve access token's own key or, in the case of bearer
   tokens, for the
   legitimate client instance's key.

   [[ See issue #105 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/105) ]]

   In the following sections, unless otherwise noted, the "RS256" JOSE
   Signature Algorithm instance.

   A client instance needs to always be aware of which AS it is applied using talking
   to throughout a grant process, and ensure that any callback for one
   AS does not get conflated with the following RSA key (presented
   here in JWK format):

   {
       "kid": "gnap-rsa",
       "p": "xS4-YbQ0SgrsmcA7xDzZKuVNxJe3pCYwdAe6efSy4hdDgF9-vhC5gjaRk\
           i1wWuERSMW4Tv44l5HNrL-Bbj_nCJxr_HAOaesDiPn2PnywwEfg3Nv95Nn-\
           eilhqXRaW-tJKEMjDHu_fmJBeemHNZI412gBnXdGzDVo22dvYoxd6GM",
       "kty": "RSA",
       "q": "rVdcT_uy-CD0GKVLGpEGRR7k4JO6Tktc8MEHkC6NIFXihk_6vAIOCzCD6\
           LMovMinOYttpRndKoGTNdJfWlDFDScAs8C5n2y1STCQPRximBY-bw39-aZq\
           JXMxOLyPjzuVgiTOCBIvLD6-8-mvFjXZk_eefD0at6mQ5qV3U1jZt88",
       "d": "FHlhdTF0ozTliDxMBffT6aJVKZKmbbFJOVNten9c3lXKB3ux3NAb_D2dB\
           7inp9EV23oWrDspFtvCvD9dZrXgRKMHofkEpo_SSvBZfgtH-OTkbY_TqtPF\
           FLPKAw0JX5cFPnn4Q2xE4n-dQ7tpRCKl59vZLHBrHShr90zqzFp0AKXU5fj\
           b1gC9LPwsFA2Fd7KXmI1drQQEVq9R-o18Pnn4BGQNQNjO_VkcJTiBmEIVT_\
           KJRPdpVJAmbgnYWafL_hAfeb_dK8p85yurEVF8nCK5oO3EPrqB7IL4UqaEn\
           5Sl3u0j8x5or-xrrAoNz-gdOv7ONfZY6NFoa-3f8q9wBAHUuQ",
       "e": "AQAB",
       "qi": "ogpNEkDKg22Rj9cDV_-PJBZaXMk66Fp557RT1tafIuqJRHEufSOYnsto\
           bWPJ0gHxv1gVJw3gm-zYvV-wTMNgr2wVsBSezSJjPSjxWZtmT2z68W1DuvK\
           kZy15vz7Jd85hmDlriGcXNCoFEUsGLWkpHH9RwPIzguUHWmTt8y0oXyI",
       "dp": "dvCKGI2G7RLh3WyjoJ_Dr6hZ3LhXweB3YcY3qdD9BnxZ71mrLiMQg4c_\
           EBnwqCETN_5sStn2cRc2JXnvLP3G8t7IFKHTT_i_TSTacJ7uT04MSa053Y3\
           RfwbvLjRNPR0UKAE3ZxROUoIaVNuU_6-QMf8-2ilUv2GIOrCN87gP_Vk",
       "alg": "RS256",
       "dq": "iMZmELaKgT9_W_MRT-UfDWtTLeFjIGRW8aFeVmZk9R7Pnyt8rNzyN-IQ\
           M40ql8u8J6vc2GmQGfokLlPQ6XLSCY68_xkTXrhoU1f-eDntkhP7L6XawSK\
           Onv5F2H7wyBQ75HUmHTg8AK2B_vRlMyFKjXbVlzKf4kvqChSGEz4IjQ",
       "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8BfYdHsFzAt\
           YKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZGYX\
           jHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZx\
           e0jRETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0\
           bunS0K3bA_3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kO\
           zywzwPTuq-cVQDyEN7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
   }

7.3.1.  HTTP Message Signing

   This callback to different AS.  The
   interaction finish hash calculate allows a client instance to protect
   against this kind of substitution, but only if the client instance
   validates the hash.  If the client instance does not use an
   interaction finish method is indicated by "httpsig" or does not check the interaction finish
   hash value, the compromised AS can be granted a valid access token on
   behalf of the resource owner.  See [attack-surfaces] for details of
   one such attack, which has been since addressed in this document by
   including the "proof" field.  The
   sender creates an HTTP Message Signature as described grant endpoint in
   [I-D.ietf-httpbis-message-signatures]. the interaction hash calculation.
   The covered content client instance still needs to validate the hash for the attack
   to be prevented.

12.10.  Processing of Client-Presented User Information

   GNAP allows the signature MUST include client instance to present assertions and identifiers
   of the following:

   @request-target: current user to the target AS as part of the HTTP request

   digest:  The Digest header initial request.  This
   information should only ever be taken by the AS as defined in [RFC3230].  When a hint, since the request
      message
   AS has a body, no way to tell if the signer MUST calculate this header value
      and represented person is present at the verifier MUST validate this header.

   When
   client software, without using an interaction mechanism.  This
   information does not guarantee the request given user is bound to an access token, there, but it does
   constitute a statement by the covered content
   MUST also include:

   authorization:  The Authorization header used client software that the AS can take
   into account.

   For example, if a specific user is claimed to be present prior to
   interaction, but a different user is shown to be present during
   interaction, the access
      token as discussed in Section 7.2.

   Other covered content MAY also AS can either determine this to be included.

   If an error or
   signal to the signer's key presented is a JWK, client instance through returned subject information
   that the "keyid" parameter of current user has changed from what the
   signature MUST client instance
   thought.  This user information can also be set used by the AS to
   streamline the "kid" value interaction process when the user is present.  For
   example, instead of having the JWK, user type in their account identifier
   during interaction at a redirected URL, the signing
   algorithm used MUST be AS can immediately
   challenge the JWS algorithm denoted user for their account credentials.  Alternatively, if
   an existing session is detected, the AS can determine that it matches
   the identifier provided by the key's "alg"
   field, client and the subsequently skip an
   explicit "alg" signature parameter MUST NOT be
   included. authentication event by the resource owner.

   In this example, cases where the message body is AS trusts the following JSON object:

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "httpsig",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   This body client software more completely, due
   to policy or by previous approval of a given client instance, the AS
   can take this user information as a statement that the user is hashed
   present and could issue access tokens and release subject information
   without interaction.  The AS should only take such action in very
   limited circumstances, as a client instance could assert whatever it
   likes for the Digest header using SHA-256 into user's identifiers in its request.

   When a client instance presents an assertion to the AS, the
   following encoded value:

   SHA-256=98QzyNVYpdgTrWBKpC4qFSCmmR+CrwwvUoiaDCSjKxw=

   The HTTP message signature input string AS needs
   to evaluate that assertion.  Since the AS is calculated unlikely to be the
   following:

   "@request-target": post /gnap
   "host": server.example.com
   "content-type": application/json
   "digest": SHA-256=98QzyNVYpdgTrWBKpC4qFSCmmR+CrwwvUoiaDCSjKxw=
   "content-length": 986
   "@signature-params": ("@request-target" "host" "content-type" \
     "digest" "content-length");created=1618884475;keyid="gnap-rsa"

   This leads
   intended audience of an assertion held by the client software, the AS
   will need to evaluate the following full HTTP message request:

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Content-Length: 986
   Digest: SHA-256=98QzyNVYpdgTrWBKpC4qFSCmmR+CrwwvUoiaDCSjKxw=
   Signature-Input: sig1=("@request-target" "host" "content-type" \
     "digest" "content-length");created=1618884475;keyid="gnap-rsa"
   Signature: \
     sig1=:axj8FLOvEWBcwh+Xk6VTTKXxqo4XNygleTDJ8h3ZJfi1sSmWrRtyo9RG/dc\
     miZmdszRjWbg+/ixVZpA4BL3AOwEOxxtmHAXNB8uJ0I3tfbs6Suyk4sEo8zPr+MJq\
     MjxdJEUgAQAy2AH+wg5a7CKq4IdLTulFK9njUIeG7MygHumeiumM3DbDQAHgF46dV\
     q5UC6KJnqhGM1rFC128jd2D0sgWKCUgKGCHtfR159zfKWcEO9krsLoOnCdTzm1UyD\
     DMjkIjqeN/1j8PdMJaRAwV4On079O0DVu6bl1jVtkzo/e/ZmwPr/X436V4xiw/hZt\
     w4sfNsSbmsT0+UAQ20X/xaw==:

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "httpsig",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   If assertion in a different context.  Even in
   this case, the HTTP Message includes AS can still evaluate that the assertion was generated
   by a message body, trusted party, was appropriately signed, and is within any time
   validity windows stated by the verifier MUST
   calculate assertion.  If the client instance's
   audience identifier is known to the AS and verify can be associated with the value of
   client instance's presented key, the "Digest" header.  The verifier
   MUST ensure AS can also evaluate that the signature includes all required covered content.
   The verifier MUST validate
   appropriate client instance is presenting the signature against claimed assertion.  All
   of this will prevent an attacker from presenting a manufactured
   assertion, or one captured from an untrusted system.  However,
   without validating the expected key audience of the signer.

7.3.2.  Mutual TLS

   This method is indicated assertion, a captured
   assertion could be presented by "mtls" in the "proof" field.  The signer
   presents its TLS client certificate during TLS negotiation with the
   verifier. instance to impersonate a
   given end user.  In this example, such cases, the certificate assertion offers little more
   protection than a simple identifier would.

   A special case exists where the AS is communicated to the application
   through generator of the "Client-Cert" header from a TLS reverse proxy, leading to assertion
   being presented by the following full HTTP request message:

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/jose
   Content-Length: 1567
   Client-Cert: \
     MIIC6jCCAdKgAwIBAgIGAXjw74xPMA0GCSqGSIb3DQEBCwUAMDYxNDAyBgNVBAMM \
     K05JWU15QmpzRGp5QkM5UDUzN0Q2SVR6a3BEOE50UmppOXlhcEV6QzY2bVEwHhcN \
     MjEwNDIwMjAxODU0WhcNMjIwMjE0MjAxODU0WjA2MTQwMgYDVQQDDCtOSVlNeUJq \
     c0RqeUJDOVA1MzdENklUemtwRDhOdFJqaTl5YXBFekM2Nm1RMIIBIjANBgkqhkiG \
     9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhYOJ+XOKISdMMShn/G4W9m20mT0VWtQBsmBB \
     kI2cmRt4Ai8BfYdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8I \
     kZ8NMwSrcUIBZGYXjHpwjzvfGvXH/5KJlnR3/uRUp4Z4Ujk2bCaKegDn11V2vxE4 \
     1hqaPUnhRZxe0jRETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo+ \
     uv4BC0bunS0K3bA/3UgVp7zBlQFoFnLTO2uWp/muLEWGl67gBq9MO3brKXfGhi3k \
     OzywzwPTuq+cVQDyEN7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQIDAQABMA0GCSqG \
     SIb3DQEBCwUAA4IBAQBnYFK0eYHy+hVf2D58usj39lhL5znb/q9G35GBd/XsWfCE \
     wHuLOSZSUmG71bZtrOcx0ptle9bp2kKl4HlSTTfbtpuG5onSa3swRNhtKtUy5NH9 \
     W/FLViKWfoPS3kwoEpC1XqKY6l7evoTCtS+kTQRSrCe4vbNprCAZRxz6z1nEeCgu \
     NMk38yTRvx8ihZpVOuU+Ih+dOtVe/ex5IAPYxlQsvtfhsUZqc7IyCcy72WHnRHlU \
     fn3pJm0S5270+Yls3Iv6h3oBAP19i906UjiUTNH3g0xMW+V4uLxgyckt4wD4Mlyv \
     jnaQ7Z3sR6EsXMocAbXHIAJhwKdtU/fLgdwL5vtx

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jws",
         "key": {
           "cert": "MIIC6jCCAdKgAwIBAgIGAXjw74xPMA0GCSqGSIb3DQEBCwUAMD\
     YxNDAyBgNVBAMMK05JWU15QmpzRGp5QkM5UDUzN0Q2SVR6a3BEOE50UmppOXlhcEV\
     6QzY2bVEwHhcNMjEwNDIwMjAxODU0WhcNMjIwMjE0MjAxODU0WjA2MTQwMgYDVQQD\
     DCtOSVlNeUJqc0RqeUJDOVA1MzdENklUemtwRDhOdFJqaTl5YXBFekM2Nm1RMIIBI\
     jANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhYOJ+XOKISdMMShn/G4W9m20mT\
     0VWtQBsmBBkI2cmRt4Ai8BfYdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8\
     KowlyVy8IkZ8NMwSrcUIBZGYXjHpwjzvfGvXH/5KJlnR3/uRUp4Z4Ujk2bCaKegDn\
     11V2vxE41hqaPUnhRZxe0jRETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDad\
     z8BkPo+uv4BC0bunS0K3bA/3UgVp7zBlQFoFnLTO2uWp/muLEWGl67gBq9MO3brKX\
     fGhi3kOzywzwPTuq+cVQDyEN7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQIDAQABMA0\
     GCSqGSIb3DQEBCwUAA4IBAQBnYFK0eYHy+hVf2D58usj39lhL5znb/q9G35GBd/Xs\
     WfCEwHuLOSZSUmG71bZtrOcx0ptle9bp2kKl4HlSTTfbtpuG5onSa3swRNhtKtUy5\
     NH9W/FLViKWfoPS3kwoEpC1XqKY6l7evoTCtS+kTQRSrCe4vbNprCAZRxz6z1nEeC\
     guNMk38yTRvx8ihZpVOuU+Ih+dOtVe/ex5IAPYxlQsvtfhsUZqc7IyCcy72WHnRHl\
     Ufn3pJm0S5270+Yls3Iv6h3oBAP19i906UjiUTNH3g0xMW+V4uLxgyckt4wD4Mlyv\
     jnaQ7Z3sR6EsXMocAbXHIAJhwKdtU/fLgdwL5vtx"
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       },
       "subject": {
           "formats": ["iss_sub", "opaque"]
       }

   }

   The verifier compares client instance.  In these cases, the AS can
   validate that it did issue the assertion and it is associated with
   the TLS client certificate presented during
   mutual TLS negotiation to instance presenting the expected assertion.

12.11.  Client Instance Pre-registration

   Each client instance is identified by its own unique key, and for
   some kinds of client software such as a web server or backend system,
   this identification can be facilitated by registering a single key
   for a piece of client software ahead of time.  This registration can
   be associated with a set of display attributes to be used during the signer.  Since the
   TLS connection covers
   authorization process, identifying the entire message, there are no additional
   requirements client software to check.

   Note that in many instances, the verifier will not do a full
   certificate chain validation user.
   In these cases, it can be assumed that only one instance of the presented TLS client certificate,
   as
   software will exist, likely to serve many different users.

   A client's registration record needs to include its identifying key.
   Furthermore, it is the means of trust case that any clients using symmetric
   cryptography for this certificate could be key proofing mechanisms need to have their keys pre-
   registered.  The registration should also include any information
   that would aid in something
   other than a PKI system, the authorization process, such as a static display name
   and logo.  The registration record can also limit a given client to
   ask for certain kinds of information and access, or trust-on-
   first-use.

   [[ See issue #110 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/110) ]]

7.3.3.  Detached JWS

   This method be limited to
   specific interaction mechanisms at runtime.

   It also is indicated by "jwsd" in sensible to pre-register client instances when the "proof" field.  A JWS
   [RFC7515] object
   software is created as follows:

   To protect acting on its own behalf, without the request, need for a runtime
   approval by a resource owner or any interaction with an end-user.  In
   these cases, an AS needs to rest on the JOSE header trust decisions that have
   been determined prior to runtime in determining what rights and
   tokens to grant to a given client instance.

   However, it does not make sense to pre-register many types of
   clients.  Single-page applications (SPAs) and mobile/desktop
   applications in particular present problems with pre-registration.
   For SPAs, the signature contains instances are ephemeral in nature and long-term
   registration of a single instance leads to significant storage and
   management overhead at the
   following parameters:

   kid (string)  The key identifier.  RECOMMENDED.  If AS.  For mobile applications, each
   installation of the key client software is
      presented in JWK format, this MUST a separate instance, and
   sharing a key among all instances would be detrimental to security as
   the value compromise of the "kid" field any single installation would compromise all copies
   for all users.

   An AS can treat these classes of the key.

   alg (string)  The algorithm used client software differently from
   each other, perhaps by allowing access to sign certain high-value APIs
   only to pre-registered known clients, or by requiring an active end-
   user delegation of authority to any client software not pre-
   registered.

   An AS can also provide warnings and caveats to resource owners during
   the request.  REQUIRED.
      MUST be appropriate authorization process, allowing the user to make an informed
   decision regarding the key presented.  If software they are authorizing.  For example,
   if the key AS has done vetting of the client software and this specific
   instance, it can present a different authorization screen compared to
   a client instance that is presented presenting all of its information at
   runtime.

12.12.  Client Instance Impersonation

   If client instances are allowed to set their own user-facing display
   information, such as a JWK, this MUST be equal to display name and website URL, a malicious
   client instance could impersonate legitimate client software for the "alg" parameter
   purposes of tricking users into authorizing the key.
      MUST NOT be "none".

   typ (string)  The type header, value "gnap-binding+jwsd".  REQUIRED

   htm (string)  The HTTP Method used malicious client.

   Requiring clients to make pre-register does not fully mitigate this request, as an
      uppercase ASCII string.  REQUIRED

   uri (string)  The HTTP URI used
   problem since many pre-registration systems have self-service portals
   for this request, including all path
      and query components and no fragment component.  REQUIRED

   created (integer)  A timestamp management of when client registration, allowing authenticated
   developers to enter self-asserted information into the signature was created, in
      integer seconds since UNIX Epoch

   ath (string)  When management
   portal.

   An AS can mitigate this by actively filtering all self-asserted
   values presented by client software, both dynamically as part of GNAP
   and through a request is bound registration portal, to an access token, the access
      token hash value.  The value MUST be limit the result kinds of Base64url
      encoding (with no padding)
   impersonation that would be done.

   An AS can also warn the SHA-256 digest of resource owner about the ASCII
      encoding provenance of the associated access token's value.  REQUIRED if
   information it is displaying, allowing the
      request protects resource owner to make a
   more informed delegation decision.  For example, an access token.

   If the HTTP request has AS can visually
   differentiate between a message body, such as client instance that can be traced back to a
   specific developer's registration and an HTTP POST or PUT
   method, the payload instance that has self-
   asserted its own key and display information.

12.13.  Interception of Information in the JWS object Browser

   Most information passed through the web-browser is susceptible to
   interception and possible manipulation by elements within the Base64url encoding
   (without padding) of browser
   such as scripts loaded within pages.  Information in the SHA256 digest of URL is
   exposed through browser and server logs, and can also leak to other
   parties through HTTP "Referrer" headers.

   GNAP's design limits the bytes of information passed directly through the body.  If
   browser, allowing for opaque URLs in most circumstances.  For the request being made does not have
   redirect-based interaction finish mechanism, named query parameters
   are used to carry unguessable opaque values.  For these, GNAP
   requires creation and validation of a message body, such as an HTTP
   GET, OPTIONS, or DELETE method, cryptographic hash to protect
   the JWS signature is calculated over query parameters added to the URL and associate them with an empty payload.
   ongoing grant process.  The client instance presents the signed object in compact form
   [RFC7515] in the Detached-JWS HTTP Header field.

   In has to properly validate
   this example, the JOSE Header contains the following parameters:

   {
       "alg": "RS256",
       "kid": "gnap-rsa",
       "uri": "https://server.example.com/gnap",
       "htm": "POST",
       "typ": "gnap-binding+jwsd",
       "created": 1618884475
   }

   The request body is the following JSON object:

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jwsd",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       }
   }

   This is hashed hash to prevent an attacker from injecting an interaction
   reference intended for a different AS or client instance.

   Several interaction start mechanisms use URLs created by the following Base64 encoded value:

   PGiVuOZUcN1tRtUS6tx2b4cBgw9mPgXG3IPB3wY7ctc

   This leads AS and
   passed to the following full HTTP request message:

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Content-Length: 983
   Detached-JWS: eyJhbGciOiJSUzI1NiIsImNyZWF0ZWQiOjE2MTg4ODQ0NzUsImh0b\
     SI6IlBPU1QiLCJraWQiOiJnbmFwLXJzYSIsInR5cCI6ImduYXAtYmluZGluZytqd3\
     NkIiwidXJpIjoiaHR0cHM6Ly9zZXJ2ZXIuZXhhbXBsZS5jb20vZ25hcCJ9.PGiVuO\
     ZUcN1tRtUS6tx2b4cBgw9mPgXG3IPB3wY7ctc.fUq-SV-A1iFN2MwCRW_yolVtT2_\
     TZA2h5YeXUoi5F2Q2iToC0Tc4drYFOSHIX68knd68RUA7yHqCVP-ZQEd6aL32H69e\
     9zuMiw6O_s4TBKB3vDOvwrhYtDH6fX2hP70cQoO-47OwbqP-ifkrvI3hVgMX9TfjV\
     eKNwnhoNnw3vbu7SNKeqJEbbwZfpESaGepS52xNBlDNMYBQQXxM9OqKJaXffzLFEl\
     -Xe0UnfolVtBraz3aPrPy1C6a4uT7wLda3PaTOVtgysxzii3oJWpuz0WP5kRujzDF\
     wX_EOzW0jsjCSkL-PXaKSpZgEjNjKDMg9irSxUISt1C1T6q3SzRgfuQ

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jwsd",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"

         },
       }
   }

   When client instance.  While these URLs are opaque to the verifier receives
   client instance, it's possible for the Detached-JWS header, it MUST parse AS to include parameters,
   paths, and
   validate the JWS object.  The signature MUST other pieces of information that could leak security data
   or be validated against manipulated by a party in the
   expected key middle of the signer.  All required fields MUST be present and
   their values MUST be valid.  If transaction.

12.14.  Callback URL Manipulation

   The callback URL used in interaction finish mechanisms is defined by
   the HTTP message request contains a
   body, client instance.  This URL is opaque to the verifier MUST calculate AS, but can contain
   information relevant to the hash of body just as client instance's operations.  In
   particular, the signer
   does, with no normalization or transformation of client instance can include state information to
   allow the callback request to be associated with an ongoing grant
   request.

7.3.4.  Attached JWS

   This method

   Since this URL is indicated by "jws" exposed to the end-user's browser, it is
   susceptible to both logging and manipulation in transit before the "proof" field.  A JWS
   [RFC7515] object
   request is created as follows:

   The JOSE header MUST contain made to the "kid" parameter of client software.  As such, a client instance
   should never put security-critical or private information into the key bound
   callback URL in a cleartext form.  For example, if the client
   software includes a post-redirect target URL in its callback URL to
   the AS, this target URL could be manipulated by an attacker, creating
   an open redirector at the client.  Instead, a client instance for this request.  The "alg" parameter MUST can use
   an unguessable identifier into the URL that can then be
   set used by the
   client software to a value appropriate for look up the key identified details of the pending request.  Since
   this approach requires some form of statefulness by kid and MUST NOT
   be "none".

   To protect the request, client
   software during the JWS header MUST contain redirection process, clients that are not capable
   of holding state through a redirect should not use redirect-based
   interaction mechanisms.

12.15.  MTLS Deployment Patterns

   GNAP does not specify how a client instance's keys could be made
   known to the following
   additional parameters.

   typ (string)  The type header, value "gnap-binding+jws".

   htm (string)  The HTTP Method AS ahead of time.  Public Key Infrastructure (PKI) can
   be used to make this request, as an
      uppercase ASCII string.

   uri (string)  The HTTP URI manage the keys used for this request, including all path
      and query components and no fragment component.

   created (integer)  A timestamp of by client instances when calling the signature was created, in
      integer seconds since UNIX Epoch

   ath (string)  When
   AS, allowing the AS to trust a request root key from a trusted authority.
   This method is bound particularly relevant to an access token, the access
      token hash value.  The value MUST be MTLS signature method,
   where the result of Base64url
      encoding (with no padding) client instance presents its certificate to the SHA-256 digest AS as part
   of the ASCII
      encoding of TLS connection.  An AS using PKI to validate the associated access token's value.

   If MTLS
   connection would need to ensure that the HTTP request has presented certificate was
   issued by a message body, such as an HTTP POST trusted certificate authority before allowing the
   connection to continue.  PKI-based certificates would allow a key to
   be revoked and rotated through management at the certificate
   authority without requiring additional registration or PUT
   method, management at
   the payload AS.  PKI has historically been difficult to deploy, especially at
   scale, but it remains an appropriate solution for systems where the
   required overhead is not an impediment.

   MTLS need not use a PKI backing, as self-signed certificates and
   certificates from untrusted authorities can still be presented as
   part of a TLS connection.  In this case, the JWS object is the JSON serialized body of AS or RS would validate
   the request, and connection but accept whatever certificate was presented by the object is signed according
   client software.  This specific certificate would then be bound to JWS and serialized
   into compact form [RFC7515].  The
   all future connections from that client instance presents the JWS as software by being bound to
   the body resulting access tokens.

12.16.  Interception of Responses from the request along with a content type of "application/
   jose".  The AS MUST extract

   Responses from the payload of AS contain information vital to both the JWS security
   and treat it as privacy operations of GNAP.  This information includes nonces
   used in cryptographic calculations, subject identifiers, assertions,
   public keys, and information about what client software is requesting
   and was granted.

   In addition, if bearer tokens are used or keys are issued alongside a
   bound access token, the request body response from the AS contains all information
   necessary for further processing.

   If use of the request being made does not have contained access token.  Any party that is
   capable of viewing such a message body, response, such as an
   HTTP GET, OPTIONS, or DELETE method, the JWS signature is calculated
   over an empty payload intermediary proxy,
   would be able to exfiltrate and passed in the "Detached-JWS" header as
   described in Section 7.3.3.

   In use this example, the JOSE header contains the following parameters:

   {
       "alg": "RS256",
       "kid": "gnap-rsa",
       "uri": "https://server.example.com/gnap",
       "htm": "POST",
       "typ": "gnap-binding+jwsd",
       "created": 1618884475
   }

   The request body, used as token.  If the JWS Payload, access token
   is instead bound to the following JSON
   object:

   {
       "access_token": {
           "access": [
               "dolphin-metadata"
           ]
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.foo/callback",
               "nonce": "VJLO6A4CAYLBXHTR0KRO"
           }
       },
       "client": {
         "proof": "jws",
         "key": {
           "jwk": {
               "kid": "gnap-rsa",
               "kty": "RSA",
               "e": "AQAB",
               "alg": "RS256",
               "n": "hYOJ-XOKISdMMShn_G4W9m20mT0VWtQBsmBBkI2cmRt4Ai8Bf\
     YdHsFzAtYKOjpBR1RpKpJmVKxIGNy0g6Z3ad2XYsh8KowlyVy8IkZ8NMwSrcUIBZG\
     YXjHpwjzvfGvXH_5KJlnR3_uRUp4Z4Ujk2bCaKegDn11V2vxE41hqaPUnhRZxe0jR\
     ETddzsE3mu1SK8dTCROjwUl14mUNo8iTrTm4n0qDadz8BkPo-uv4BC0bunS0K3bA_\
     3UgVp7zBlQFoFnLTO2uWp_muLEWGl67gBq9MO3brKXfGhi3kOzywzwPTuq-cVQDyE\
     N7aL0SxCb3Hc4IdqDaMg8qHUyObpPitDQ"
           }
         }
         "display": {
           "name": "My Client Display Name",
           "uri": "https://client.foo/"
         },
       },
       "subject": {
           "formats": ["iss_sub", "opaque"]
       }
   }

   This leads client instance's presented key,
   intermediaries no longer have sufficient information to use the following full HTTP request message:

   POST /gnap HTTP/1.1
   Host: server.example.com
   Content-Type: application/jose
   Content-Length: 1047

   eyJhbGciOiJSUzI1NiIsImNyZWF0ZWQiOjE2MTg4ODQ0NzUsImh0bSI6IlBPU1QiLCJ\
   raWQiOiJnbmFwLXJzYSIsInR5cCI6ImduYXAtYmluZGluZytqd3NkIiwidXJpIjoiaH\
   R0cHM6Ly9zZXJ2ZXIuZXhhbXBsZS5jb20vZ25hcCJ9.CnsKICAgICJhY2Nlc3NfdG9r\
   ZW4iOiB7CiAgICAgICAgImFjY2VzcyI6IFsKICAgICAgICAgICAgImRvbHBoaW4tbWV\
   0YWRhdGEiCiAgICAgICAgXQogICAgfSwKICAgICJpbnRlcmFjdCI6IHsKICAgICAgIC\
   Aic3RhcnQiOiBbInJlZGlyZWN0Il0sCiAgICAgICAgImZpbmlzaCI6IHsKICAgICAgI\
   CAgICAgIm1ldGhvZCI6ICJyZWRpcmVjdCIsCiAgICAgICAgICAgICJ1cmkiOiAiaHR0\
   cHM6Ly9jbGllbnQuZm9vL2NhbGxiYWNrIiwKICAgICAgICAgICAgIm5vbmNlIjogIlZ\
   KTE82QTRDQVlMQlhIVFIwS1JPIgogICAgICAgIH0KICAgIH0sCiAgICAiY2xpZW50Ij\
   ogewogICAgICAicHJvb2YiOiAiandzIiwKICAgICAgImtleSI6IHsKICAgICAgICAia\
   ndrIjogewogICAgICAgICAgICAia2lkIjogImduYXAtcnNhIiwKICAgICAgICAgICAg\
   Imt0eSI6ICJSU0EiLAogICAgICAgICAgICAiZSI6ICJBUUFCIiwKICAgICAgICAgICA\
   gImFsZyI6ICJSUzI1NiIsCiAgICAgICAgICAgICJuIjogImhZT0otWE9LSVNkTU1TaG\
   5fRzRXOW0yMG1UMFZXdFFCc21CQmtJMmNtUnQ0QWk4QmZZZEhzRnpBdFlLT2pwQlIxU\
   nBLcEptVkt4SUdOeTBnNlozYWQyWFlzaDhLb3dseVZ5OElrWjhOTXdTcmNVSUJaR1lY\
   akhwd2p6dmZHdlhIXzVLSmxuUjNfdVJVcDRaNFVqazJiQ2FLZWdEbjExVjJ2eEU0MWh\
   xYVBVbmhSWnhlMGpSRVRkZHpzRTNtdTFTSzhkVENST2p3VWwxNG1VTm84aVRyVG00bj\
   BxRGFkejhCa1BvLXV2NEJDMGJ1blMwSzNiQV8zVWdWcDd6QmxRRm9GbkxUTzJ1V3Bfb\
   XVMRVdHbDY3Z0JxOU1PM2JyS1hmR2hpM2tPenl3endQVHVxLWNWUUR5RU43YUwwU3hD\
   YjNIYzRJZHFEYU1nOHFIVXlPYnBQaXREUSIKICAgICAgICB9CiAgICAgIH0KICAgICA\
   gImRpc3BsYXkiOiB7CiAgICAgICAgIm5hbWUiOiAiTXkgQ2xpZW50IERpc3BsYXkgTm\
   FtZSIsCiAgICAgICAgInVyaSI6ICJodHRwczovL2NsaWVudC5mb28vIgogICAgICB9L\
   AogICAgfSwKICAgICJzdWJqZWN0IjogewogICAgICAgICJmb3JtYXRzIjogWyJpc3Nf\
   c3ViIiwgIm9wYXF1ZSJdCiAgICB9Cn0K.MwNoVMQp5hVxI0mCs9LlOUdFtkDXaA1_eT\
   vOXq7DOGrtDKH7q4vP2xUq3fH2jRAZqnobo0WdPP3eM3NH5QUjW8pa6_QpwdIWkK7r-\
   u_52puE0lPBp7J4U2w4l9gIbg8iknsmWmXeY5F6wiGT8ptfuEYGgmloAJd9LIeNvD3U\
   LW2h2dz1Pn2eDnbyvgB0Ugae0BoZB4f69fKWj8Z9wvTIjk1LZJN1PcL7_zT8Lrlic9a\
   PyzT7Q9ovkd1s-4whE7TrnGUzFc5mgWUn_gsOpsP5mIIljoEEv-FqOW2RyNYulOZl0Q\
   8EnnDHV_vPzrHlUarbGg4YffgtwkQhdK72-JOxYQ

   [[ See issue #109 (https://github.com/ietf-wg-gnap/gnap-core-
   protocol/issues/109) ]]

   When
   token.  They can still, however, gain information about the verifier receives an attached JWS request, it MUST parse and
   validate end user
   as well as the JWS object. actions of the client software.

12.17.  Key Distribution

   The signature MUST keys for client instances could be validated against the
   expected key distributed as part of the signer.  All required fields MUST be present and
   their values MUST be valid.  If
   deployment process of instances of the HTTP message request contains client software.  For example,
   an application installation framework could generate a
   body, the verifier MUST decode the payload keypair for
   each copy of client software, then both install it into the JWS object client
   software upon installation and
   treat this as registering that instance with the HTTP message body.

8.  Resource Access Rights

   GNAP provides a rich structure AS.

   Additionally, it's possible for describing the protected resources
   hosted by RSs and accessed by client software.  This structure is AS to generate keys to be used
   with access tokens that are separate from the keys used when by the client
   instance requests an access token (Section 2.1)
   and when an access token is returned (Section 3.2).

   The root of to request tokens.  In this structure is a JSON array.  The elements of the JSON
   array represent rights of access that are associated with method, the AS would generate
   the
   access token.  The resulting access is asymmetric keypair or symmetric key and return the union of entire key,
   including all elements
   within private signing information, to the array.

   The access associated with client instance
   alongside the access token is described using
   objects that each contain multiple dimensions itself.  This approach would make
   interception of access.  Each object
   contains a REQUIRED "type" property that determines the type of API
   that return from the token is used for.

   type (string)  The type endpoint equivalent to that
   of resource request as a string.  This field
      MAY define which other fields are allowed bearer token, since all information required to use the access
   token would be present in the request object.
      This field is REQUIRED.

   The value of request.

12.18.  Interaction Finish Modes and Polling

   During the "type" field is under interaction process, the client instance usually hands
   control of the AS.  This
   field MUST be compared user experience over to another component, beit the
   system browser, another application, or some action the resource
   owner is instructed to take on another device.  By using an exact byte match of
   interaction finish method, the string value
   against known types client instance can be securely
   notified by the AS.  The AS MUST ensure that there when the interaction is no
   collision between different authorization data types that it
   supports.  The AS MUST NOT do any collation or normalization completed and the next
   phase of data
   types during comparison.  It is RECOMMENDED the protocol should occur.  This process includes
   information that designers of
   general-purpose APIs the client instance can use a URI for this field to avoid collisions
   between multiple API types protected by a single AS.

   While it is expected that many APIs will have their own properties, a
   set of common properties are defined here.  Specific API
   implementations SHOULD NOT re-use these fields with different
   semantics or syntax.  The available values for these properties are
   determined by validate the API being protected at finish
   call from the RS.

   actions (array of strings)  The AS and prevent some injection, session hijacking, and
   phishing attacks.

   Some types of actions the client instance
      will take at the RS as deployment are unable to receive an array of strings.  For example, a client
      instance asking for a combination of "read" and "write" access.

   locations (array of strings)  The location of the RS as interaction
   finish message.  Without an array of
      strings.  These strings are typically URIs identifying the
      location of the RS.

   datatypes (array of strings)  The kinds of data available interaction finish method to notify it,
   the client instance at the RS's API as an array of strings.  For
      example, a client instance asking for access will need to raw "image" data
      and "metadata" at a photograph API.

   identifier (string)  A string identifier indicating a specific
      resource at the RS.  For example, a patient identifier for a
      medical API or a bank account number for a financial API.

   privileges (array of strings)  The types or levels of privilege being
      requested at poll the resource.  For example, a client instance asking
      for administrative level access, or access when grant continuation API
   while waiting for the resource owner
      is no longer online.

   The following non-normative example is describing three kinds of
   access (read, write, delete) to each approve or deny the request.
   An attacker could take advantage of two different locations and
   two different data types (metadata, images) for a single access token
   using this situation by capturing the fictitious "photo-api" type definition.

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read",
               "write",
               "delete"
           ],
           "locations": [
               "https://server.example.net/",
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata",
               "images"
           ]
       }
   ]

   The access requested for
   interaction start parameters and phishing a given object when using these fields is legitimate user into
   authorizing the cross-product attacker's waiting client instance, which would in
   turn have no way of all fields associating the completed interaction with the
   start of the object.  That request.

   However, it is important to say, the
   object represents note that this pattern is practically
   indistinguishable from some legitimate use cases.  For example, a request for all "actions" listed to be used at
   all "locations" listed
   smart device emits a code for all possible "datatypes" listed within the
   object.  Assuming the request above was granted, the client instance
   could assume that it would be able resource owner to do enter on a "read" action against
   separate device.  The smart device has to poll because the
   "images" expected
   behavior is that the interaction will take place on the first server as well as separate
   device, without a "delete" action on way to return information to the
   "metadata" of original device's
   context.

   As such, developers need to weigh the second server, or any other combination risks of these
   fields, using forgoing an
   interaction finish method against the same access token.

   To request a different combination of access, such as requesting one deployment capabilities of the possible "actions" against one of
   client software and its environment.  Due to the possible "locations" increased security,
   an interaction finish method should be employed whenever possible.

12.19.  Storage of Information During Interaction and Continuation

   When starting an interactive grant request, a different choice of possible "actions" against client application has
   a different one number of protocol elements that it needs to manage, including
   nonces, references, keys, access tokens, and other elements.  During
   the possible "locations", interaction process, the client instance can include multiple
   separate objects in the "resources" array.  The following non-
   normative example uses usually hands control of
   the same fictitious "photo-api" type
   definition user experience over to request a single access token with more specifically
   targeted access rights by using two discrete objects within another component, beit the
   request.

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read"
           ],
           "locations": [
               "https://server.example.net/"
           ],
           "datatypes": [
               "images"
           ]
       },
       {
           "type": "photo-api",
           "actions": [
               "write",
               "delete"
           ],
           "locations": [
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata"
           ]
       }
   ]

   The access requested here system
   browser, another application, or some action the resource owner is for "read" access
   instructed to "images" take on one
   server while simultaneously requesting "write" and "delete" access another device.  In order for "metadata" on a different server, but importantly without
   requesting "write" or "delete" access to "images" on the first
   server.

   It is anticipated that API designers client
   instance to make its continuation call, it will use a combination need to recall all of common
   fields defined in
   these protocol elements.  Usually this specification as well means the client instance will
   need to store these protocol elements in some retrievable fashion.

   If the security protocol elements are stored on the end-user's
   device, such as fields specific in browser storage or in local application data
   stores, capture and exfiltration of this information could allow an
   attacker to continue a pending transaction instead of the API itself.  The following non-normative example shows the client
   instance.  Client software can make use of
   both common and API-specific fields as part of two different
   fictitious API "type" values.  The first access request includes the
   "actions", "locations", secure storage mechanisms,
   including hardware-based key and "datatypes" fields specified here as well
   as data storage, to prevent such
   exfiltration.

   Note that in GNAP, the API-specific "geolocation" field.  The second access request
   includes client instance has to choose its interaction
   finish URL prior to making the "actions" and "identifier" fields specified here as well
   as first call to the API-specific "currency" field.

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read",
               "write"
           ],
           "locations": [
               "https://server.example.net/",
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata",
               "images"
           ],
           "geolocation": [
               { lat: -32.364, lng: 153.207 },
               { lat: -35.364, lng: 158.207 }
           ]
       },
       {
           "type": "financial-transaction",
           "actions": [
               "withdraw"
           ],
           "identifier": "account-14-32-32-3",
           "currency": "USD"
       }
   ]

   If this request is approved, AS.  As such, the resulting access token
   (Section 3.2.1)'s access rights
   interaction finish URL will be often have a unique identifier for the union of
   ongoing request, allowing the requested
   types of client instance to access for each of the two APIs, just correct
   portion of its storage.  Since this URL is passed to other parties
   and often used through a browser, this URL should not contain any
   security-sensitive information that would be valuable to an attacker,
   such as above.

8.1.  Requesting Resources By Reference

   Instead any token identifier, nonce, or user information.  Instead, a
   cryptographically random value is suggested.

12.20.  Denial of sending Service (DoS) through Grant Continuation

   When a client instance starts off an object describing interactive process, it will
   eventually need to continue the requested resource
   (Section 8), access rights MAY be communicated as grant request in a string known subsequent message
   to the AS.  It's possible for a naive client implementation to
   continuously send continuation requests to the AS or RS representing while waiting for
   approval, especially if no interaction finish method is used.  Such
   constant requests could overwhelm the access being requested.  Each string
   SHOULD correspond AS's ability to a specific expanded object representation at the
   AS.

   "access": [
       "read", "dolphin-metadata", "some respond to both
   these and other thing"
   ]
   This value requests.

   To mitigate this for well-behaved client software, the continuation
   response contains a "wait" parameter that is opaque intended to tell the
   client instance and MAY how long it should wait until making its next
   request.  This value can be any valid JSON
   string, and therefore could include spaces, unicode characters, and
   properly escaped string sequences.  However, in some situations used to back off client software that is
   checking too quickly by returning increasing wait times for a single
   client instance.

   If client software ignores the "wait" value is intended to be seen and understood by makes its
   continuation calls too quickly, or if the client software assumes the
   absence of the "wait" values means it should poll immediately, the AS
   can choose to return errors to the offending client instance,
   including possibly canceling the ongoing grant request.  With well-
   meaning client software these errors can indicate a need to change
   the client software's
   developer.  In such cases, programmed behavior.

12.21.  Exhaustion of Random Value Space

   Several parts of the API designer choosing any GNAP process make use of unguessable randomized
   values, such human-
   readable strings SHOULD take steps as nonces, tokens, and randomized URLs.  Since these
   values are intended to be unique, a sufficiently powerful attacker
   could make a large number of requests to trigger generation of
   randomized values in an attempt to exhaust the random number
   generation space.  While this attack is particularly applicable to ensure
   the string AS, client software could likewise be targeted by an attacker
   triggering new grant requests against an AS.

   To mitigate this, software can ensure that its random values are
   not easily confused by
   chosen from a developer, significantly large pool that exhaustion of that pool
   is prohibitive for an attacker.  Additionally, the random values can
   be time-boxed in such a way as by limiting their validity windows are reasonably
   short.  Since many of the strings
   to easily disambiguated characters.

   This functionality random values used within GNAP are used
   within limited portions of the protocol, it is similar in practice reasonable for a
   particular random value to OAuth 2.0's "scope"
   parameter [RFC6749], where be valid for only a single string represents the set small amount of
   access rights requested by the client instance.  As such, time.
   For example, the
   reference string could contain any nonces used for interaction finish hash calculation
   need only to be valid OAuth 2.0 scope value as in
   Appendix D.5.  Note that while the reference string here client instance is not bound to waiting for the same character restrictions as in OAuth 2.0's "scope" definition.

   A single "access" array MAY include both object-type
   finish callback and string-type
   resource items.  In this non-normative example, can be functionally expired when the client instance
   is requesting interaction
   has completed.  Similarly, artifacts like access to a "photo-api" tokens and "financial-transaction" API
   type as well as the
   interaction reference can be limited to have lifetimes tied to their
   functional utility.  Finally, each different category of artifact
   (nonce, token, reference, identifier, etc.) can be generated from a
   separate random pool of values instead of "read", "dolphin-metadata",
   and "some other thing".

   "access": [
       {
           "type": "photo-api",
           "actions": [
               "read",
               "write",
               "delete"
           ],
           "locations": [
               "https://server.example.net/",
               "https://resource.local/other"
           ],
           "datatypes": [
               "metadata",
               "images"
           ]
       },
       "read",
       "dolphin-metadata",
       {
           "type": "financial-transaction",
           "actions": [
               "withdraw"
           ],
           "identifier": "account-14-32-32-3",
           "currency": "USD"
       },
       "some other thing"
   ] a single global value
   space.

13.  Privacy Considerations

   The requested access is privacy considerations in this section are modeled after the union of all elements list
   of the array,
   including both objects and reference strings.

9.  Discovery

   By design, the protocol minimizes the need privacy threats in [[RFC6973]], "Privacy Considerations for any pre-flight
   discovery.  To begin a request,
   Internet Protocols", and either explain how these threats are
   mitigated or advise how the client instance only needs threats relate to
   know GNAP.

13.1.  Surveillance

   Surveillance is the endpoint observation or monitoring of the AS and which keys it will use to sign the
   request.  Everything else an individual's
   communications or activities.  Surveillance can be negotiated dynamically in the course
   of conducted by
   observers or eavesdroppers at any point along the protocol.

   However, communications
   path.

   GNAP assumes the AS can have limits on its allowed functionality.  If TLS protection used throughout the
   client instance wants to optimize its calls to spec is intact.
   Without the AS before making a
   request, it MAY send an HTTP OPTIONS request to protection of TLS, there are many points throughout the grant request
   endpoint
   use of GNAP that would lead to retrieve the server's discovery information.  The AS MUST
   respond with a JSON document containing possible surveillance.

13.1.1.  Surveillance by the following information:

   grant_request_endpoint (string)  REQUIRED. Client

   The location purpose of the AS's
      grant request endpoint.  The location MUST GNAP is to authorize clients to be able to access
   information on behalf of a URL [RFC3986] with
      a scheme component user.  So while it is expected that MUST the
   client may be https, a host component, and
      optionally, port, path and query components and no fragment
      components.  This URL MUST match aware of the user's identity as well as data being
   fetched for that user, in some cases the URL extent of the client instance used
      to make may be
   beyond what the discovery request.

   interaction_start_modes_supported (array of strings)  OPTIONAL.  A
      list user is aware of.  For example, a client may be
   implemented as multiple distinct pieces of software, such as a
   logging service or a mobile app that reports usage data to an
   external backend service.

13.1.2.  Surveillance by the AS's interaction start methods. Authorization Server

   The values role of this
      list correspond to the possible values for authorization server is to manage the interaction start
      section (Section 2.5.1) authorization
   of client instances to protect access to the request.

   interaction_finish_methods_supported (array user's data.  In this
   role, the authorization server is by definition aware of strings)  OPTIONAL.  A
      list each
   authorization of a client instance by a user.  When the AS's interaction finish methods.  The values of this
      list correspond to authorization
   server shares user information with the possible values for client instance, it needs to
   make sure that it has the method element permission from that user to do so.

   Additionally, as part of the interaction finish section (Section 2.5.2) of authorization grant process, the request.

   key_proofs_supported (array of strings)  OPTIONAL.  A list
   authorization server may be aware of which resource servers the
      AS's supported key proofing mechanisms.  The values of this list
      correspond
   client intends to use an access token at.  However, it is possible values of to
   design a system using GNAP in which this knowledge is not made
   available to the "proof" field of authorization server, such as by avoiding the key
      section (Section 7.1) use of
   the "locations" object in the authorization request.

   subject_formats_supported (array of strings)  OPTIONAL.  A list

   If the authorization server's implementation of access tokens is such
   that it requires a resource server call back to the AS's supported subject identifier types.  The values authorization
   server to validate them, then the authorization server will be aware
   of which resource servers are actively in use and by which users and
   which clients.  To avoid this
      list correspond possibility, the authorization server
   would need to possible values of structure access tokens in such a way that they can be
   validated by the subject identifier
      section (Section 2.2) of resource server without notifying the request.

   assertions_supported (array of strings)  OPTIONAL.  A list of authorization
   server that the
      AS's supported assertion formats.  The values token is being validated.

13.2.  Stored Data

   Several parties in the GNAP process are expected to persist data at
   least temporarily, if not semi-permanently, for the normal
   functioning of the system.  If compromised, this list
      correspond could lead to possible values
   exposure of the subject assertion sensitive information.  This section
      (Section 2.2) of documents the request.

   The
   potentially sensitive information returned from this method each party in GNAP is expected to
   store for optimization
   purposes only.  The AS MAY deny any request, or normal operation.  Naturally it is possible that any portion party
   is storing information for longer than technically necessary of a
   request, even if it lists a capability the
   protocol mechanics (such as supported.  For example, a
   given client instance can audit logs, etc).

   The authorization server is expected to store subject identifiers for
   user indefinitely, in order to be registered with the "mtls" key proofing
   mechanism, but able to include them in the AS
   responses to clients.  The authorization server is also returns other proofing methods, then the
   AS will deny a request from that client instance using a different
   proofing mechanism.

9.1.  RS-first Method of AS Discovery

   If the expected to
   store client instance calls an RS without an access token, or with
   an invalid access token, key identifiers associated with display information
   about the RS MAY respond client such as its name and logo.

   The client is expected to the store its client instance
   with an authentication header indicating that GNAP needs key indefinitely,
   in order to be used authenticate to access the resource.  The address authorization server for the normal
   functioning of the GNAP endpoint MUST flows.  Additionally, the client will be
   sent in
   temporarily storing artifacts issued by the "as_uri" parameter.  The RS MAY additionally return authorization server
   during a
   resource reference that flow, and these artifacts SHOULD be discarded by the client instance MAY use in its access
   token request.  This
   when the transaction is complete.

   The resource reference MUST be sufficient server is not required to store any state for at
   least its normal
   operation.  Depending on the action implementation of access tokens, the client instance was attempting
   resource server may need to take at the RS
   and MAY be more powerful.  The means for cache public keys from the RS authorization
   server in order to validate access tokens.

13.3.  Intrusion

   Intrusion refers to determine the
   resource reference are out of scope ability of this specification, but some
   dynamic methods are discussed in
   [I-D.draft-ietf-gnap-resource-servers].  The content various parties to send
   unsolicited messages or cause denial of service for unrelated
   parties.

   If the resource
   handle owner is opaque to different from the client instance.

   WWW-Authenticate: \
     GNAP as_uri=https://server.example/tx,access=FWWIKYBQ6U56NL1

   The client instance then makes a request end user, there is an
   opportunity for the end user to cause unsolicited messages to be sent
   to the "as_uri" as described
   in Section 2, with resource owner if the value of "access" as one of system prompts the members resource owner for
   consent when an end user attempts to access their data.

   The format and contents of subject identifiers are intentionally not
   defined by GNAP.  If the
   "access" array in authorization server uses values for subject
   identifiers that are also identifiers for communication channels,
   (e.g. an email address or phone number), this opens up the "access_token" portion
   possibility for a client to learn this information when it was not
   otherwise authorized to access this kind of data about the request. user.

13.4.  Correlation

   The
   client instance MAY request additional resources and other
   information. threat of correlation is the combination of various pieces of
   information related to an individual in a way that defies their
   expectations of what others know about them.

13.4.1.  Correlation by Clients

   The client instance MAY request biggest risk of correlation in GNAP is when an authorization
   server returns stable consistent user identifiers to multiple access tokens.
   different applications.  In this non-normative example, the client instance is requesting a
   single access token using the resource reference "FWWIKYBQ6U56NL1"
   received from the RS case, applications created by
   different parties would be able to correlate these user identifiers
   out of band in addition order to the "dolphin-metadata" resource
   reference know which users they have in common.

   The most common example of this in practice is tracking for
   advertising purposes, such that the client instance has been configured A shares their list of user
   IDs with out an ad platform that is then able to retarget ads to
   applications created by other parties.  In contrast, a positive
   example of
   band.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "FWWIKYBQ6U56NL1",
               "dolphin-metadata"
           ]
       },
       "client": "KHRS6X63AJ7C7C4AZ9AO"
   }

   If issued, correlation is a corporate acquisition where two
   previously unrelated clients now do need to be able to identify the resulting
   same user between the two clients.

13.4.2.  Correlation by Resource Servers

   Unrelated resource servers also have an opportunity to correlate
   users if the authorization server includes stable user identifiers in
   access token would contain sufficient tokens or in access token introspection responses.

   In some cases a resource server may not actually need to be used at both referenced resources.

10.  Acknowledgements

   The editors would like able to thank
   identify users, (such as a resource server providing access to a
   company cafeteria menu which only needs to validate whether the feedback user
   is a current employee), so authorization servers should be thoughtful
   of the following
   individuals for their reviews, implementations, and contributions:
   Aeke Axeland, Aaron Parecki, Adam Omar Oueidat, Annabelle Backman,
   Dick Hardt, Dmitri Zagidulin, Dmitry Barinov, Fabien Imbault, Francis
   Pouatcha, George Fletcher, Haardik Haardik, Hamid Massaoud, Jacky
   Yuan, Joseph Heenan, Justin Richer, Kathleen Moriarty, Mike Jones,
   Mike Varley, Nat Sakimura, Takahiko Kawasaki, Takahiro Tsuchiya.

   The editors would also like when user identifiers are actually necessary to thank communicate to
   resource servers for the GNAP working group design
   team functionining of Kathleen Moriarty, Fabien Imbault, Dick Hardt, Mike Jones,
   and Justin Richer, who incorporated elements from the XAuth and XYZ
   proposals system.

13.4.3.  Correlation by Authorization Servers

   Clients are expected to create the first version of be identified by their client instance key.
   If a particular client instance key is used at more than one
   authorization server, this document.

   In addition, could open up the editors would like to thank Aaron Parecki and Mike
   Jones possibility for insights into how multiple
   unrelated authorization servers to integrate identity and authentication
   systems into the core protocol, and Justin Richer and Dick Hardt for
   the use cases, diagrams, and insights provided correlate client instances.  This
   is especially a problem in the XYZ and XAuth
   proposals that have been incorporated here.  The editors common case where a client instance is
   used by a single individual, as it would like
   to especially thank Mike Varley and the team at SecureKey for
   feedback and development of early versions of allow the XYZ protocol authorization
   servers to correlate that
   fed into individual between them.  If this standards work.

11.  IANA Considerations

   [[ TBD: There are is a lot
   concern of items in the document that are expandable
   through a client, the client should use distinct keys with each
   authorization server.

13.5.  Disclosure in Shared References

   Throughout many parts of value registries. ]]

12.  Security Considerations

   [[ TBD: There are a lot of security considerations to add. ]]

   All requests have to be over TLS or equivalent as per [BCP195].  Many
   handles act as GNAP, the parties pass shared secrets, though they can be combined with a
   requirement to provide proof references
   between each other, sometimes in place of a key as well.

13.  Privacy Considerations

   [[ TBD: There the values themselves.  For
   example the "interact_ref" value used throughout the flow.  These
   references are a lot of privacy considerations intended to add. ]]

   Handles are passed between parties be random strings and therefore should not contain
   any private data.

   When user information is passed to the client instance, the AS needs
   to make sure or sensitive data that it has the permission to do so. would potentially leak information
   between parties.

14.  References

14.1.  Normative References

   [BCP195]   Sheffer, Y., Holz, R., and P. Saint-Andre,
              "Recommendations for Secure Use of Transport Layer
              Security (TLS) and Datagram Transport Layer Security
              (DTLS)", May 2015,
              <https://www.rfc-editor.org/info/bcp195>.

   [I-D.draft-ietf-gnap-resource-servers]
              Richer, J., Parecki, A., and F. Imbault, "Grant
              Negotiation and Authorization Protocol Resource Server
              Connections", Work in Progress, Internet-Draft, draft-
              ietf-gnap-resource-servers-00, 28 April 2021,
              <https://www.ietf.org/archive/id/draft-ietf-gnap-resource-
              servers-00.txt>.

   [I-D.ietf-httpbis-message-signatures]
              Backman, A., Richer, J., and M. Sporny, "Signing HTTP
              Messages", "HTTP Message
              Signatures", Work in Progress, Internet-Draft, draft-ietf-
              httpbis-message-signatures-05, 8 June
              httpbis-message-signatures-06, 13 August 2021,
              <https://www.ietf.org/archive/id/draft-ietf-httpbis-
              message-signatures-05.txt>.
              message-signatures-06.txt>.

   [I-D.ietf-oauth-rar]
              Lodderstedt, T., Richer, J., and B. Campbell, "OAuth 2.0
              Rich Authorization Requests", Work in Progress, Internet-
              Draft, draft-ietf-oauth-rar-05, 15 May draft-ietf-oauth-rar-07, 12 September 2021,
              <https://www.ietf.org/archive/id/draft-ietf-oauth-rar-
              05.txt>.
              07.txt>.

   [I-D.ietf-oauth-signed-http-request]
              Richer, J., Bradley, J., and H. Tschofenig, "A Method for
              Signing HTTP Requests for OAuth", Work in Progress,
              Internet-Draft, draft-ietf-oauth-signed-http-request-03, 8
              August 2016, <https://www.ietf.org/archive/id/draft-ietf-
              oauth-signed-http-request-03.txt>.

   [I-D.ietf-secevent-subject-identifiers]
              Backman, A. and M. Scurtescu, "Subject Identifiers for
              Security Event Tokens", Work in Progress, Internet-Draft,
              draft-ietf-secevent-subject-identifiers-08, 24 May 2021,
              <https://www.ietf.org/archive/id/draft-ietf-secevent-
              subject-identifiers-08.txt>.

   [OIDC]     Sakimura, N., Bradley, J., Jones, M., de Medeiros, B., and
              C. Mortimore, "OpenID Connect Core 1.0 incorporating
              errata set 1", November 2014,
              <https://openiD.net/specs/openiD-connect-core-1_0.html>.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC3230]  Mogul, J. and A. Van Hoff, "Instance Digests in HTTP",
              RFC 3230, DOI 10.17487/RFC3230, January 2002,
              <https://www.rfc-editor.org/info/rfc3230>.

   [RFC3986]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
              Resource Identifier (URI): Generic Syntax", STD 66,
              RFC 3986, DOI 10.17487/RFC3986, January 2005,
              <https://www.rfc-editor.org/info/rfc3986>.

   [RFC5646]  Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying
              Languages", BCP 47, RFC 5646, DOI 10.17487/RFC5646,
              September 2009, <https://www.rfc-editor.org/info/rfc5646>.

   [RFC6749]  Hardt, D., Ed., "The OAuth 2.0 Authorization Framework",
              RFC 6749, DOI 10.17487/RFC6749, October 2012,
              <https://www.rfc-editor.org/info/rfc6749>.

   [RFC6750]  Jones, M. and D. Hardt, "The OAuth 2.0 Authorization
              Framework: Bearer Token Usage", RFC 6750,
              DOI 10.17487/RFC6750, October 2012,
              <https://www.rfc-editor.org/info/rfc6750>.

   [RFC7234]  Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
              Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
              RFC 7234, DOI 10.17487/RFC7234, June 2014,
              <https://www.rfc-editor.org/info/rfc7234>.

   [RFC7468]  Josefsson, S. and S. Leonard, "Textual Encodings of PKIX,
              PKCS, and CMS Structures", RFC 7468, DOI 10.17487/RFC7468,
              April 2015, <https://www.rfc-editor.org/info/rfc7468>.

   [RFC7515]  Jones, M., Bradley, J., and N. Sakimura, "JSON Web
              Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May
              2015, <https://www.rfc-editor.org/info/rfc7515>.

   [RFC7517]  Jones, M., "JSON Web Key (JWK)", RFC 7517,
              DOI 10.17487/RFC7517, May 2015,
              <https://www.rfc-editor.org/info/rfc7517>.

   [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>.

   [RFC8259]  Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
              Interchange Format", STD 90, RFC 8259,
              DOI 10.17487/RFC8259, December 2017,
              <https://www.rfc-editor.org/info/rfc8259>.

   [RFC8705]  Campbell, B., Bradley, J., Sakimura, N., and T.
              Lodderstedt, "OAuth 2.0 Mutual-TLS Client Authentication
              and Certificate-Bound Access Tokens", RFC 8705,
              DOI 10.17487/RFC8705, February 2020,
              <https://www.rfc-editor.org/info/rfc8705>.

   [RFC8792]  Watsen, K., Auerswald, E., Farrel, A., and Q. Wu,
              "Handling Long Lines in Content of Internet-Drafts and
              RFCs", RFC 8792, DOI 10.17487/RFC8792, June 2020,
              <https://www.rfc-editor.org/info/rfc8792>.

14.2.  Informative References

   [attack-surfaces]
              Axeland, Å. and O. Oueidat, "Security Analysis of Attack
              Surfaces on the Grant Negotiation and Authorization
              Protocol", 2021,
              <https://odr.chalmers.se/handle/20.500.12380/304105>.

   [promise-theory]
              Burgess, M. and J. Bergstra, "Promise theory", January
              2014, <http://markburgess.org/promises.html>.

   [RFC6973]  Cooper, A., Tschofenig, H., Aboba, B., Peterson, J.,
              Morris, J., Hansen, M., and R. Smith, "Privacy
              Considerations for Internet Protocols", RFC 6973,
              DOI 10.17487/RFC6973, July 2013,
              <https://www.rfc-editor.org/info/rfc6973>.

Appendix A.  Document History

   *  -07

      -  Replace user handle by opaque identifier

      -  Added trust relationships

      -  Added privacy considerations section

      -  Added security considerations.

   *  -06

      -  Removed "capabilities" and "existing_grant" protocol fields.

      -  Removed separate "instance_id" field.

      -  Split "interaction_methods_supported" into
         "interaction_start_modes_supported" and
         "interaction_finish_methods_supported".

      -  Added AS endpoint to hash calculation to fix mix-up attack.

      -  Added "privileges" field to resource access request object.

      -  Moved client-facing RS response back from GNAP-RS document.

      -  Removed oauthpop key binding.

      -  Removed dpop key binding.

      -  Added example DID identifier.

      -  Changed token response booleans to flag structure to match
         request.

      -  Updated signature examples to use HTTP Message Signatures.

   *  -05

      -  Changed "interaction_methods" to
         "interaction_methods_supported".

      -  Changed "key_proofs" to "key_proofs_supported".

      -  Changed "assertions" to "assertions_supported".

      -  Updated discovery and field names for subject formats.

      -  Add an appendix to provide protocol rationale, compared to
         OAuth2.

      -  Updated subject information definition.

      -  Refactored the RS-centric components into a new document.

      -  Updated cryptographic proof of possession methods to match
         current reference syntax.

      -  Updated proofing language to use "signer" and "verifier"
         generically.

      -  Updated cryptographic proof of possession examples.

      -  Editorial cleanup and fixes.

      -  Diagram cleanup and fixes.

   *  -04

      -  Updated terminology.

      -  Refactored key presentation and binding.

      -  Refactored "interact" request to group start and end modes.

      -  Changed access token request and response syntax.

      -  Changed DPoP digest field to 'htd' to match proposed FAPI
         profile.

      -  Include the access token hash in the DPoP message.

      -  Removed closed issue links.

      -  Removed function to read state of grant request by client.

      -  Closed issues related to reading and updating access tokens.

   *  -03

      -  Changed "resource client" terminology to separate "client
         instance" and "client software".

      -  Removed OpenID Connect "claims" parameter.

      -  Dropped "short URI" redirect.

      -  Access token is mandatory for continuation.

      -  Removed closed issue links.

      -  Editorial fixes.

   *  -02

      -  Moved all "editor's note" items to GitHub Issues.

      -  Added JSON types to fields.

      -  Changed "GNAP Protocol" to "GNAP".

      -  Editorial fixes.

   *  -01

      -  "updated_at" subject info timestamp now in ISO 8601 string
         format.

      -  Editorial fixes.

      -  Added Aaron and Fabien as document authors.

   *  -00

      -  Initial working group draft.

Appendix B.  Compared to OAuth 2.0

   GNAP's protocol design differs from OAuth 2.0's in several
   fundamental ways:

   1.  *Consent and authorization flexibility:*

       OAuth 2.0 generally assumes the user has access to the a web
       browser.  The type of interaction available is fixed by the grant
       type, and the most common interactive grant types start in the
       browser.  OAuth 2.0 assumes that the user using the client
       software is the same user that will interact with the AS to
       approve access.

       GNAP allows various patterns to manage authorizations and
       consents required to fulfill this requested delegation, including
       information sent by the client instance, information supplied by
       external parties, and information gathered through the
       interaction process.  GNAP allows a client instance to list
       different ways that it can start and finish an interaction, and
       these can be mixed together as needed for different use cases.
       GNAP interactions can use a browser, but don't have to.  Methods
       can use inter-application messaging protocols, out-of-band data
       transfer, or anything else.  GNAP allows extensions to define new
       ways to start and finish an interaction, as new methods and
       platforms are expected to become available over time.  GNAP is
       designed to allow the end-user and the resource owner to be two
       different people, but still works in the optimized case of them
       being the same party.

   2.  *Intent registration and inline negotiation:*

       OAuth 2.0 uses different "grant types" that start at different
       endpoints for different purposes.  Many of these require
       discovery of several interrelated parameters.

       GNAP requests all start with the same type of request to the same
       endpoint at the AS.  Next steps are negotiated between the client
       instance and AS based on software capabilities, policies
       surrounding requested access, and the overall context of the
       ongoing request.  GNAP defines a continuation API that allows the
       client instance and AS to request and send additional information
       from each other over multiple steps.  This continuation API uses
       the same access token protection that other GNAP-protected APIs
       use.  GNAP allows discovery to optimize the requests but it isn't
       required thanks to the negotiation capabilities.

   3.  *Client instances:*

       OAuth 2.0 requires all clients to be registered at the AS and to
       use a client_id known to the AS as part of the protocol.  This
       client_id is generally assumed to be assigned by a trusted
       authority during a registration process, and OAuth places a lot
       of trust on the client_id as a result.  Dynamic registration
       allows different classes of clients to get a client_id at
       runtime, even if they only ever use it for one request.

       GNAP allows the client instance to present an unknown key to the
       AS and use that key to protect the ongoing request.  GNAP's
       client instance identifier mechanism allows for pre-registered
       clients and dynamically registered clients to exist as an
       optimized case without requiring the identifier as part of the
       protocol at all times.

   4.  *Expanded delegation:*

       OAuth 2.0 defines the "scope" parameter for controlling access to
       APIs.  This parameter has been coopted to mean a number of
       different things in different protocols, including flags for
       turning special behavior on and off, including the return of data
       apart from the access token.  The "resource" parameter and RAR
       extensions (as defined in [I-D.ietf-oauth-rar]) expand on the
       "scope" concept in similar but different ways.

       GNAP defines a rich structure for requesting access, with string
       references as an optimization.  GNAP defines methods for
       requesting directly-returned user information, separate from API
       access.  This information includes identifiers for the current
       user and structured assertions.  The core GNAP protocol makes no
       assumptions or demands on the format or contents of the access
       token, but the RS extension allows a negotiation of token formats
       between the AS and RS.

   5.  *Cryptography-based security:*
       OAuth 2.0 uses shared bearer secrets, including the client_secret
       and access token, and advanced authentication and sender
       constraint have been built on after the fact in inconsistent
       ways.

       In GNAP, all communication between the client instance and AS is
       bound to a key held by the client instance.  GNAP uses the same
       cryptographic mechanisms for both authenticating the client (to
       the AS) and binding the access token (to the RS and the AS).
       GNAP allows extensions to define new cryptographic protection
       mechanisms, as new methods are expected to become available over
       time.  GNAP does not have a notion of "public clients" because
       key information can always be sent and used dynamically.

   6.  *Privacy and usable security:*

       OAuth 2.0's deployment model assumes a strong binding between the
       AS and the RS.

       GNAP is designed to be interoperable with decentralized identity
       standards and to provide a human-centric authorization layer.  In
       addition to the core protocol, GNAP that supports various
       patterns of communication between RSs and ASs through extensions.
       GNAP tries to limit the odds of a consolidation to just a handful
       of super-popular AS services.

Appendix C.  Component Data Models

   While different implementations of this protocol will have different
   realizations of all the components and artifacts enumerated here, the
   nature of the protocol implies some common structures and elements
   for certain components.  This appendix seeks to enumerate those
   common elements.

   TBD: Client has keys, allowed requested resources, identifier(s),
   allowed requested subjects, allowed

   TBD: AS has "grant endpoint", interaction endpoints, store of trusted
   client keys, policies

   TBD: Token has RO, user, client, resource list, RS list,

Appendix D.  Example Protocol Flows

   The protocol defined in this specification provides a number of
   features that can be combined to solve many different kinds of
   authentication scenarios.  This section seeks to show examples of how
   the protocol would be applied for different situations.

   Some longer fields, particularly cryptographic information, have been
   truncated for display purposes in these examples.

D.1.  Redirect-Based User Interaction

   In this scenario, the user is the RO and has access to a web browser,
   and the client instance can take front-channel callbacks on the same
   device as the user.  This combination is analogous to the OAuth 2.0
   Authorization Code grant type.

   The client instance initiates the request to the AS.  Here the client
   instance identifies itself using its public key.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               {
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               }
           ],
       },
       "client": {
         "key": {
           "proof": "httpsig",
           "jwk": {
               "kty": "RSA",
               "e": "AQAB",
               "kid": "xyz-1",
               "alg": "RS256",
               "n": "kOB5rR4Jv0GMeLaY6_It_r3ORwdf8ci_JtffXyaSx8..."
           }
         }
       },
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return/123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       }
   }

   The AS processes the request and determines that the RO needs to
   interact.  The AS returns the following response giving the client
   instance the information it needs to connect.  The AS has also
   indicated to the client instance that it can use the given instance
   identifier to identify itself in future requests (Section 2.3.1).

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

   {
       "interact": {
          "redirect":
            "https://server.example.com/interact/4CF492MLVMSW9MKM",
          "push": "MBDOFXG4Y5CVJCX821LH"
       }
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue"
       },
       "instance_id": "7C7C4AZ9KHRS6X63AJAO"
   }

   The client instance saves the response and redirects the user to the
   interaction_url by sending the following HTTP message to the user's
   browser.

   HTTP 302 Found
   Location: https://server.example.com/interact/4CF492MLVMSW9MKM
   The user's browser fetches the AS's interaction URL.  The user logs
   in, is identified as the RO for the resource being requested, and
   approves the request.  Since the AS has a callback parameter, the AS
   generates the interaction reference, calculates the hash, and
   redirects the user back to the client instance with these additional
   values added as query parameters.

   NOTE: '\' line wrapping per RFC 8792

   HTTP 302 Found
   Location: https://client.example.net/return/123455\
     ?hash=p28jsq0Y2KK3WS__a42tavNC64ldGTBroywsWxT4md_jZQ1R2\
       HZT8BOWYHcLmObM7XHPAdJzTZMtKBsaraJ64A\
     &interact_ref=4IFWWIKYBC2PQ6U56NL1

   The client instance receives this request from the user's browser.
   The client instance ensures that this is the same user that was sent
   out by validating session information and retrieves the stored
   pending request.  The client instance uses the values in this to
   validate the hash parameter.  The client instance then calls the
   continuation URL and presents the handle and interaction reference in
   the request body.  The client instance signs the request as above.

   POST /continue HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "interact_ref": "4IFWWIKYBC2PQ6U56NL1"
   }

   The AS retrieves the pending request based on the handle and issues a
   bearer access token and returns this to the client instance.

   NOTE: '\' line wrapping per RFC 8792

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

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [{
               "actions": [
                   "read",
                   "write",
                   "dolphin"
               ],
               "locations": [
                   "https://server.example.net/",
                   "https://resource.local/other"
               ],
               "datatypes": [
                   "metadata",
                   "images"
               ]
           }]
       },
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue"
       }
   }

D.2.  Secondary Device Interaction

   In this scenario, the user does not have access to a web browser on
   the device and must use a secondary device to interact with the AS.
   The client instance can display a user code or a printable QR code.
   The client instance is not able to accept callbacks from the AS and
   needs to poll for updates while waiting for the user to authorize the
   request.

   The client instance initiates the request to the AS.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "dolphin-metadata", "some other thing"
           ],
       },
       "client": "7C7C4AZ9KHRS6X63AJAO",
       "interact": {
           "start": ["redirect", "user_code"]
       }
   }

   The AS processes this and determines that the RO needs to interact.
   The AS supports both redirect URIs and user codes for interaction, so
   it includes both.  Since there is no "callback" the AS does not
   include a nonce, but does include a "wait" parameter on the
   continuation section because it expects the client instance to poll
   for results.

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

   {
       "interact": {
           "redirect": "https://srv.ex/MXKHQ",
           "user_code": {
               "code": "A1BC-3DFF",
               "url": "https://srv.ex/device"
           }
       },
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue/VGJKPTKC50",
           "wait": 60
       }
   }
   The client instance saves the response and displays the user code
   visually on its screen along with the static device URL.  The client
   instance also displays the short interaction URL as a QR code to be
   scanned.

   If the user scans the code, they are taken to the interaction
   endpoint and the AS looks up the current pending request based on the
   incoming URL.  If the user instead goes to the static page and enters
   the code manually, the AS looks up the current pending request based
   on the value of the user code.  In both cases, the user logs in, is
   identified as the RO for the resource being requested, and approves
   the request.  Once the request has been approved, the AS displays to
   the user a message to return to their device.

   Meanwhile, the client instance periodically polls the AS every 60
   seconds at the continuation URL.  The client instance signs the
   request using the same key and method that it did in the first
   request.

   POST /continue/VGJKPTKC50 HTTP/1.1
   Host: server.example.com
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   The AS retrieves the pending request based on the handle and
   determines that it has not yet been authorized.  The AS indicates to
   the client instance that no access token has yet been issued but it
   can continue to call after another 60 second timeout.

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

   {
       "continue": {
           "access_token": {
               "value": "G7YQT4KQQ5TZY9SLSS5E"
           },
           "uri": "https://server.example.com/continue/ATWHO4Q1WV",
           "wait": 60
       }
   }
   Note that the continuation URL and access token have been rotated
   since they were used by the client instance to make this call.  The
   client instance polls the continuation URL after a 60 second timeout
   using this new information.

   POST /continue/ATWHO4Q1WV HTTP/1.1
   Host: server.example.com
   Authorization: GNAP G7YQT4KQQ5TZY9SLSS5E
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   The AS retrieves the pending request based on the URL and access
   token, determines that it has been approved, and issues an access
   token for the client to use at the RS.

   NOTE: '\' line wrapping per RFC 8792

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

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [
               "dolphin-metadata", "some other thing"
           ]
       }
   }

D.3.  No User Involvement

   In this scenario, the client instance is requesting access on its own
   behalf, with no user to interact with.

   The client instance creates a request to the AS, identifying itself
   with its public key and using MTLS to make the request.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json

   {
       "access_token": {
           "access": [
               "backend service", "nightly-routine-3"
           ],
       },
       "client": {
         "key": {
           "proof": "mtls",
           "cert#S256": "bwcK0esc3ACC3DB2Y5_lESsXE8o9ltc05O89jdN-dg2"
         }
       }
   }

   The AS processes this and determines that the client instance can ask
   for the requested resources and issues an access token.

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

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token",
           "access": [
               "backend service", "nightly-routine-3"
           ]
       }
   }

D.4.  Asynchronous Authorization

   In this scenario, the client instance is requesting on behalf of a
   specific RO, but has no way to interact with the user.  The AS can
   asynchronously reach out to the RO for approval in this scenario.

   The client instance starts the request at the AS by requesting a set
   of resources.  The client instance also identifies a particular user.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               {
                   "type": "photo-api",
                   "actions": [
                       "read",
                       "write",
                       "dolphin"
                   ],
                   "locations": [
                       "https://server.example.net/",
                       "https://resource.local/other"
                   ],
                   "datatypes": [
                       "metadata",
                       "images"
                   ]
               },
               "read", "dolphin-metadata",
               {
                   "type": "financial-transaction",
                   "actions": [
                       "withdraw"
                   ],
                   "identifier": "account-14-32-32-3",
                   "currency": "USD"
               },
               "some other thing"
           ],
       },
       "client": "7C7C4AZ9KHRS6X63AJAO",
       "user": {
           "sub_ids": [ {
               "format": "opaque",
               "id": "J2G8G8O4AZ"
           } ]
      }
   }
   The AS processes this and determines that the RO needs to interact.
   The AS determines that it can reach the identified user
   asynchronously and that the identified user does have the ability to
   approve this request.  The AS indicates to the client instance that
   it can poll for continuation.

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

   {
       "continue": {
           "access_token": {
               "value": "80UPRY5NM33OMUKMKSKU"
           },
           "uri": "https://server.example.com/continue",
           "wait": 60
       }
   }

   The AS reaches out to the RO and prompts them for consent.  In this
   example, the AS has an application that it can push notifications in
   to for the specified account.

   Meanwhile, the client instance periodically polls the AS every 60
   seconds at the continuation URL.

   POST /continue HTTP/1.1
   Host: server.example.com
   Authorization: GNAP 80UPRY5NM33OMUKMKSKU
   Signature-Input: sig1=...
   Signature: sig1=...

   The AS retrieves the pending request based on the handle and
   determines that it has not yet been authorized.  The AS indicates to
   the client instance that no access token has yet been issued but it
   can continue to call after another 60 second timeout.

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

   {
       "continue": {
           "access_token": {
               "value": "BI9QNW6V9W3XFJK4R02D"
           },
           "uri": "https://server.example.com/continue",
           "wait": 60
       }
   }

   Note that the continuation handle has been rotated since it was used
   by the client instance to make this call.  The client instance polls
   the continuation URL after a 60 second timeout using the new handle.

   POST /continue HTTP/1.1
   Host: server.example.com
   Authorization: GNAP BI9QNW6V9W3XFJK4R02D
   Signature-Input: sig1=...
   Signature: sig1=...

   The AS retrieves the pending request based on the handle and
   determines that it has been approved and it issues an access token.

   NOTE: '\' line wrapping per RFC 8792

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

   {
       "access_token": {
           "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0",
           "manage": "https://server.example.com/token/PRY5NM33O\
               M4TB8N6BW7OZB8CDFONP219RP1L",
           "access": [
               "dolphin-metadata", "some other thing"
           ]
       }
   }

D.5.  Applying OAuth 2.0 Scopes and Client IDs

   While GNAP is not designed to be directly compatible with OAuth 2.0
   [RFC6749], considerations have been made to enable the use of OAuth
   2.0 concepts and constructs more smoothly within GNAP.

   In this scenario, the client developer has a "client_id" and set of
   "scope" values from their OAuth 2.0 system and wants to apply them to
   the new protocol.  Traditionally, the OAuth 2.0 client developer
   would put their "client_id" and "scope" values as parameters into a
   redirect request to the authorization endpoint.

   NOTE: '\' line wrapping per RFC 8792

   HTTP 302 Found
   Location: https://server.example.com/authorize
     ?client_id=7C7C4AZ9KHRS6X63AJAO
     &scope=read%20write%20dolphin
     &redirect_uri=https://client.example.net/return
     &response_type=code https://server.example.com/authorize\
     ?client_id=7C7C4AZ9KHRS6X63AJAO\
     &scope=read%20write%20dolphin\
     &redirect_uri=https://client.example.net/return\
     &response_type=code\
     &state=123455

   Now the developer wants to make an analogous request to the AS using
   GNAP.  To do so, the client instance makes an HTTP POST and places
   the OAuth 2.0 values in the appropriate places.

   POST /tx HTTP/1.1
   Host: server.example.com
   Content-Type: application/json
   Signature-Input: sig1=...
   Signature: sig1=...
   Digest: sha256=...

   {
       "access_token": {
           "access": [
               "read", "write", "dolphin"
           ],
           "flags": [ "bearer" ]
       },
       "client": "7C7C4AZ9KHRS6X63AJAO",
       "interact": {
           "start": ["redirect"],
           "finish": {
               "method": "redirect",
               "uri": "https://client.example.net/return?state=123455",
               "nonce": "LKLTI25DK82FX4T4QFZC"
           }
       }
   }

   The "client_id" can be used to identify the client instance's keys
   that it uses for authentication, the scopes represent resources that
   the client instance is requesting, and the "redirect_uri" and "state"
   value are pre-combined into a "finish" URI that can be unique per
   request.  The client instance additionally creates a nonce to protect
   the callback, separate from the state parameter that it has added to
   its return URL.

   From here, the protocol continues as above.

Appendix E.  JSON Structures and Polymorphism

   GNAP makes use of polymorphism within the JSON [RFC8259] structures
   used for the protocol.  Each portion of this protocol is defined in
   terms of the JSON data type that its values can take, whether it's a
   string, object, array, boolean, or number.  For some fields,
   different data types offer different descriptive capabilities and are
   used in different situations for the same field.  Each data type
   provides a different syntax to express the same underlying semantic
   protocol element, which allows for optimization and simplification in
   many common cases.

   Even though JSON is often used to describe strongly typed structures,
   JSON on its own is naturally polymorphic.  In JSON, the named members
   of an object have no type associated with them, and any data type can
   be used as the value for any member.  In practice, each member has a
   semantic type that needs to make sense to the parties creating and
   consuming the object.  Within this protocol, each object member is
   defined in terms of its semantic content, and this semantic content
   might have expressions in different concrete data types for different
   specific purposes.  Since each object member has exactly one value in
   JSON, each data type for an object member field is naturally mutually
   exclusive with other data types within a single JSON object.

   For example, a resource request for a single access token is composed
   of an array of resource request descriptions while a request for
   multiple access tokens is composed of an object whose member values
   are all arrays.  Both of these represent requests for access, but the
   difference in syntax allows the client instance and AS to
   differentiate between the two request types in the same request.

   Another form of polymorphism in JSON comes from the fact that the
   values within JSON arrays need not all be of the same JSON data type.
   However, within this protocol, each element within the array needs to
   be of the same kind of semantic element for the collection to make
   sense, even when the data types are different from each other.

   For example, each aspect of a resource request can be described using
   an object with multiple dimensional components, or the aspect can be
   requested using a string.  In both cases, the resource request is
   being described in a way that the AS needs to interpret, but with
   different levels of specificity and complexity for the client
   instance to deal with.  An API designer can provide a set of common
   access scopes as simple strings but still allow client software
   developers to specify custom access when needed for more complex
   APIs.

   Extensions to this specification can use different data types for
   defined fields, but each extension needs to not only declare what the
   data type means, but also provide justification for the data type
   representing the same basic kind of thing it extends.  For example,
   an extension declaring an "array" representation for a field would
   need to explain how the array represents something akin to the non-
   array element that it is replacing.

Authors' Addresses

   Justin Richer (editor)
   Bespoke Engineering
   Email: ietf@justin.richer.org
   URI:   https://bspk.io/

   Aaron Parecki
   Okta

   Email: aaron@parecki.com
   URI:   https://aaronparecki.com

   Fabien Imbault
   acert.io

   Email: fabien.imbault@acert.io
   URI:   https://acert.io/