idnits 2.17.1 draft-ietf-ace-oauth-authz-44.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == There are 2 instances of lines with non-ascii characters in the document. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (24 August 2021) is 976 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-16) exists of draft-ietf-ace-oauth-params-15 ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) ** Obsolete normative reference: RFC 8152 (Obsoleted by RFC 9052, RFC 9053) -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) Summary: 2 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 ACE Working Group L. Seitz 3 Internet-Draft Combitech 4 Intended status: Standards Track G. Selander 5 Expires: 25 February 2022 Ericsson 6 E. Wahlstroem 8 S. Erdtman 9 Spotify AB 10 H. Tschofenig 11 Arm Ltd. 12 24 August 2021 14 Authentication and Authorization for Constrained Environments (ACE) 15 using the OAuth 2.0 Framework (ACE-OAuth) 16 draft-ietf-ace-oauth-authz-44 18 Abstract 20 This specification defines a framework for authentication and 21 authorization in Internet of Things (IoT) environments called ACE- 22 OAuth. The framework is based on a set of building blocks including 23 OAuth 2.0 and the Constrained Application Protocol (CoAP), thus 24 transforming a well-known and widely used authorization solution into 25 a form suitable for IoT devices. Existing specifications are used 26 where possible, but extensions are added and profiles are defined to 27 better serve the IoT use cases. 29 Status of This Memo 31 This Internet-Draft is submitted in full conformance with the 32 provisions of BCP 78 and BCP 79. 34 Internet-Drafts are working documents of the Internet Engineering 35 Task Force (IETF). Note that other groups may also distribute 36 working documents as Internet-Drafts. The list of current Internet- 37 Drafts is at https://datatracker.ietf.org/drafts/current/. 39 Internet-Drafts are draft documents valid for a maximum of six months 40 and may be updated, replaced, or obsoleted by other documents at any 41 time. It is inappropriate to use Internet-Drafts as reference 42 material or to cite them other than as "work in progress." 44 This Internet-Draft will expire on 25 February 2022. 46 Copyright Notice 48 Copyright (c) 2021 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 53 license-info) in effect on the date of publication of this document. 54 Please review these documents carefully, as they describe your rights 55 and restrictions with respect to this document. Code Components 56 extracted from this document must include Simplified BSD License text 57 as described in Section 4.e of the Trust Legal Provisions and are 58 provided without warranty as described in the Simplified BSD License. 60 Table of Contents 62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 63 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 64 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 6 65 3.1. OAuth 2.0 . . . . . . . . . . . . . . . . . . . . . . . . 7 66 3.2. CoAP . . . . . . . . . . . . . . . . . . . . . . . . . . 10 67 4. Protocol Interactions . . . . . . . . . . . . . . . . . . . . 11 68 5. Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 14 69 5.1. Discovering Authorization Servers . . . . . . . . . . . . 16 70 5.2. Unauthorized Resource Request Message . . . . . . . . . . 16 71 5.3. AS Request Creation Hints . . . . . . . . . . . . . . . . 17 72 5.3.1. The Client-Nonce Parameter . . . . . . . . . . . . . 19 73 5.4. Authorization Grants . . . . . . . . . . . . . . . . . . 20 74 5.5. Client Credentials . . . . . . . . . . . . . . . . . . . 20 75 5.6. AS Authentication . . . . . . . . . . . . . . . . . . . . 21 76 5.7. The Authorization Endpoint . . . . . . . . . . . . . . . 21 77 5.8. The Token Endpoint . . . . . . . . . . . . . . . . . . . 21 78 5.8.1. Client-to-AS Request . . . . . . . . . . . . . . . . 22 79 5.8.2. AS-to-Client Response . . . . . . . . . . . . . . . . 25 80 5.8.3. Error Response . . . . . . . . . . . . . . . . . . . 27 81 5.8.4. Request and Response Parameters . . . . . . . . . . . 28 82 5.8.4.1. Grant Type . . . . . . . . . . . . . . . . . . . 28 83 5.8.4.2. Token Type . . . . . . . . . . . . . . . . . . . 29 84 5.8.4.3. Profile . . . . . . . . . . . . . . . . . . . . . 29 85 5.8.4.4. Client-Nonce . . . . . . . . . . . . . . . . . . 30 86 5.8.5. Mapping Parameters to CBOR . . . . . . . . . . . . . 30 87 5.9. The Introspection Endpoint . . . . . . . . . . . . . . . 31 88 5.9.1. Introspection Request . . . . . . . . . . . . . . . . 32 89 5.9.2. Introspection Response . . . . . . . . . . . . . . . 33 90 5.9.3. Error Response . . . . . . . . . . . . . . . . . . . 34 91 5.9.4. Mapping Introspection Parameters to CBOR . . . . . . 35 92 5.10. The Access Token . . . . . . . . . . . . . . . . . . . . 36 93 5.10.1. The Authorization Information Endpoint . . . . . . . 36 94 5.10.1.1. Verifying an Access Token . . . . . . . . . . . 38 95 5.10.1.2. Protecting the Authorization Information 96 Endpoint . . . . . . . . . . . . . . . . . . . . . 39 97 5.10.2. Client Requests to the RS . . . . . . . . . . . . . 40 98 5.10.3. Token Expiration . . . . . . . . . . . . . . . . . . 41 99 5.10.4. Key Expiration . . . . . . . . . . . . . . . . . . . 42 100 6. Security Considerations . . . . . . . . . . . . . . . . . . . 43 101 6.1. Protecting Tokens . . . . . . . . . . . . . . . . . . . . 43 102 6.2. Communication Security . . . . . . . . . . . . . . . . . 44 103 6.3. Long-Term Credentials . . . . . . . . . . . . . . . . . . 44 104 6.4. Unprotected AS Request Creation Hints . . . . . . . . . . 45 105 6.5. Minimal Security Requirements for Communication . . . . . 45 106 6.6. Token Freshness and Expiration . . . . . . . . . . . . . 46 107 6.7. Combining Profiles . . . . . . . . . . . . . . . . . . . 47 108 6.8. Unprotected Information . . . . . . . . . . . . . . . . . 47 109 6.9. Identifying Audiences . . . . . . . . . . . . . . . . . . 48 110 6.10. Denial of Service Against or with Introspection . . . . . 49 111 7. Privacy Considerations . . . . . . . . . . . . . . . . . . . 49 112 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 50 113 8.1. ACE Authorization Server Request Creation Hints . . . . . 50 114 8.2. CoRE Resource Type Registry . . . . . . . . . . . . . . . 51 115 8.3. OAuth Extensions Error Registration . . . . . . . . . . . 51 116 8.4. OAuth Error Code CBOR Mappings Registry . . . . . . . . . 52 117 8.5. OAuth Grant Type CBOR Mappings . . . . . . . . . . . . . 52 118 8.6. OAuth Access Token Types . . . . . . . . . . . . . . . . 53 119 8.7. OAuth Access Token Type CBOR Mappings . . . . . . . . . . 53 120 8.7.1. Initial Registry Contents . . . . . . . . . . . . . . 53 121 8.8. ACE Profile Registry . . . . . . . . . . . . . . . . . . 54 122 8.9. OAuth Parameter Registration . . . . . . . . . . . . . . 54 123 8.10. OAuth Parameters CBOR Mappings Registry . . . . . . . . . 54 124 8.11. OAuth Introspection Response Parameter Registration . . . 55 125 8.12. OAuth Token Introspection Response CBOR Mappings 126 Registry . . . . . . . . . . . . . . . . . . . . . . . . 56 127 8.13. JSON Web Token Claims . . . . . . . . . . . . . . . . . . 56 128 8.14. CBOR Web Token Claims . . . . . . . . . . . . . . . . . . 57 129 8.15. Media Type Registrations . . . . . . . . . . . . . . . . 58 130 8.16. CoAP Content-Format Registry . . . . . . . . . . . . . . 58 131 8.17. Expert Review Instructions . . . . . . . . . . . . . . . 59 132 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 60 133 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 60 134 10.1. Normative References . . . . . . . . . . . . . . . . . . 60 135 10.2. Informative References . . . . . . . . . . . . . . . . . 63 136 Appendix A. Design Justification . . . . . . . . . . . . . . . . 66 137 Appendix B. Roles and Responsibilities . . . . . . . . . . . . . 69 138 Appendix C. Requirements on Profiles . . . . . . . . . . . . . . 71 139 Appendix D. Assumptions on AS Knowledge about C and RS . . . . . 72 140 Appendix E. Differences to OAuth 2.0 . . . . . . . . . . . . . . 73 141 Appendix F. Deployment Examples . . . . . . . . . . . . . . . . 73 142 F.1. Local Token Validation . . . . . . . . . . . . . . . . . 74 143 F.2. Introspection Aided Token Validation . . . . . . . . . . 78 144 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 82 146 1. Introduction 148 Authorization is the process for granting approval to an entity to 149 access a generic resource [RFC4949]. The authorization task itself 150 can best be described as granting access to a requesting client, for 151 a resource hosted on a device, the resource server (RS). This 152 exchange is mediated by one or multiple authorization servers (AS). 153 Managing authorization for a large number of devices and users can be 154 a complex task. 156 While prior work on authorization solutions for the Web and for the 157 mobile environment also applies to the Internet of Things (IoT) 158 environment, many IoT devices are constrained, for example, in terms 159 of processing capabilities, available memory, etc. For such devices 160 the Constrained Application Protocol (CoAP) [RFC7252] can alleviate 161 some resource concerns when used instead of HTTP to implement the 162 communication flows of this specification. 164 Appendix A gives an overview of the constraints considered in this 165 design, and a more detailed treatment of constraints can be found in 166 [RFC7228]. This design aims to accommodate different IoT deployments 167 and thus a continuous range of device and network capabilities. 168 Taking energy consumption as an example: At one end there are energy- 169 harvesting or battery powered devices which have a tight power 170 budget, on the other end there are mains-powered devices, and all 171 levels in between. 173 Hence, IoT devices may be very different in terms of available 174 processing and message exchange capabilities and there is a need to 175 support many different authorization use cases [RFC7744]. 177 This specification describes a framework for authentication and 178 authorization in constrained environments (ACE) built on re-use of 179 OAuth 2.0 [RFC6749], thereby extending authorization to Internet of 180 Things devices. This specification contains the necessary building 181 blocks for adjusting OAuth 2.0 to IoT environments. 183 Profiles of this framework are available in separate specifications, 184 such as [I-D.ietf-ace-dtls-authorize] or 185 [I-D.ietf-ace-oscore-profile]. Such profiles may specify the use of 186 the framework for a specific security protocol and the underlying 187 transports for use in a specific deployment environment to improve 188 interoperability. Implementations may claim conformance with a 189 specific profile, whereby implementations utilizing the same profile 190 interoperate, while implementations of different profiles are not 191 expected to be interoperable. More powerful devices, such as mobile 192 phones and tablets, may implement multiple profiles and will 193 therefore be able to interact with a wider range of constrained 194 devices. Requirements on profiles are described at contextually 195 appropriate places throughout this specification, and also summarized 196 in Appendix C. 198 2. Terminology 200 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 201 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 202 "OPTIONAL" in this document are to be interpreted as described in BCP 203 14 [RFC2119] [RFC8174] when, and only when, they appear in all 204 capitals, as shown here. 206 Certain security-related terms such as "authentication", 207 "authorization", "confidentiality", "(data) integrity", "message 208 authentication code", and "verify" are taken from [RFC4949]. 210 Since exchanges in this specification are described as RESTful 211 protocol interactions, HTTP [RFC7231] offers useful terminology. 213 Terminology for entities in the architecture is defined in OAuth 2.0 214 [RFC6749] such as client (C), resource server (RS), and authorization 215 server (AS). 217 Note that the term "endpoint" is used here following its OAuth 218 definition, which is to denote resources such as token and 219 introspection at the AS and authz-info at the RS (see Section 5.10.1 220 for a definition of the authz-info endpoint). The CoAP [RFC7252] 221 definition, which is "An entity participating in the CoAP protocol" 222 is not used in this specification. 224 The specifications in this document is called the "framework" or "ACE 225 framework". When referring to "profiles of this framework" it refers 226 to additional specifications that define the use of this 227 specification with concrete transport and communication security 228 protocols (e.g., CoAP over DTLS). 230 The term "Access Information" is used for parameters, other than the 231 access token, provided to the client by the AS to enable it to access 232 the RS (e.g. public key of the RS, profile supported by RS). 234 The term "Authorization Information" is used to denote all 235 information, including the claims of relevant access tokens, that an 236 RS uses to determine whether an access request should be granted. 238 3. Overview 240 This specification defines the ACE framework for authorization in the 241 Internet of Things environment. It consists of a set of building 242 blocks. 244 The basic block is the OAuth 2.0 [RFC6749] framework, which enjoys 245 widespread deployment. Many IoT devices can support OAuth 2.0 246 without any additional extensions, but for certain constrained 247 settings additional profiling is needed. 249 Another building block is the lightweight web transfer protocol CoAP 250 [RFC7252], for those communication environments where HTTP is not 251 appropriate. CoAP typically runs on top of UDP, which further 252 reduces overhead and message exchanges. While this specification 253 defines extensions for the use of OAuth over CoAP, other underlying 254 protocols are not prohibited from being supported in the future, such 255 as HTTP/2 [RFC7540], Message Queuing Telemetry Transport (MQTT) 256 [MQTT5.0], Bluetooth Low Energy (BLE) [BLE] and QUIC 257 [I-D.ietf-quic-transport]. Note that this document specifies 258 protocol exchanges in terms of RESTful verbs such as GET and POST. 259 Future profiles using protocols that do not support these verbs MUST 260 specify how the corresponding protocol messages are transmitted 261 instead. 263 A third building block is the Concise Binary Object Representation 264 (CBOR) [RFC8949], for encodings where JSON [RFC8259] is not 265 sufficiently compact. CBOR is a binary encoding designed for small 266 code and message size. Self-contained tokens and protocol message 267 payloads are encoded in CBOR when CoAP is used. When CoAP is not 268 used, the use of CBOR remains RECOMMENDED. 270 A fourth building block is CBOR Object Signing and Encryption (COSE) 271 [RFC8152], which enables object-level layer security as an 272 alternative or complement to transport layer security (DTLS [RFC6347] 273 or TLS [RFC8446]). COSE is used to secure self-contained tokens such 274 as proof-of-possession (PoP) tokens, which are an extension to the 275 OAuth bearer tokens. The default token format is defined in CBOR Web 276 Token (CWT) [RFC8392]. Application-layer security for CoAP using 277 COSE can be provided with OSCORE [RFC8613]. 279 With the building blocks listed above, solutions satisfying various 280 IoT device and network constraints are possible. A list of 281 constraints is described in detail in [RFC7228] and a description of 282 how the building blocks mentioned above relate to the various 283 constraints can be found in Appendix A. 285 Luckily, not every IoT device suffers from all constraints. The ACE 286 framework nevertheless takes all these aspects into account and 287 allows several different deployment variants to co-exist, rather than 288 mandating a one-size-fits-all solution. It is important to cover the 289 wide range of possible interworking use cases and the different 290 requirements from a security point of view. Once IoT deployments 291 mature, popular deployment variants will be documented in the form of 292 ACE profiles. 294 3.1. OAuth 2.0 296 The OAuth 2.0 authorization framework enables a client to obtain 297 scoped access to a resource with the permission of a resource owner. 298 Authorization information, or references to it, is passed between the 299 nodes using access tokens. These access tokens are issued to clients 300 by an authorization server with the approval of the resource owner. 301 The client uses the access token to access the protected resources 302 hosted by the resource server. 304 A number of OAuth 2.0 terms are used within this specification: 306 Access Tokens: 307 Access tokens are credentials needed to access protected 308 resources. An access token is a data structure representing 309 authorization permissions issued by the AS to the client. Access 310 tokens are generated by the AS and consumed by the RS. The access 311 token content is opaque to the client. 313 Access tokens can have different formats, and various methods of 314 utilization e.g., cryptographic properties) based on the security 315 requirements of the given deployment. 317 Introspection: 318 Introspection is a method for a resource server or potentially a 319 client, to query the authorization server for the active state and 320 content of a received access token. This is particularly useful 321 in those cases where the authorization decisions are very dynamic 322 and/or where the received access token itself is an opaque 323 reference rather than a self-contained token. More information 324 about introspection in OAuth 2.0 can be found in [RFC7662]. 326 Refresh Tokens: 327 Refresh tokens are credentials used to obtain access tokens. 328 Refresh tokens are issued to the client by the authorization 329 server and are used to obtain a new access token when the current 330 access token expires, or to obtain additional access tokens with 331 identical or narrower scope (such access tokens may have a shorter 332 lifetime and fewer permissions than authorized by the resource 333 owner). Issuing a refresh token is optional at the discretion of 334 the authorization server. If the authorization server issues a 335 refresh token, it is included when issuing an access token (i.e., 336 step (B) in Figure 1). 338 A refresh token in OAuth 2.0 is a string representing the 339 authorization granted to the client by the resource owner. The 340 string is usually opaque to the client. The token denotes an 341 identifier used to retrieve the authorization information. Unlike 342 access tokens, refresh tokens are intended for use only with 343 authorization servers and are never sent to resource servers. In 344 this framework, refresh tokens are encoded in binary instead of 345 strings, if used. 347 Proof of Possession Tokens: 348 A token may be bound to a cryptographic key, which is then used to 349 bind the token to a request authorized by the token. Such tokens 350 are called proof-of-possession tokens (or PoP tokens). 352 The proof-of-possession security concept used here assumes that 353 the AS acts as a trusted third party that binds keys to tokens. 354 In the case of access tokens, these so called PoP keys are then 355 used by the client to demonstrate the possession of the secret to 356 the RS when accessing the resource. The RS, when receiving an 357 access token, needs to verify that the key used by the client 358 matches the one bound to the access token. When this 359 specification uses the term "access token" it is assumed to be a 360 PoP access token unless specifically stated otherwise. 362 The key bound to the token (the PoP key) may use either symmetric 363 or asymmetric cryptography. The appropriate choice of the kind of 364 cryptography depends on the constraints of the IoT devices as well 365 as on the security requirements of the use case. 367 Symmetric PoP key: 368 The AS generates a random symmetric PoP key. The key is either 369 stored to be returned on introspection calls or included in the 370 token. Either the whole token or only the key MUST be 371 encrypted in the latter case. The PoP key is also returned to 372 client together with the token. 374 Asymmetric PoP key: 375 An asymmetric key pair is generated by the client and the 376 public key is sent to the AS (if it does not already have 377 knowledge of the client's public key). Information about the 378 public key, which is the PoP key in this case, is either stored 379 to be returned on introspection calls or included inside the 380 token and sent back to the client. The resource server 381 consuming the token can identify the public key from the 382 information in the token, which allows the client to use the 383 corresponding private key for the proof of possession. 385 The token is either a simple reference, or a structured 386 information object (e.g., CWT [RFC8392]) protected by a 387 cryptographic wrapper (e.g., COSE [RFC8152]). The choice of PoP 388 key does not necessarily imply a specific credential type for the 389 integrity protection of the token. 391 Scopes and Permissions: 392 In OAuth 2.0, the client specifies the type of permissions it is 393 seeking to obtain (via the scope parameter) in the access token 394 request. In turn, the AS may use the scope response parameter to 395 inform the client of the scope of the access token issued. As the 396 client could be a constrained device as well, this specification 397 defines the use of CBOR encoding, see Section 5, for such requests 398 and responses. 400 The values of the scope parameter in OAuth 2.0 are expressed as a 401 list of space-delimited, case-sensitive strings, with a semantic 402 that is well-known to the AS and the RS. More details about the 403 concept of scopes is found under Section 3.3 in [RFC6749]. 405 Claims: 406 Information carried in the access token or returned from 407 introspection, called claims, is in the form of name-value pairs. 408 An access token may, for example, include a claim identifying the 409 AS that issued the token (via the "iss" claim) and what audience 410 the access token is intended for (via the "aud" claim). The 411 audience of an access token can be a specific resource or one or 412 many resource servers. The resource owner policies influence what 413 claims are put into the access token by the authorization server. 415 While the structure and encoding of the access token varies 416 throughout deployments, a standardized format has been defined 417 with the JSON Web Token (JWT) [RFC7519] where claims are encoded 418 as a JSON object. In [RFC8392] the CBOR Web Token (CWT) has been 419 defined as an equivalent format using CBOR encoding. 421 The token and introspection Endpoints: 423 The AS hosts the token endpoint that allows a client to request 424 access tokens. The client makes a POST request to the token 425 endpoint on the AS and receives the access token in the response 426 (if the request was successful). 428 In some deployments, a token introspection endpoint is provided by 429 the AS, which can be used by the RS and potentially the client, if 430 they need to request additional information regarding a received 431 access token. The requesting entity makes a POST request to the 432 introspection endpoint on the AS and receives information about 433 the access token in the response. (See "Introspection" above.) 435 3.2. CoAP 437 CoAP is an application-layer protocol similar to HTTP, but 438 specifically designed for constrained environments. CoAP typically 439 uses datagram-oriented transport, such as UDP, where reordering and 440 loss of packets can occur. A security solution needs to take the 441 latter aspects into account. 443 While HTTP uses headers and query strings to convey additional 444 information about a request, CoAP encodes such information into 445 header parameters called 'options'. 447 CoAP supports application-layer fragmentation of the CoAP payloads 448 through blockwise transfers [RFC7959]. However, blockwise transfer 449 does not increase the size limits of CoAP options, therefore data 450 encoded in options has to be kept small. 452 Transport layer security for CoAP can be provided by DTLS or TLS 453 [RFC6347][RFC8446] [I-D.ietf-tls-dtls13]. CoAP defines a number of 454 proxy operations that require transport layer security to be 455 terminated at the proxy. One approach for protecting CoAP 456 communication end-to-end through proxies, and also to support 457 security for CoAP over a different transport in a uniform way, is to 458 provide security at the application layer using an object-based 459 security mechanism such as COSE [RFC8152]. 461 One application of COSE is OSCORE [RFC8613], which provides end-to- 462 end confidentiality, integrity and replay protection, and a secure 463 binding between CoAP request and response messages. In OSCORE, the 464 CoAP messages are wrapped in COSE objects and sent using CoAP. 466 In this framework the use of CoAP as replacement for HTTP is 467 RECOMMENDED for use in constrained environments. For communication 468 security this framework does not make an explicit protocol 469 recommendation, since the choice depends on the requirements of the 470 specific application. DTLS [RFC6347], [I-D.ietf-tls-dtls13] and 471 OSCORE [RFC8613] are mentioned as examples, other protocols 472 fulfilling the requirements from Section 6.5 are also applicable. 474 4. Protocol Interactions 476 The ACE framework is based on the OAuth 2.0 protocol interactions 477 using the token endpoint and optionally the introspection endpoint. 478 A client obtains an access token, and optionally a refresh token, 479 from an AS using the token endpoint and subsequently presents the 480 access token to an RS to gain access to a protected resource. In 481 most deployments the RS can process the access token locally, however 482 in some cases the RS may present it to the AS via the introspection 483 endpoint to get fresh information. These interactions are shown in 484 Figure 1. An overview of various OAuth concepts is provided in 485 Section 3.1. 487 +--------+ +---------------+ 488 | |---(A)-- Token Request ------->| | 489 | | | Authorization | 490 | |<--(B)-- Access Token ---------| Server | 491 | | + Access Information | | 492 | | + Refresh Token (optional) +---------------+ 493 | | ^ | 494 | | Introspection Request (D)| | 495 | Client | Response | |(E) 496 | | (optional exchange) | | 497 | | | v 498 | | +--------------+ 499 | |---(C)-- Token + Request ----->| | 500 | | | Resource | 501 | |<--(F)-- Protected Resource ---| Server | 502 | | | | 503 +--------+ +--------------+ 505 Figure 1: Basic Protocol Flow. 507 Requesting an Access Token (A): 508 The client makes an access token request to the token endpoint at 509 the AS. This framework assumes the use of PoP access tokens (see 510 Section 3.1 for a short description) wherein the AS binds a key to 511 an access token. The client may include permissions it seeks to 512 obtain, and information about the credentials it wants to use for 513 proof-of-possession (e.g., symmetric/asymmetric cryptography or a 514 reference to a specific key) of the access token. 516 Access Token Response (B): 518 If the request from the client has been successfully verified, 519 authenticated, and authorized, the AS returns an access token and 520 optionally a refresh token. Note that only certain grant types 521 support refresh tokens. The AS can also return additional 522 parameters, referred to as "Access Information". In addition to 523 the response parameters defined by OAuth 2.0 and the PoP access 524 token extension, this framework defines parameters that can be 525 used to inform the client about capabilities of the RS, e.g. the 526 profile the RS supports. More information about these parameters 527 can be found in Section 5.8.4. 529 Resource Request (C): 530 The client interacts with the RS to request access to the 531 protected resource and provides the access token. The protocol to 532 use between the client and the RS is not restricted to CoAP. 533 HTTP, HTTP/2 [RFC7540], QUIC [I-D.ietf-quic-transport], MQTT 534 [MQTT5.0], Bluetooth Low Energy [BLE], etc., are also viable 535 candidates. 537 Depending on the device limitations and the selected protocol, 538 this exchange may be split up into two parts: 540 (1) the client sends the access token containing, or 541 referencing, the authorization information to the RS, that will 542 be used for subsequent resource requests by the client, and 544 (2) the client makes the resource access request, using the 545 communication security protocol and other Access Information 546 obtained from the AS. 548 The client and the RS mutually authenticate using the security 549 protocol specified in the profile (see step B) and the keys 550 obtained in the access token or the Access Information. The RS 551 verifies that the token is integrity protected and originated by 552 the AS. It then compares the claims contained in the access token 553 with the resource request. If the RS is online, validation can be 554 handed over to the AS using token introspection (see messages D 555 and E) over HTTP or CoAP. 557 Token Introspection Request (D): 558 A resource server may be configured to introspect the access token 559 by including it in a request to the introspection endpoint at that 560 AS. Token introspection over CoAP is defined in Section 5.9 and 561 for HTTP in [RFC7662]. 563 Note that token introspection is an optional step and can be 564 omitted if the token is self-contained and the resource server is 565 prepared to perform the token validation on its own. 567 Token Introspection Response (E): 568 The AS validates the token and returns the most recent parameters, 569 such as scope, audience, validity etc. associated with it back to 570 the RS. The RS then uses the received parameters to process the 571 request to either accept or to deny it. 573 Protected Resource (F): 574 If the request from the client is authorized, the RS fulfills the 575 request and returns a response with the appropriate response code. 576 The RS uses the dynamically established keys to protect the 577 response, according to the communication security protocol used. 579 The OAuth 2.0 framework defines a number of "protocol flows" via 580 grant types, which have been extended further with extensions to 581 OAuth 2.0 (such as [RFC7521] and [RFC8628]). What grant type works 582 best depends on the usage scenario and [RFC7744] describes many 583 different IoT use cases but there are two grant types that cover a 584 majority of these scenarios, namely the Authorization Code Grant 585 (described in Section 4.1 of [RFC7521]) and the Client Credentials 586 Grant (described in Section 4.4 of [RFC7521]). The Authorization 587 Code Grant is a good fit for use with apps running on smart phones 588 and tablets that request access to IoT devices, a common scenario in 589 the smart home environment, where users need to go through an 590 authentication and authorization phase (at least during the initial 591 setup phase). The native apps guidelines described in [RFC8252] are 592 applicable to this use case. The Client Credential Grant is a good 593 fit for use with IoT devices where the OAuth client itself is 594 constrained. In such a case, the resource owner has pre-arranged 595 access rights for the client with the authorization server, which is 596 often accomplished using a commissioning tool. 598 The consent of the resource owner, for giving a client access to a 599 protected resource, can be provided dynamically as in the traditional 600 OAuth flows, or it could be pre-configured by the resource owner as 601 authorization policies at the AS, which the AS evaluates when a token 602 request arrives. The resource owner and the requesting party (i.e., 603 client owner) are not shown in Figure 1. 605 This framework supports a wide variety of communication security 606 mechanisms between the ACE entities, such as client, AS, and RS. It 607 is assumed that the client has been registered (also called enrolled 608 or onboarded) to an AS using a mechanism defined outside the scope of 609 this document. In practice, various techniques for onboarding have 610 been used, such as factory-based provisioning or the use of 611 commissioning tools. Regardless of the onboarding technique, this 612 provisioning procedure implies that the client and the AS exchange 613 credentials and configuration parameters. These credentials are used 614 to mutually authenticate each other and to protect messages exchanged 615 between the client and the AS. 617 It is also assumed that the RS has been registered with the AS, 618 potentially in a similar way as the client has been registered with 619 the AS. Established keying material between the AS and the RS allows 620 the AS to apply cryptographic protection to the access token to 621 ensure that its content cannot be modified, and if needed, that the 622 content is confidentiality protected. Confidentiality protection of 623 the access token content would be provided on top of confidentiality 624 protection via a communication security protocol. 626 The keying material necessary for establishing communication security 627 between C and RS is dynamically established as part of the protocol 628 described in this document. 630 At the start of the protocol, there is an optional discovery step 631 where the client discovers the resource server and the resources this 632 server hosts. In this step, the client might also determine what 633 permissions are needed to access the protected resource. A generic 634 procedure is described in Section 5.1; profiles MAY define other 635 procedures for discovery. 637 In Bluetooth Low Energy, for example, advertisements are broadcast by 638 a peripheral, including information about the primary services. In 639 CoAP, as a second example, a client can make a request to "/.well- 640 known/core" to obtain information about available resources, which 641 are returned in a standardized format as described in [RFC6690]. 643 5. Framework 645 The following sections detail the profiling and extensions of OAuth 646 2.0 for constrained environments, which constitutes the ACE 647 framework. 649 Credential Provisioning 650 In constrained environments it cannot be assumed that the client 651 and the RS are part of a common key infrastructure. Therefore, 652 the AS provisions credentials and associated information to allow 653 mutual authentication between the client and the RS. The 654 resulting security association between the client and the RS may 655 then also be used to bind these credentials to the access tokens 656 the client uses. 658 Proof-of-Possession 659 The ACE framework, by default, implements proof-of-possession for 660 access tokens, i.e., that the token holder can prove being a 661 holder of the key bound to the token. The binding is provided by 662 the "cnf" claim [RFC8747] indicating what key is used for proof- 663 of-possession. If a client needs to submit a new access token, 664 e.g., to obtain additional access rights, they can request that 665 the AS binds this token to the same key as the previous one. 667 ACE Profiles 668 The client or RS may be limited in the encodings or protocols it 669 supports. To support a variety of different deployment settings, 670 specific interactions between client and RS are defined in an ACE 671 profile. In ACE framework the AS is expected to manage the 672 matching of compatible profile choices between a client and an RS. 673 The AS informs the client of the selected profile using the 674 "ace_profile" parameter in the token response. 676 OAuth 2.0 requires the use of TLS both to protect the communication 677 between AS and client when requesting an access token; between client 678 and RS when accessing a resource and between AS and RS if 679 introspection is used. In constrained settings TLS is not always 680 feasible, or desirable. Nevertheless it is REQUIRED that the 681 communications named above are encrypted, integrity protected and 682 protected against message replay. It is also REQUIRED that the 683 communicating endpoints perform mutual authentication. Furthermore 684 it MUST be assured that responses are bound to the requests in the 685 sense that the receiver of a response can be certain that the 686 response actually belongs to a certain request. Note that setting up 687 such a secure communication may require some unprotected messages to 688 be exchanged first (e.g. sending the token from the client to the 689 RS). 691 Profiles MUST specify a communication security protocol between 692 client and RS that provides the features required above. Profiles 693 MUST specify a communication security protocol RECOMMENDED to be used 694 between client and AS that provides the features required above. 695 Profiles MUST specify for introspection a communication security 696 protocol RECOMMENDED to be used between RS and AS that provides the 697 features required above. These recommendations enable 698 interoperability between different implementations without the need 699 to define a new profile if the communication between C and AS, or 700 between RS and AS, is protected with a different security protocol 701 complying with the security requirements above. 703 In OAuth 2.0 the communication with the Token and the Introspection 704 endpoints at the AS is assumed to be via HTTP and may use Uri-query 705 parameters. When profiles of this framework use CoAP instead, it is 706 REQUIRED to use of the following alternative instead of Uri-query 707 parameters: The sender (client or RS) encodes the parameters of its 708 request as a CBOR map and submits that map as the payload of the POST 709 request. The CBOR encoding for a number of OAuth 2.0 parameters is 710 specified in this document, if a profile needs to use other OAuth 2.0 711 parameters with CoAP it MUST specify their CBOR encoding. 713 Profiles that use CBOR encoding of protocol message parameters at the 714 outermost encoding layer MUST use the content format 'application/ 715 ace+cbor'. If CoAP is used for communication, the Content-Format 716 MUST be abbreviated with the ID: 19 (see Section 8.16). 718 The OAuth 2.0 AS uses a JSON structure in the payload of its 719 responses both to client and RS. If CoAP is used, it is REQUIRED to 720 use CBOR [RFC8949] instead of JSON. Depending on the profile, the 721 CBOR payload MAY be enclosed in a non-CBOR cryptographic wrapper. 723 5.1. Discovering Authorization Servers 725 C must discover the AS in charge of RS to determine where to request 726 the access token. To do so, C must 1. find out the AS URI to which 727 the token request message must be sent and 2. MUST validate that the 728 AS with this URI is authorized to provide access tokens for this RS. 730 In order to determine the AS URI, C MAY send an initial Unauthorized 731 Resource Request message to RS. RS then denies the request and sends 732 the address of its AS back to C (see Section 5.2). How C validates 733 the AS authorization is not in scope for this document. C may, e.g., 734 ask its owner if this AS is authorized for this RS. C may also use a 735 mechanism that addresses both problems at once (e.g. by querying a 736 dedicated secure service provided by the client owner) . 738 5.2. Unauthorized Resource Request Message 740 An Unauthorized Resource Request message is a request for any 741 resource hosted by RS for which the client does not have 742 authorization granted. RSes MUST treat any request for a protected 743 resource as an Unauthorized Resource Request message when any of the 744 following hold: 746 * The request has been received on an unsecured channel. 748 * The RS has no valid access token for the sender of the request 749 regarding the requested action on that resource. 751 * The RS has a valid access token for the sender of the request, but 752 that token does not authorize the requested action on the 753 requested resource. 755 Note: These conditions ensure that the RS can handle requests 756 autonomously once access was granted and a secure channel has been 757 established between C and RS. The authz-info endpoint, as part of 758 the process for authorizing to protected resources, is not itself a 759 protected resource and MUST NOT be protected as specified above (cf. 760 Section 5.10.1). 762 Unauthorized Resource Request messages MUST be denied with an 763 "unauthorized_client" error response. In this response, the Resource 764 Server SHOULD provide proper "AS Request Creation Hints" to enable 765 the client to request an access token from RS's AS as described in 766 Section 5.3. 768 The handling of all client requests (including unauthorized ones) by 769 the RS is described in Section 5.10.2. 771 5.3. AS Request Creation Hints 773 The "AS Request Creation Hints" message is sent by an RS as a 774 response to an Unauthorized Resource Request message (see 775 Section 5.2) to help the sender of the Unauthorized Resource Request 776 message acquire a valid access token. The "AS Request Creation 777 Hints" message is a CBOR or JSON map, with an OPTIONAL element "AS" 778 specifying an absolute URI (see Section 4.3 of [RFC3986]) that 779 identifies the appropriate AS for the RS. 781 The message can also contain the following OPTIONAL parameters: 783 * A "audience" element contains an identifier the client should 784 request at the AS, as suggested by the RS. With this parameter, 785 when included in the access token request to the AS, the AS is 786 able to restrict the use of access token to specific RSs. See 787 Section 6.9 for a discussion of this parameter. 789 * A "kid" element containing the key identifier of a key used in an 790 existing security association between the client and the RS. The 791 RS expects the client to request an access token bound to this 792 key, in order to avoid having to re-establish the security 793 association. 795 * A "cnonce" element containing a client-nonce. See Section 5.3.1. 797 * A "scope" element containing the suggested scope that the client 798 should request towards the AS. 800 Figure 2 summarizes the parameters that may be part of the "AS 801 Request Creation Hints". 803 /-----------+----------+---------------------\ 804 | Name | CBOR Key | Value Type | 805 |-----------+----------+---------------------| 806 | AS | 1 | text string | 807 | kid | 2 | byte string | 808 | audience | 5 | text string | 809 | scope | 9 | text or byte string | 810 | cnonce | 39 | byte string | 811 \-----------+----------+---------------------/ 813 Figure 2: AS Request Creation Hints 815 Note that the schema part of the AS parameter may need to be adapted 816 to the security protocol that is used between the client and the AS. 817 Thus the example AS value "coap://as.example.com/token" might need to 818 be transformed to "coaps://as.example.com/token". It is assumed that 819 the client can determine the correct schema part on its own depending 820 on the way it communicates with the AS. 822 Figure 3 shows an example for an "AS Request Creation Hints" message 823 payload using CBOR [RFC8949] diagnostic notation, using the parameter 824 names instead of the CBOR keys for better human readability. 826 4.01 Unauthorized 827 Content-Format: application/ace+cbor 828 Payload : 829 { 830 "AS" : "coaps://as.example.com/token", 831 "audience" : "coaps://rs.example.com" 832 "scope" : "rTempC", 833 "cnonce" : h'e0a156bb3f' 834 } 836 Figure 3: AS Request Creation Hints payload example 838 In the example above, the response parameter "AS" points the receiver 839 of this message to the URI "coaps://as.example.com/token" to request 840 access tokens. The RS sending this response uses an internal clock 841 that is not synchronized with the clock of the AS. Therefore, it can 842 not reliably verify the expiration time of access tokens it receives. 843 To ensure a certain level of access token freshness nevertheless, the 844 RS has included a "cnonce" parameter (see Section 5.3.1) in the 845 response. (The hex-sequence of the cnonce parameter is encoded in 846 CBOR-based notation in this example.) 847 Figure 4 illustrates the mandatory to use binary encoding of the 848 message payload shown in Figure 3. 850 a4 # map(4) 851 01 # unsigned(1) (=AS) 852 78 1c # text(28) 853 636f6170733a2f2f61732e657861 854 6d706c652e636f6d2f746f6b656e # "coaps://as.example.com/token" 855 05 # unsigned(5) (=audience) 856 76 # text(22) 857 636f6170733a2f2f72732e657861 858 6d706c652e636f6d # "coaps://rs.example.com" 859 09 # unsigned(9) (=scope) 860 66 # text(6) 861 7254656d7043 # "rTempC" 862 18 27 # unsigned(39) (=cnonce) 863 45 # bytes(5) 864 e0a156bb3f # 866 Figure 4: AS Request Creation Hints example encoded in CBOR 868 5.3.1. The Client-Nonce Parameter 870 If the RS does not synchronize its clock with the AS, it could be 871 tricked into accepting old access tokens, that are either expired or 872 have been compromised. In order to ensure some level of token 873 freshness in that case, the RS can use the "cnonce" (client-nonce) 874 parameter. The processing requirements for this parameter are as 875 follows: 877 * An RS sending a "cnonce" parameter in an "AS Request Creation 878 Hints" message MUST store information to validate that a given 879 cnonce is fresh. How this is implemented internally is out of 880 scope for this specification. Expiration of client-nonces should 881 be based roughly on the time it would take a client to obtain an 882 access token after receiving the "AS Request Creation Hints" 883 message, with some allowance for unexpected delays. 885 * A client receiving a "cnonce" parameter in an "AS Request Creation 886 Hints" message MUST include this in the parameters when requesting 887 an access token at the AS, using the "cnonce" parameter from 888 Section 5.8.4.4. 890 * If an AS grants an access token request containing a "cnonce" 891 parameter, it MUST include this value in the access token, using 892 the "cnonce" claim specified in Section 5.10. 894 * An RS that is using the client-nonce mechanism and that receives 895 an access token MUST verify that this token contains a cnonce 896 claim, with a client-nonce value that is fresh according to the 897 information stored at the first step above. If the cnonce claim 898 is not present or if the cnonce claim value is not fresh, the RS 899 MUST discard the access token. If this was an interaction with 900 the authz-info endpoint the RS MUST also respond with an error 901 message using a response code equivalent to the CoAP code 4.01 902 (Unauthorized). 904 5.4. Authorization Grants 906 To request an access token, the client obtains authorization from the 907 resource owner or uses its client credentials as a grant. The 908 authorization is expressed in the form of an authorization grant. 910 The OAuth framework [RFC6749] defines four grant types. The grant 911 types can be split up into two groups, those granted on behalf of the 912 resource owner (password, authorization code, implicit) and those for 913 the client (client credentials). Further grant types have been added 914 later, such as [RFC7521] defining an assertion-based authorization 915 grant. 917 The grant type is selected depending on the use case. In cases where 918 the client acts on behalf of the resource owner, the authorization 919 code grant is recommended. If the client acts on behalf of the 920 resource owner, but does not have any display or has very limited 921 interaction possibilities, it is recommended to use the device code 922 grant defined in [RFC8628]. In cases where the client acts 923 autonomously the client credentials grant is recommended. 925 For details on the different grant types, see section 1.3 of 926 [RFC6749]. The OAuth 2.0 framework provides an extension mechanism 927 for defining additional grant types, so profiles of this framework 928 MAY define additional grant types, if needed. 930 5.5. Client Credentials 932 Authentication of the client is mandatory independent of the grant 933 type when requesting an access token from the token endpoint. In the 934 case of the client credentials grant type, the authentication and 935 grant coincide. 937 Client registration and provisioning of client credentials to the 938 client is out of scope for this specification. 940 The OAuth framework defines one client credential type in section 941 2.3.1 of [RFC6749]: client id and client secret. 942 [I-D.erdtman-ace-rpcc] adds raw-public-key and pre-shared-key to the 943 client credentials types. Profiles of this framework MAY extend with 944 an additional client credentials type using client certificates. 946 5.6. AS Authentication 948 The client credential grant does not, by default, authenticate the AS 949 that the client connects to. In classic OAuth, the AS is 950 authenticated with a TLS server certificate. 952 Profiles of this framework MUST specify how clients authenticate the 953 AS and how communication security is implemented. By default, server 954 side TLS certificates, as defined by OAuth 2.0, are required. 956 5.7. The Authorization Endpoint 958 The OAuth 2.0 authorization endpoint is used to interact with the 959 resource owner and obtain an authorization grant, in certain grant 960 flows. The primary use case for the ACE-OAuth framework is for 961 machine-to-machine interactions that do not involve the resource 962 owner in the authorization flow; therefore, this endpoint is out of 963 scope here. Future profiles may define constrained adaptation 964 mechanisms for this endpoint as well. Non-constrained clients 965 interacting with constrained resource servers can use the 966 specification in section 3.1 of [RFC6749] and the attack 967 countermeasures suggested in section 4.2 of [RFC6819]. 969 5.8. The Token Endpoint 971 In standard OAuth 2.0, the AS provides the token endpoint for 972 submitting access token requests. This framework extends the 973 functionality of the token endpoint, giving the AS the possibility to 974 help the client and RS to establish shared keys or to exchange their 975 public keys. Furthermore, this framework defines encodings using 976 CBOR, as a substitute for JSON. 978 The endpoint may also be exposed over HTTPS as in classical OAuth or 979 even other transports. A profile MUST define the details of the 980 mapping between the fields described below, and these transports. If 981 HTTPS is used, the semantics of Sections 4.1.3 and 4.1.4 of the OAuth 982 2.0 specification MUST be followed (with additions as described 983 below). If the CoAP is some other transport with CBOR payload format 984 is supported, the semantics described in this section MUST be 985 followed. 987 For the AS to be able to issue a token, the client MUST be 988 authenticated and present a valid grant for the scopes requested. 989 Profiles of this framework MUST specify how the AS authenticates the 990 client and how the communication between client and AS is protected, 991 fulfilling the requirements specified in Section 5. 993 The default name of this endpoint in an url-path SHOULD be '/token'. 994 However, implementations are not required to use this name and can 995 define their own instead. 997 The figures of this section use CBOR diagnostic notation without the 998 integer abbreviations for the parameters or their values for 999 illustrative purposes. Note that implementations MUST use the 1000 integer abbreviations and the binary CBOR encoding, if the CBOR 1001 encoding is used. 1003 5.8.1. Client-to-AS Request 1005 The client sends a POST request to the token endpoint at the AS. The 1006 profile MUST specify how the communication is protected. The content 1007 of the request consists of the parameters specified in the relevant 1008 subsection of section 4 of the OAuth 2.0 specification [RFC6749], 1009 depending on the grant type, with the following exceptions and 1010 additions: 1012 * The parameter "grant_type" is OPTIONAL in the context of this 1013 framework (as opposed to REQUIRED in RFC6749). If that parameter 1014 is missing, the default value "client_credentials" is implied. 1016 * The "audience" parameter from [RFC8693] is OPTIONAL to request an 1017 access token bound to a specific audience. 1019 * The "cnonce" parameter defined in Section 5.8.4.4 is REQUIRED if 1020 the RS provided a client-nonce in the "AS Request Creation Hints" 1021 message Section 5.3 1023 * The "scope" parameter MAY be encoded as a byte string instead of 1024 the string encoding specified in section 3.3 of [RFC6749], in 1025 order allow compact encoding of complex scopes. The syntax of 1026 such a binary encoding is explicitly not specified here and left 1027 to profiles or applications. Note specifically that a binary 1028 encoded scope does not necessarily use the space character '0x20' 1029 to delimit scope-tokens. 1031 * The client can send an empty (null value) "ace_profile" parameter 1032 to indicate that it wants the AS to include the "ace_profile" 1033 parameter in the response. See Section 5.8.4.3. 1035 * A client MUST be able to use the parameters from 1036 [I-D.ietf-ace-oauth-params] in an access token request to the 1037 token endpoint and the AS MUST be able to process these additional 1038 parameters. 1040 The default behavior, is that the AS generates a symmetric proof-of- 1041 possession key for the client. In order to use an asymmetric key 1042 pair or to re-use a key previously established with the RS, the 1043 client is supposed to use the "req_cnf" parameter from 1044 [I-D.ietf-ace-oauth-params]. 1046 If CoAP is used then these parameters MUST be provided in a CBOR map, 1047 see Figure 12. 1049 When HTTP is used as a transport then the client makes a request to 1050 the token endpoint, the parameters MUST be encoded as defined in 1051 Appendix B of [RFC6749]. 1053 The following examples illustrate different types of requests for 1054 proof-of-possession tokens. 1056 Figure 5 shows a request for a token with a symmetric proof-of- 1057 possession key. The content is displayed in CBOR diagnostic 1058 notation, without abbreviations for better readability. 1060 Header: POST (Code=0.02) 1061 Uri-Host: "as.example.com" 1062 Uri-Path: "token" 1063 Content-Format: "application/ace+cbor" 1064 Payload: 1065 { 1066 "client_id" : "myclient", 1067 "audience" : "tempSensor4711" 1068 } 1070 Figure 5: Example request for an access token bound to a 1071 symmetric key. 1073 Figure 6 shows a request for a token with an asymmetric proof-of- 1074 possession key. Note that in this example OSCORE [RFC8613] is used 1075 to provide object-security, therefore the Content-Format is 1076 "application/oscore" wrapping the "application/ace+cbor" type 1077 content. The OSCORE option has a decoded interpretation appended in 1078 parentheses for the reader's convenience. Also note that in this 1079 example the audience is implicitly known by both client and AS. 1080 Furthermore note that this example uses the "req_cnf" parameter from 1081 [I-D.ietf-ace-oauth-params]. 1083 Header: POST (Code=0.02) 1084 Uri-Host: "as.example.com" 1085 Uri-Path: "token" 1086 OSCORE: 0x09, 0x05, 0x44, 0x6C 1087 (h=0, k=1, n=001, partialIV= 0x05, kid=[0x44, 0x6C]) 1088 Content-Format: "application/oscore" 1089 Payload: 1090 0x44025d1 ... (full payload omitted for brevity) ... 68b3825e 1092 Decrypted payload: 1093 { 1094 "client_id" : "myclient", 1095 "req_cnf" : { 1096 "COSE_Key" : { 1097 "kty" : "EC", 1098 "kid" : h'11', 1099 "crv" : "P-256", 1100 "x" : b64'usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8', 1101 "y" : b64'IBOL+C3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4' 1102 } 1103 } 1104 } 1106 Figure 6: Example token request bound to an asymmetric key. 1108 Figure 7 shows a request for a token where a previously communicated 1109 proof-of-possession key is only referenced using the "req_cnf" 1110 parameter from [I-D.ietf-ace-oauth-params]. 1112 Header: POST (Code=0.02) 1113 Uri-Host: "as.example.com" 1114 Uri-Path: "token" 1115 Content-Format: "application/ace+cbor" 1116 Payload: 1117 { 1118 "client_id" : "myclient", 1119 "audience" : "valve424", 1120 "scope" : "read", 1121 "req_cnf" : { 1122 "kid" : b64'6kg0dXJM13U' 1123 } 1124 } 1126 Figure 7: Example request for an access token bound to a key 1127 reference. 1129 Refresh tokens are typically not stored as securely as proof-of- 1130 possession keys in requesting clients. Proof-of-possession based 1131 refresh token requests MUST NOT request different proof-of-possession 1132 keys or different audiences in token requests. Refresh token 1133 requests can only use to request access tokens bound to the same 1134 proof-of-possession key and the same audience as access tokens issued 1135 in the initial token request. 1137 5.8.2. AS-to-Client Response 1139 If the access token request has been successfully verified by the AS 1140 and the client is authorized to obtain an access token corresponding 1141 to its access token request, the AS sends a response with the 1142 response code equivalent to the CoAP response code 2.01 (Created). 1143 If client request was invalid, or not authorized, the AS returns an 1144 error response as described in Section 5.8.3. 1146 Note that the AS decides which token type and profile to use when 1147 issuing a successful response. It is assumed that the AS has prior 1148 knowledge of the capabilities of the client and the RS (see 1149 Appendix D). This prior knowledge may, for example, be set by the 1150 use of a dynamic client registration protocol exchange [RFC7591]. If 1151 the client has requested a specific proof-of-possession key using the 1152 "req_cnf" parameter from [I-D.ietf-ace-oauth-params], this may also 1153 influence which profile the AS selects, as it needs to support the 1154 use of the key type requested the client. 1156 The content of the successful reply is the Access Information. When 1157 using CoAP, the payload MUST be encoded as a CBOR map, when using 1158 HTTP the encoding is a JSON map as specified in section 5.1 of 1159 [RFC6749]. In both cases the parameters specified in Section 5.1 of 1160 [RFC6749] are used, with the following additions and changes: 1162 ace_profile: 1163 OPTIONAL unless the request included an empty ace_profile 1164 parameter in which case it is MANDATORY. This indicates the 1165 profile that the client MUST use towards the RS. See 1166 Section 5.8.4.3 for the formatting of this parameter. If this 1167 parameter is absent, the AS assumes that the client implicitly 1168 knows which profile to use towards the RS. 1170 token_type: 1171 This parameter is OPTIONAL, as opposed to 'required' in [RFC6749]. 1172 By default implementations of this framework SHOULD assume that 1173 the token_type is "PoP". If a specific use case requires another 1174 token_type (e.g., "Bearer") to be used then this parameter is 1175 REQUIRED. 1177 Furthermore [I-D.ietf-ace-oauth-params] defines additional parameters 1178 that the AS MUST be able to use when responding to a request to the 1179 token endpoint. 1181 Figure 8 summarizes the parameters that can currently be part of the 1182 Access Information. Future extensions may define additional 1183 parameters. 1185 /-------------------+-------------------------------\ 1186 | Parameter name | Specified in | 1187 |-------------------+-------------------------------| 1188 | access_token | RFC 6749 | 1189 | token_type | RFC 6749 | 1190 | expires_in | RFC 6749 | 1191 | refresh_token | RFC 6749 | 1192 | scope | RFC 6749 | 1193 | state | RFC 6749 | 1194 | error | RFC 6749 | 1195 | error_description | RFC 6749 | 1196 | error_uri | RFC 6749 | 1197 | ace_profile | [this document] | 1198 | cnf | [I-D.ietf-ace-oauth-params] | 1199 | rs_cnf | [I-D.ietf-ace-oauth-params] | 1200 \-------------------+-------------------------------/ 1202 Figure 8: Access Information parameters 1204 Figure 9 shows a response containing a token and a "cnf" parameter 1205 with a symmetric proof-of-possession key, which is defined in 1206 [I-D.ietf-ace-oauth-params]. Note that the key identifier 'kid' is 1207 only used to simplify indexing and retrieving the key, and no 1208 assumptions should be made that it is unique in the domains of either 1209 the client or the RS. 1211 Header: Created (Code=2.01) 1212 Content-Format: "application/ace+cbor" 1213 Payload: 1214 { 1215 "access_token" : b64'SlAV32hkKG ... 1216 (remainder of CWT omitted for brevity; 1217 CWT contains COSE_Key in the "cnf" claim)', 1218 "ace_profile" : "coap_dtls", 1219 "expires_in" : "3600", 1220 "cnf" : { 1221 "COSE_Key" : { 1222 "kty" : "Symmetric", 1223 "kid" : b64'39Gqlw', 1224 "k" : b64'hJtXhkV8FJG+Onbc6mxCcQh' 1225 } 1226 } 1227 } 1229 Figure 9: Example AS response with an access token bound to a 1230 symmetric key. 1232 5.8.3. Error Response 1234 The error responses for interactions with the AS are generally 1235 equivalent to the ones defined in Section 5.2 of [RFC6749], with the 1236 following exceptions: 1238 * When using CoAP the payload MUST be encoded as a CBOR map, with 1239 the Content-Format "application/ace+cbor". When using HTTP the 1240 payload is encoded in JSON as specified in section 5.2 of 1241 [RFC6749]. 1243 * A response code equivalent to the CoAP code 4.00 (Bad Request) 1244 MUST be used for all error responses, except for invalid_client 1245 where a response code equivalent to the CoAP code 4.01 1246 (Unauthorized) MAY be used under the same conditions as specified 1247 in Section 5.2 of [RFC6749]. 1249 * The parameters "error", "error_description" and "error_uri" MUST 1250 be abbreviated using the codes specified in Figure 12, when a CBOR 1251 encoding is used. 1253 * The error code (i.e., value of the "error" parameter) MUST be 1254 abbreviated as specified in Figure 10, when a CBOR encoding is 1255 used. 1257 /---------------------------+--------+--------------------------\ 1258 | | CBOR | Original | 1259 | Name | Values | Specification | 1260 |---------------------------+--------+--------------------------| 1261 | invalid_request | 1 | section 5.2 of [RFC6749] | 1262 | invalid_client | 2 | section 5.2 of [RFC6749] | 1263 | invalid_grant | 3 | section 5.2 of [RFC6749] | 1264 | unauthorized_client | 4 | section 5.2 of [RFC6749] | 1265 | unsupported_grant_type | 5 | section 5.2 of [RFC6749] | 1266 | invalid_scope | 6 | section 5.2 of [RFC6749] | 1267 | unsupported_pop_key | 7 | [this document] | 1268 | incompatible_ace_profiles | 8 | [this document] | 1269 \---------------------------+--------+--------------------------/ 1271 Figure 10: CBOR abbreviations for common error codes 1273 In addition to the error responses defined in OAuth 2.0, the 1274 following behavior MUST be implemented by the AS: 1276 * If the client submits an asymmetric key in the token request that 1277 the RS cannot process, the AS MUST reject that request with a 1278 response code equivalent to the CoAP code 4.00 (Bad Request) 1279 including the error code "unsupported_pop_key" specified in 1280 Figure 10. 1282 * If the client and the RS it has requested an access token for do 1283 not share a common profile, the AS MUST reject that request with a 1284 response code equivalent to the CoAP code 4.00 (Bad Request) 1285 including the error code "incompatible_ace_profiles" specified in 1286 Figure 10. 1288 5.8.4. Request and Response Parameters 1290 This section provides more detail about the new parameters that can 1291 be used in access token requests and responses, as well as 1292 abbreviations for more compact encoding of existing parameters and 1293 common parameter values. 1295 5.8.4.1. Grant Type 1297 The abbreviations specified in the registry defined in Section 8.5 1298 MUST be used in CBOR encodings instead of the string values defined 1299 in [RFC6749], if CBOR payloads are used. 1301 /--------------------+------------+------------------------\ 1302 | Name | CBOR Value | Original Specification | 1303 |--------------------+------------+------------------------| 1304 | password | 0 | s. 4.3.2 of [RFC6749] | 1305 | authorization_code | 1 | s. 4.1.3 of [RFC6749] | 1306 | client_credentials | 2 | s. 4.4.2 of [RFC6749] | 1307 | refresh_token | 3 | s. 6 of [RFC6749] | 1308 \--------------------+------------+------------------------/ 1310 Figure 11: CBOR abbreviations for common grant types 1312 5.8.4.2. Token Type 1314 The "token_type" parameter, defined in section 5.1 of [RFC6749], 1315 allows the AS to indicate to the client which type of access token it 1316 is receiving (e.g., a bearer token). 1318 This document registers the new value "PoP" for the OAuth Access 1319 Token Types registry, specifying a proof-of-possession token. How 1320 the proof-of-possession by the client to the RS is performed MUST be 1321 specified by the profiles. 1323 The values in the "token_type" parameter MUST use the CBOR 1324 abbreviations defined in the registry specified by Section 8.7, if a 1325 CBOR encoding is used. 1327 In this framework the "pop" value for the "token_type" parameter is 1328 the default. The AS may, however, provide a different value from 1329 those registered in [IANA.OAuthAccessTokenTypes]. 1331 5.8.4.3. Profile 1333 Profiles of this framework MUST define the communication protocol and 1334 the communication security protocol between the client and the RS. 1335 The security protocol MUST provide encryption, integrity and replay 1336 protection. It MUST also provide a binding between requests and 1337 responses. Furthermore profiles MUST define a list of allowed proof- 1338 of-possession methods, if they support proof-of-possession tokens. 1340 A profile MUST specify an identifier that MUST be used to uniquely 1341 identify itself in the "ace_profile" parameter. The textual 1342 representation of the profile identifier is intended for human 1343 readability and for JSON-based interactions, it MUST NOT be used for 1344 CBOR-based interactions. Profiles MUST register their identifier in 1345 the registry defined in Section 8.8. 1347 Profiles MAY define additional parameters for both the token request 1348 and the Access Information in the access token response in order to 1349 support negotiation or signaling of profile specific parameters. 1351 Clients that want the AS to provide them with the "ace_profile" 1352 parameter in the access token response can indicate that by sending a 1353 ace_profile parameter with a null value for CBOR-based interactions, 1354 or an empty string if CBOR is not used, in the access token request. 1356 5.8.4.4. Client-Nonce 1358 This parameter MUST be sent from the client to the AS, if it 1359 previously received a "cnonce" parameter in the "AS Request Creation 1360 Hints" Section 5.3. The parameter is encoded as a byte string for 1361 CBOR-based interactions, and as a string (Base64 encoded binary) if 1362 CBOR is not used. It MUST copy the value from the cnonce parameter 1363 in the "AS Request Creation Hints". 1365 5.8.5. Mapping Parameters to CBOR 1367 If CBOR encoding is used, all OAuth parameters in access token 1368 requests and responses MUST be mapped to CBOR types as specified in 1369 the registry defined by Section 8.10, using the given integer 1370 abbreviation for the map keys. 1372 Note that we have aligned the abbreviations corresponding to claims 1373 with the abbreviations defined in [RFC8392]. 1375 Note also that abbreviations from -24 to 23 have a 1 byte encoding 1376 size in CBOR. We have thus chosen to assign abbreviations in that 1377 range to parameters we expect to be used most frequently in 1378 constrained scenarios. 1380 /-------------------+----------+---------------------+---------------\ 1381 | | | | Original | 1382 | Name | CBOR Key | Value Type | Specification | 1383 |-------------------+----------+---------------------+---------------| 1384 | access_token | 1 | byte string | [RFC6749] | 1385 | expires_in | 2 | unsigned integer | [RFC6749] | 1386 | audience | 5 | text string | [RFC8693] | 1387 | scope | 9 | text or byte string | [RFC6749] | 1388 | client_id | 24 | text string | [RFC6749] | 1389 | client_secret | 25 | byte string | [RFC6749] | 1390 | response_type | 26 | text string | [RFC6749] | 1391 | redirect_uri | 27 | text string | [RFC6749] | 1392 | state | 28 | text string | [RFC6749] | 1393 | code | 29 | byte string | [RFC6749] | 1394 | error | 30 | integer | [RFC6749] | 1395 | error_description | 31 | text string | [RFC6749] | 1396 | error_uri | 32 | text string | [RFC6749] | 1397 | grant_type | 33 | unsigned integer | [RFC6749] | 1398 | token_type | 34 | integer | [RFC6749] | 1399 | username | 35 | text string | [RFC6749] | 1400 | password | 36 | text string | [RFC6749] | 1401 | refresh_token | 37 | byte string | [RFC6749] | 1402 | ace_profile | 38 | integer |[this document]| 1403 | cnonce | 39 | byte string |[this document]| 1404 \-------------------+----------+---------------------+---------------/ 1406 Figure 12: CBOR mappings used in token requests and responses 1408 5.9. The Introspection Endpoint 1410 Token introspection [RFC7662] MAY be implemented by the AS, and the 1411 RS. When implemented, it MAY be used by the RS and to query the AS 1412 for metadata about a given token, e.g., validity or scope. Analogous 1413 to the protocol defined in [RFC7662] for HTTP and JSON, this section 1414 defines adaptations to more constrained environments using CBOR and 1415 leaving the choice of the application protocol to the profile. 1417 Communication between the requesting entity and the introspection 1418 endpoint at the AS MUST be integrity protected and encrypted. The 1419 communication security protocol MUST also provide a binding between 1420 requests and responses. Furthermore, the two interacting parties 1421 MUST perform mutual authentication. Finally, the AS SHOULD verify 1422 that the requesting entity has the right to access introspection 1423 information about the provided token. Profiles of this framework 1424 that support introspection MUST specify how authentication and 1425 communication security between the requesting entity and the AS is 1426 implemented. 1428 The default name of this endpoint in an url-path SHOULD be 1429 '/introspect'. However, implementations are not required to use this 1430 name and can define their own instead. 1432 The figures of this section use the CBOR diagnostic notation without 1433 the integer abbreviations for the parameters and their values for 1434 better readability. 1436 5.9.1. Introspection Request 1438 The requesting entity sends a POST request to the introspection 1439 endpoint at the AS. The profile MUST specify how the communication 1440 is protected. If CoAP is used, the payload MUST be encoded as a CBOR 1441 map with a "token" entry containing the access token. Further 1442 optional parameters representing additional context that is known by 1443 the requesting entity to aid the AS in its response MAY be included. 1445 For CoAP-based interaction, all messages MUST use the content type 1446 "application/ace+cbor". For HTTP the encoding defined in section 2.1 1447 of [RFC7662] is used. 1449 The same parameters are required and optional as in Section 2.1 of 1450 [RFC7662]. 1452 For example, Figure 13 shows an RS calling the token introspection 1453 endpoint at the AS to query about an OAuth 2.0 proof-of-possession 1454 token. Note that object security based on OSCORE [RFC8613] is 1455 assumed in this example, therefore the Content-Format is 1456 "application/oscore". Figure 14 shows the decoded payload. 1458 Header: POST (Code=0.02) 1459 Uri-Host: "as.example.com" 1460 Uri-Path: "introspect" 1461 OSCORE: 0x09, 0x05, 0x25 1462 Content-Format: "application/oscore" 1463 Payload: 1464 ... COSE content ... 1466 Figure 13: Example introspection request. 1468 { 1469 "token" : b64'7gj0dXJQ43U', 1470 "token_type_hint" : "PoP" 1471 } 1473 Figure 14: Decoded payload. 1475 5.9.2. Introspection Response 1477 If the introspection request is authorized and successfully 1478 processed, the AS sends a response with the response code equivalent 1479 to the CoAP code 2.01 (Created). If the introspection request was 1480 invalid, not authorized or couldn't be processed the AS returns an 1481 error response as described in Section 5.9.3. 1483 In a successful response, the AS encodes the response parameters in a 1484 map. If CoAP is used, this MUST be encoded as a CBOR map, if HTTP is 1485 used the JSON encoding specified in section 2.2 of [RFC7662] is used. 1486 The map containing the response payload includes the same required 1487 and optional parameters as in Section 2.2 of [RFC7662] with the 1488 following additions: 1490 ace_profile OPTIONAL. This indicates the profile that the RS MUST 1491 use with the client. See Section 5.8.4.3 for more details on the 1492 formatting of this parameter. If this parameter is absent, the AS 1493 assumes that the RS implicitly knows which profile to use towards 1494 the client. 1496 cnonce OPTIONAL. A client-nonce provided to the AS by the client. 1497 The RS MUST verify that this corresponds to the client-nonce 1498 previously provided to the client in the "AS Request Creation 1499 Hints". See Section 5.3 and Section 5.8.4.4. 1501 cti OPTIONAL. The "cti" claim associated to this access token. 1502 This parameter has the same meaning and processing rules as the 1503 "jti" parameter defined in section 3.1.2 of [RFC7662] except that 1504 the value is a byte string. 1506 exi OPTIONAL. The "expires-in" claim associated to this access 1507 token. See Section 5.10.3. 1509 Furthermore [I-D.ietf-ace-oauth-params] defines more parameters that 1510 the AS MUST be able to use when responding to a request to the 1511 introspection endpoint. 1513 For example, Figure 15 shows an AS response to the introspection 1514 request in Figure 13. Note that this example contains the "cnf" 1515 parameter defined in [I-D.ietf-ace-oauth-params]. 1517 Header: Created (Code=2.01) 1518 Content-Format: "application/ace+cbor" 1519 Payload: 1520 { 1521 "active" : true, 1522 "scope" : "read", 1523 "ace_profile" : "coap_dtls", 1524 "cnf" : { 1525 "COSE_Key" : { 1526 "kty" : "Symmetric", 1527 "kid" : b64'39Gqlw', 1528 "k" : b64'hJtXhkV8FJG+Onbc6mxCcQh' 1529 } 1530 } 1531 } 1533 Figure 15: Example introspection response. 1535 5.9.3. Error Response 1537 The error responses for CoAP-based interactions with the AS are 1538 equivalent to the ones for HTTP-based interactions as defined in 1539 Section 2.3 of [RFC7662], with the following differences: 1541 * If content is sent and CoAP is used the payload MUST be encoded as 1542 a CBOR map and the Content-Format "application/ace+cbor" MUST be 1543 used. For HTTP the encoding defined in section 2.3 of [RFC6749] 1544 is used. 1546 * If the credentials used by the requesting entity (usually the RS) 1547 are invalid the AS MUST respond with the response code equivalent 1548 to the CoAP code 4.01 (Unauthorized) and use the required and 1549 optional parameters from Section 2.3 in [RFC7662]. 1551 * If the requesting entity does not have the right to perform this 1552 introspection request, the AS MUST respond with a response code 1553 equivalent to the CoAP code 4.03 (Forbidden). In this case no 1554 payload is returned. 1556 * The parameters "error", "error_description" and "error_uri" MUST 1557 be abbreviated using the codes specified in Figure 12. 1559 * The error codes MUST be abbreviated using the codes specified in 1560 the registry defined by Section 8.4. 1562 Note that a properly formed and authorized query for an inactive or 1563 otherwise invalid token does not warrant an error response by this 1564 specification. In these cases, the authorization server MUST instead 1565 respond with an introspection response with the "active" field set to 1566 "false". 1568 5.9.4. Mapping Introspection Parameters to CBOR 1570 If CBOR is used, the introspection request and response parameters 1571 MUST be mapped to CBOR types as specified in the registry defined by 1572 Section 8.12, using the given integer abbreviation for the map key. 1574 Note that we have aligned abbreviations that correspond to a claim 1575 with the abbreviations defined in [RFC8392] and the abbreviations of 1576 parameters with the same name from Section 5.8.5. 1578 /-------------------+----------+-------------------+---------------\ 1579 | | | | Original | 1580 | Parameter name | CBOR Key | Value Type | Specification | 1581 |-------------------+----------+-------------------+---------------| 1582 | iss | 1 | text string | [RFC7662] | 1583 | sub | 2 | text string | [RFC7662] | 1584 | aud | 3 | text string | [RFC7662] | 1585 | exp | 4 | integer or | [RFC7662] | 1586 | | | floating-point | | 1587 | | | number | | 1588 | nbf | 5 | integer or | [RFC7662] | 1589 | | | floating-point | | 1590 | | | number | | 1591 | iat | 6 | integer or | [RFC7662] | 1592 | | | floating-point | | 1593 | | | number | | 1594 | scope | 9 | text or | | 1595 | | | byte string | [RFC7662] | 1596 | active | 10 | True or False | [RFC7662] | 1597 | token | 11 | byte string | [RFC7662] | 1598 | client_id | 24 | text string | [RFC7662] | 1599 | error | 30 | integer | [RFC7662] | 1600 | error_description | 31 | text string | [RFC7662] | 1601 | error_uri | 32 | text string | [RFC7662] | 1602 | token_type_hint | 33 | text string | [RFC7662] | 1603 | token_type | 34 | integer | [RFC7662] | 1604 | username | 35 | text string | [RFC7662] | 1605 | ace_profile | 38 | integer |[this document]| 1606 | cnonce | 39 | byte string |[this document]| 1607 | exi | 40 | unsigned integer |[this document]| 1608 \-------------------+----------+-------------------+---------------/ 1609 Figure 16: CBOR mappings for Token Introspection Parameters. 1611 5.10. The Access Token 1613 In this framework the use of CBOR Web Token (CWT) as specified in 1614 [RFC8392] is RECOMMENDED. 1616 In order to facilitate offline processing of access tokens, this 1617 document uses the "cnf" claim from [RFC8747] and the "scope" claim 1618 from [RFC8693] for JWT- and CWT-encoded tokens. In addition to 1619 string encoding specified for the "scope" claim, a binary encoding 1620 MAY be used. The syntax of such an encoding is explicitly not 1621 specified here and left to profiles or applications, specifically 1622 note that a binary encoded scope does not necessarily use the space 1623 character '0x20' to delimit scope-tokens. 1625 If the AS needs to convey a hint to the RS about which profile it 1626 should use to communicate with the client, the AS MAY include an 1627 "ace_profile" claim in the access token, with the same syntax and 1628 semantics as defined in Section 5.8.4.3. 1630 If the client submitted a client-nonce parameter in the access token 1631 request Section 5.8.4.4, the AS MUST include the value of this 1632 parameter in the "cnonce" claim specified here. The "cnonce" claim 1633 uses binary encoding. 1635 5.10.1. The Authorization Information Endpoint 1637 The access token, containing authorization information and 1638 information about the proof-of-possession method used by the client, 1639 needs to be transported to the RS so that the RS can authenticate and 1640 authorize the client request. 1642 This section defines a method for transporting the access token to 1643 the RS using a RESTful protocol such as CoAP. Profiles of this 1644 framework MAY define other methods for token transport. 1646 The method consists of an authz-info endpoint, implemented by the RS. 1647 A client using this method MUST make a POST request to the authz-info 1648 endpoint at the RS with the access token in the payload. The CoAP 1649 Content-Format or HTTP Media Type MUST reflect the format of the 1650 token, e.g. application/cwt for CBOR Web Tokens, if no Content-Format 1651 or Media Type is defined for the token format, application/octet- 1652 stream MUST be used. 1654 The RS receiving the token MUST verify the validity of the token. If 1655 the token is valid, the RS MUST respond to the POST request with a 1656 response code equivalent to CoAP's 2.01 (Created). Section 5.10.1.1 1657 outlines how an RS MUST proceed to verify the validity of an access 1658 token. 1660 The RS MUST be prepared to store at least one access token for future 1661 use. This is a difference to how access tokens are handled in OAuth 1662 2.0, where the access token is typically sent along with each 1663 request, and therefore not stored at the RS. 1665 When using this framework it is RECOMMENDED that an RS stores only 1666 one token per proof-of-possession key. This means that an additional 1667 token linked to the same key will supersede any existing token at the 1668 RS, by replacing the corresponding authorization information. The 1669 reason is that this greatly simplifies (constrained) implementations, 1670 with respect to required storage and resolving a request to the 1671 applicable token. The use of multiple access tokens for a single 1672 client increases the strain on the resource server as it must 1673 consider every access token and calculate the actual permissions of 1674 the client. Also, tokens may contradict each other which may lead 1675 the server to enforce wrong permissions. If one of the access tokens 1676 expires earlier than others, the resulting permissions may offer 1677 insufficient protection. 1679 If the payload sent to the authz-info endpoint does not parse to a 1680 token, the RS MUST respond with a response code equivalent to the 1681 CoAP code 4.00 (Bad Request). 1683 The RS MAY make an introspection request to validate the token before 1684 responding to the POST request to the authz-info endpoint, e.g. if 1685 the token is an opaque reference. Some transport protocols may 1686 provide a way to indicate that the RS is busy and the client should 1687 retry after an interval; this type of status update would be 1688 appropriate while the RS is waiting for an introspection response. 1690 Profiles MUST specify whether the authz-info endpoint is protected, 1691 including whether error responses from this endpoint are protected. 1692 Note that since the token contains information that allow the client 1693 and the RS to establish a security context in the first place, mutual 1694 authentication may not be possible at this point. 1696 The default name of this endpoint in an url-path is '/authz-info', 1697 however implementations are not required to use this name and can 1698 define their own instead. 1700 5.10.1.1. Verifying an Access Token 1702 When an RS receives an access token, it MUST verify it before storing 1703 it. The details of token verification depends on various aspects, 1704 including the token encoding, the type of token, the security 1705 protection applied to the token, and the claims. The token encoding 1706 matters since the security protection differs between the token 1707 encodings. For example, a CWT token uses COSE while a JWT token uses 1708 JOSE. The type of token also has an influence on the verification 1709 procedure since tokens may be self-contained whereby token 1710 verification may happen locally at the RS while a token-by-reference 1711 requires further interaction with the authorization server, for 1712 example using token introspection, to obtain the claims associated 1713 with the token reference. Self-contained tokens MUST, at least be 1714 integrity protected but they MAY also be encrypted. 1716 For self-contained tokens the RS MUST process the security protection 1717 of the token first, as specified by the respective token format. For 1718 CWT the description can be found in [RFC8392] and for JWT the 1719 relevant specification is [RFC7519]. This MUST include a 1720 verification that security protection (and thus the token) was 1721 generated by an AS that has the right to issue access tokens for this 1722 RS. 1724 In case the token is communicated by reference the RS needs to obtain 1725 the claims first. When the RS uses token introspection the relevant 1726 specification is [RFC7662] with CoAP transport specified in 1727 Section 5.9. 1729 Errors may happen during this initial processing stage: 1731 * If the verification of the security wrapper fails, or the token 1732 was issued by an AS that does not have the right to issue tokens 1733 for the receiving RS, the RS MUST discard the token and, if this 1734 was an interaction with authz-info, return an error message with a 1735 response code equivalent to the CoAP code 4.01 (Unauthorized). 1737 * If the claims cannot be obtained the RS MUST discard the token 1738 and, in case of an interaction via the authz-info endpoint, return 1739 an error message with a response code equivalent to the CoAP code 1740 4.00 (Bad Request). 1742 Next, the RS MUST verify claims, if present, contained in the access 1743 token. Errors are returned when claim checks fail, in the order of 1744 priority of this list: 1746 iss The issuer claim (if present) must identify the AS that has 1747 produced the security protection for the access token. If that is 1748 not the case the RS MUST discard the token. If this was an 1749 interaction with authz-info, the RS MUST also respond with a 1750 response code equivalent to the CoAP code 4.01 (Unauthorized). 1752 exp The expiration date must be in the future. If that is not the 1753 case the RS MUST discard the token. If this was an interaction 1754 with authz-info the RS MUST also respond with a response code 1755 equivalent to the CoAP code 4.01 (Unauthorized). Note that the RS 1756 has to terminate access rights to the protected resources at the 1757 time when the tokens expire. 1759 aud The audience claim must refer to an audience that the RS 1760 identifies with. If that is not the case the RS MUST discard the 1761 token. If this was an interaction with authz-info, the RS MUST 1762 also respond with a response code equivalent to the CoAP code 4.03 1763 (Forbidden). 1765 scope The RS must recognize value of the scope claim. If that is 1766 not the case the RS MUST discard the token. If this was an 1767 interaction with authz-info, the RS MUST also respond with a 1768 response code equivalent to the CoAP code 4.00 (Bad Request). The 1769 RS MAY provide additional information in the error response, to 1770 clarify what went wrong. 1772 Additional processing may be needed for other claims in a way 1773 specific to a profile or the underlying application. 1775 Note that the Subject (sub) claim cannot always be verified when the 1776 token is submitted to the RS since the client may not have 1777 authenticated yet. Also note that a counter for the expires_in (exi) 1778 claim MUST be initialized when the RS first verifies this token. 1780 Also note that profiles of this framework may define access token 1781 transport mechanisms that do not allow for error responses. 1782 Therefore the error messages specified here only apply if the token 1783 was sent to the authz-info endpoint. 1785 When sending error responses, the RS MAY use the error codes from 1786 Section 3.1 of [RFC6750], to provide additional details to the 1787 client. 1789 5.10.1.2. Protecting the Authorization Information Endpoint 1791 As this framework can be used in RESTful environments, it is 1792 important to make sure that attackers cannot perform unauthorized 1793 requests on the authz-info endpoints, other than submitting access 1794 tokens. 1796 Specifically it SHOULD NOT be possible to perform GET, DELETE or PUT 1797 on the authz-info endpoint. 1799 The RS SHOULD implement rate limiting measures to mitigate attacks 1800 aiming to overload the processing capacity of the RS by repeatedly 1801 submitting tokens. For CoAP-based communication the RS could use the 1802 mechanisms from [RFC8516] to indicate that it is overloaded. 1804 5.10.2. Client Requests to the RS 1806 Before sending a request to an RS, the client MUST verify that the 1807 keys used to protect this communication are still valid. See 1808 Section 5.10.4 for details on how the client determines the validity 1809 of the keys used. 1811 If an RS receives a request from a client, and the target resource 1812 requires authorization, the RS MUST first verify that it has an 1813 access token that authorizes this request, and that the client has 1814 performed the proof-of-possession binding that token to the request. 1816 The response code MUST be 4.01 (Unauthorized) in case the client has 1817 not performed the proof-of-possession, or if RS has no valid access 1818 token for the client. If RS has an access token for the client but 1819 the token does not authorize access for the resource that was 1820 requested, RS MUST reject the request with a 4.03 (Forbidden). If RS 1821 has an access token for the client but it does not cover the action 1822 that was requested on the resource, RS MUST reject the request with a 1823 4.05 (Method Not Allowed). 1825 Note: The use of the response codes 4.03 and 4.05 is intended to 1826 prevent infinite loops where a dumb client optimistically tries to 1827 access a requested resource with any access token received from AS. 1828 As malicious clients could pretend to be C to determine C's 1829 privileges, these detailed response codes must be used only when a 1830 certain level of security is already available which can be achieved 1831 only when the client is authenticated. 1833 Note: The RS MAY use introspection for timely validation of an access 1834 token, at the time when a request is presented. 1836 Note: Matching the claims of the access token (e.g., scope) to a 1837 specific request is application specific. 1839 If the request matches a valid token and the client has performed the 1840 proof-of-possession for that token, the RS continues to process the 1841 request as specified by the underlying application. 1843 5.10.3. Token Expiration 1845 Depending on the capabilities of the RS, there are various ways in 1846 which it can verify the expiration of a received access token. Here 1847 follows a list of the possibilities including what functionality they 1848 require of the RS. 1850 * The token is a CWT and includes an "exp" claim and possibly the 1851 "nbf" claim. The RS verifies these by comparing them to values 1852 from its internal clock as defined in [RFC7519]. In this case the 1853 RS's internal clock must reflect the current date and time, or at 1854 least be synchronized with the AS's clock. How this clock 1855 synchronization would be performed is out of scope for this 1856 specification. 1858 * The RS verifies the validity of the token by performing an 1859 introspection request as specified in Section 5.9. This requires 1860 the RS to have a reliable network connection to the AS and to be 1861 able to handle two secure sessions in parallel (C to RS and RS to 1862 AS). 1864 * In order to support token expiration for devices that have no 1865 reliable way of synchronizing their internal clocks, this 1866 specification defines the following approach: The claim "exi" 1867 ("expires in") can be used, to provide the RS with the lifetime of 1868 the token in seconds from the time the RS first receives the 1869 token. This mechanism only works for self-contained tokens, i.e. 1870 CWTs and JWTs. For CWTs this parameter is encoded as unsigned 1871 integer, while JWTs encode this as JSON number. 1873 * Processing this claim requires that the RS does the following: 1875 - For each token the RS receives, that contains an "exi" claim: 1876 Keep track of the time it received that token and revisit that 1877 list regularly to expunge expired tokens. 1879 - Keep track of the identifiers of tokens containing the "exi" 1880 claim that have expired (in order to avoid accepting them 1881 again). In order to avoid an unbounded memory usage growth, 1882 this MUST be implemented in the following way when the "exi" 1883 claim is used: 1885 o When creating the token, the AS MUST add a 'cti' claim ( or 1886 'jti' for JWTs) to the access token. The value of this 1887 claim MUST be created as the binary representation of the 1888 concatenation of the identifier of the RS with a sequence 1889 number counting the tokens containing an 'exi' claim, issued 1890 by this AS for the RS. 1892 o The RS MUST store the highest sequence number of an expired 1893 token containing the "exi" claim that it has seen, and treat 1894 tokens with lower sequence numbers as expired. Note that 1895 this could lead to discarding valid tokens with lower 1896 sequence numbers, if the AS where to issue tokens of 1897 different validity time for the same RS. The assumption is 1898 that typically tokens in such a scenario would all have the 1899 same validity time. 1901 If a token that authorizes a long running request such as a CoAP 1902 Observe [RFC7641] expires, the RS MUST send an error response with 1903 the response code equivalent to the CoAP code 4.01 (Unauthorized) to 1904 the client and then terminate processing the long running request. 1906 5.10.4. Key Expiration 1908 The AS provides the client with key material that the RS uses. This 1909 can either be a common symmetric PoP-key, or an asymmetric key used 1910 by the RS to authenticate towards the client. Since there is 1911 currently no expiration metadata associated to those keys, the client 1912 has no way of knowing if these keys are still valid. This may lead 1913 to situations where the client sends requests containing sensitive 1914 information to the RS using a key that is expired and possibly in the 1915 hands of an attacker, or accepts responses from the RS that are not 1916 properly protected and could possibly have been forged by an 1917 attacker. 1919 In order to prevent this, the client must assume that those keys are 1920 only valid as long as the related access token is. Since the access 1921 token is opaque to the client, one of the following methods MUST be 1922 used to inform the client about the validity of an access token: 1924 * The client knows a default validity time for all tokens it is 1925 using (i.e. how long a token is valid after being issued). This 1926 information could be provisioned to the client when it is 1927 registered at the AS, or published by the AS in a way that the 1928 client can query. 1930 * The AS informs the client about the token validity using the 1931 "expires_in" parameter in the Access Information. 1933 A client that is not able to obtain information about the expiration 1934 of a token MUST NOT use this token. 1936 6. Security Considerations 1938 Security considerations applicable to authentication and 1939 authorization in RESTful environments provided in OAuth 2.0 [RFC6749] 1940 apply to this work. Furthermore [RFC6819] provides additional 1941 security considerations for OAuth which apply to IoT deployments as 1942 well. If the introspection endpoint is used, the security 1943 considerations from [RFC7662] also apply. 1945 The following subsections address issues specific to this document 1946 and it's use in constrained environments. 1948 6.1. Protecting Tokens 1950 A large range of threats can be mitigated by protecting the contents 1951 of the access token by using a digital signature or a keyed message 1952 digest (MAC) or an Authenticated Encryption with Associated Data 1953 (AEAD) algorithm. Consequently, the token integrity protection MUST 1954 be applied to prevent the token from being modified, particularly 1955 since it contains a reference to the symmetric key or the asymmetric 1956 key used for proof-of-possession. If the access token contains the 1957 symmetric key, this symmetric key MUST be encrypted by the 1958 authorization server so that only the resource server can decrypt it. 1959 Note that using an AEAD algorithm is preferable over using a MAC 1960 unless the token needs to be publicly readable. 1962 If the token is intended for multiple recipients (i.e. an audience 1963 that is a group), integrity protection of the token with a symmetric 1964 key, shared between the AS and the recipients, is not sufficient, 1965 since any of the recipients could modify the token undetected by the 1966 other recipients. Therefore a token with a multi-recipient audience 1967 MUST be protected with an asymmetric signature. 1969 It is important for the authorization server to include the identity 1970 of the intended recipient (the audience), typically a single resource 1971 server (or a list of resource servers), in the token. The same 1972 shared secret MUST NOT be used as proof-of-possession key with 1973 multiple resource servers since the benefit from using the proof-of- 1974 possession concept is then significantly reduced. 1976 If clients are capable of doing so, they should frequently request 1977 fresh access tokens, as this allows the AS to keep the lifetime of 1978 the tokens short. This allows the AS to use shorter proof-of- 1979 possession key sizes, which translate to a performance benefit for 1980 the client and for the resource server. Shorter keys also lead to 1981 shorter messages (particularly with asymmetric keying material). 1983 When authorization servers bind symmetric keys to access tokens, they 1984 SHOULD scope these access tokens to a specific permission. 1986 In certain situations it may be necessary to revoke an access token 1987 that is still valid. Client-initiated revocation is specified in 1988 [RFC7009] for OAuth 2.0. Other revocation mechanisms are currently 1989 not specified, as the underlying assumption in OAuth is that access 1990 tokens are issued with a relatively short lifetime. This may not 1991 hold true for disconnected constrained devices, needing access tokens 1992 with relatively long lifetimes, and would therefore necessitate 1993 further standardization work that is out of scope for this document. 1995 6.2. Communication Security 1997 Communication with the authorization server MUST use confidentiality 1998 protection. This step is extremely important since the client or the 1999 RS may obtain the proof-of-possession key from the authorization 2000 server for use with a specific access token. Not using 2001 confidentiality protection exposes this secret (and the access token) 2002 to an eavesdropper thereby completely negating proof-of-possession 2003 security. The requirements for communication security of profiles 2004 are specified in Section 5. 2006 Additional protection for the access token can be applied by 2007 encrypting it, for example encryption of CWTs is specified in 2008 Section 5.1 of [RFC8392]. Such additional protection can be 2009 necessary if the token is later transferred over an insecure 2010 connection (e.g. when it is sent to the authz-info endpoint). 2012 Care must by taken by developers to prevent leakage of the PoP 2013 credentials (i.e., the private key or the symmetric key). An 2014 adversary in possession of the PoP credentials bound to the access 2015 token will be able to impersonate the client. Be aware that this is 2016 a real risk with many constrained environments, since adversaries may 2017 get physical access to the devices and can therefore use physical 2018 extraction techniques to gain access to memory contents. This risk 2019 can be mitigated to some extent by making sure that keys are 2020 refreshed frequently, by using software isolation techniques and by 2021 using hardware security. 2023 6.3. Long-Term Credentials 2025 Both clients and RSs have long-term credentials that are used to 2026 secure communications, and authenticate to the AS. These credentials 2027 need to be protected against unauthorized access. In constrained 2028 devices, deployed in publicly accessible places, such protection can 2029 be difficult to achieve without specialized hardware (e.g. secure key 2030 storage memory). 2032 If credentials are lost or compromised, the operator of the affected 2033 devices needs to have procedures to invalidate any access these 2034 credentials give and to revoke tokens linked to such credentials. 2035 The loss of a credential linked to a specific device MUST NOT lead to 2036 a compromise of other credentials not linked to that device, 2037 therefore secret keys used for authentication MUST NOT be shared 2038 between more than two parties. 2040 Operators of clients or RS SHOULD have procedures in place to replace 2041 credentials that are suspected to have been compromised or that have 2042 been lost. 2044 Operators also SHOULD have procedures for decommissioning devices, 2045 that include securely erasing credentials and other security critical 2046 material in the devices being decommissioned. 2048 6.4. Unprotected AS Request Creation Hints 2050 Initially, no secure channel exists to protect the communication 2051 between C and RS. Thus, C cannot determine if the "AS Request 2052 Creation Hints" contained in an unprotected response from RS to an 2053 unauthorized request (see Section 5.3) are authentic. C therefore 2054 MUST determine if an AS is authorized to provide access tokens for a 2055 certain RS. How this determination is implemented is out of scope 2056 for this document and left to the applications. 2058 6.5. Minimal Security Requirements for Communication 2060 This section summarizes the minimal requirements for the 2061 communication security of the different protocol interactions. 2063 C-AS All communication between the client and the Authorization 2064 Server MUST be encrypted, integrity and replay protected. 2065 Furthermore responses from the AS to the client MUST be bound to 2066 the client's request to avoid attacks where the attacker swaps the 2067 intended response for an older one valid for a previous request. 2068 This requires that the client and the Authorization Server have 2069 previously exchanged either a shared secret or their public keys 2070 in order to negotiate a secure communication. Furthermore the 2071 client MUST be able to determine whether an AS has the authority 2072 to issue access tokens for a certain RS. This can for example be 2073 done through pre-configured lists, or through an online lookup 2074 mechanism that in turn also must be secured. 2076 RS-AS The communication between the Resource Server and the 2077 Authorization Server via the introspection endpoint MUST be 2078 encrypted, integrity and replay protected. Furthermore responses 2079 from the AS to the RS MUST be bound to the RS's request. This 2080 requires that the RS and the Authorization Server have previously 2081 exchanged either a shared secret, or their public keys in order to 2082 negotiate a secure communication. Furthermore the RS MUST be able 2083 to determine whether an AS has the authority to issue access 2084 tokens itself. This is usually configured out of band, but could 2085 also be performed through an online lookup mechanism provided that 2086 it is also secured in the same way. 2088 C-RS The initial communication between the client and the Resource 2089 Server can not be secured in general, since the RS is not in 2090 possession of on access token for that client, which would carry 2091 the necessary parameters. If both parties support DTLS without 2092 client authentication it is RECOMMEND to use this mechanism for 2093 protecting the initial communication. After the client has 2094 successfully transmitted the access token to the RS, a secure 2095 communication protocol MUST be established between client and RS 2096 for the actual resource request. This protocol MUST provide 2097 confidentiality, integrity and replay protection as well as a 2098 binding between requests and responses. This requires that the 2099 client learned either the RS's public key or received a symmetric 2100 proof-of-possession key bound to the access token from the AS. 2101 The RS must have learned either the client's public key or a 2102 shared symmetric key from the claims in the token or an 2103 introspection request. Since ACE does not provide profile 2104 negotiation between C and RS, the client MUST have learned what 2105 profile the RS supports (e.g. from the AS or pre-configured) and 2106 initiate the communication accordingly. 2108 6.6. Token Freshness and Expiration 2110 An RS that is offline faces the problem of clock drift. Since it 2111 cannot synchronize its clock with the AS, it may be tricked into 2112 accepting old access tokens that are no longer valid or have been 2113 compromised. In order to prevent this, an RS may use the nonce-based 2114 mechanism (cnonce) defined in Section 5.3 to ensure freshness of an 2115 Access Token subsequently presented to this RS. 2117 Another problem with clock drift is that evaluating the standard 2118 token expiration claim "exp" can give unpredictable results. 2120 Acceptable ranges of clock drift are highly dependent on the concrete 2121 application. Important factors are how long access tokens are valid, 2122 and how critical timely expiration of access token is. 2124 The expiration mechanism implemented by the "exi" claim, based on the 2125 first time the RS sees the token was defined to provide a more 2126 predictable alternative. The "exi" approach has some drawbacks that 2127 need to be considered: 2129 A malicious client may hold back tokens with the "exi" claim in 2130 order to prolong their lifespan. 2132 If an RS loses state (e.g. due to an unscheduled reboot), it may 2133 lose the current values of counters tracking the "exi" claims of 2134 tokens it is storing. 2136 The first drawback is inherent to the deployment scenario and the 2137 "exi" solution. It can therefore not be mitigated without requiring 2138 the RS be online at times. The second drawback can be mitigated by 2139 regularly storing the value of "exi" counters to persistent memory. 2141 6.7. Combining Profiles 2143 There may be use cases where different transport and security 2144 protocols are allowed for the different interactions, and, if that is 2145 not explicitly covered by an existing profile, it corresponds to 2146 combining profiles into a new one. For example, a new profile could 2147 specify that a previously-defined MQTT-TLS profile is used between 2148 the client and the RS in combination with a previously-defined CoAP- 2149 DTLS profile for interactions between the client and the AS. The new 2150 profile that combines existing profiles MUST specify how the existing 2151 profiles' security properties are achieved. Any profile therefore 2152 MUST clearly specify its security requirements and MUST document if 2153 its security depends on the combination of various protocol 2154 interactions. 2156 6.8. Unprotected Information 2158 Communication with the authz-info endpoint, as well as the various 2159 error responses defined in this framework, all potentially include 2160 sending information over an unprotected channel. These messages may 2161 leak information to an adversary, or may be manipulated by active 2162 attackers to induce incorrect behavior. For example error responses 2163 for requests to the Authorization Information endpoint can reveal 2164 information about an otherwise opaque access token to an adversary 2165 who has intercepted this token. 2167 As far as error messages are concerned, this framework is written 2168 under the assumption that, in general, the benefits of detailed error 2169 messages outweigh the risk due to information leakage. For 2170 particular use cases, where this assessment does not apply, detailed 2171 error messages can be replaced by more generic ones. 2173 In some scenarios it may be possible to protect the communication 2174 with the authz-info endpoint (e.g. through DTLS with only server-side 2175 authentication). In cases where this is not possible, it is 2176 RECOMMENDED to use encrypted CWTs or tokens that are opaque 2177 references and need to be subjected to introspection by the RS. 2179 If the initial unauthorized resource request message (see 2180 Section 5.2) is used, the client MUST make sure that it is not 2181 sending sensitive content in this request. While GET and DELETE 2182 requests only reveal the target URI of the resource, POST and PUT 2183 requests would reveal the whole payload of the intended operation. 2185 Since the client is not authenticated at the point when it is 2186 submitting an access token to the authz-info endpoint, attackers may 2187 be pretending to be a client and trying to trick an RS to use an 2188 obsolete profile that in turn specifies a vulnerable security 2189 mechanism via the authz-info endpoint. Such an attack would require 2190 a valid access token containing an "ace_profile" claim requesting the 2191 use of said obsolete profile. Resource Owners should update the 2192 configuration of their RS's to prevent them from using such obsolete 2193 profiles. 2195 6.9. Identifying Audiences 2197 The audience claim as defined in [RFC7519] and the equivalent 2198 "audience" parameter from [RFC8693] are intentionally vague on how to 2199 match the audience value to a specific RS. This is intended to allow 2200 application specific semantics to be used. This section attempts to 2201 give some general guidance for the use of audiences in constrained 2202 environments. 2204 URLs are not a good way of identifying mobile devices that can switch 2205 networks and thus be associated with new URLs. If the audience 2206 represents a single RS, and asymmetric keys are used, the RS can be 2207 uniquely identified by a hash of its public key. If this approach is 2208 used it is RECOMMENDED to apply the procedure from section 3 of 2209 [RFC6920]. 2211 If the audience addresses a group of resource servers, the mapping of 2212 group identifier to individual RS has to be provisioned to each RS 2213 before the group-audience is usable. Managing dynamic groups could 2214 be an issue, if any RS is not always reachable when the groups' 2215 memberships change. Furthermore, issuing access tokens bound to 2216 symmetric proof-of-possession keys that apply to a group-audience is 2217 problematic, as an RS that is in possession of the access token can 2218 impersonate the client towards the other RSs that are part of the 2219 group. It is therefore NOT RECOMMENDED to issue access tokens bound 2220 to a group audience and symmetric proof-of possession keys. 2222 Even the client must be able to determine the correct values to put 2223 into the "audience" parameter, in order to obtain a token for the 2224 intended RS. Errors in this process can lead to the client 2225 inadvertently obtaining a token for the wrong RS. The correct values 2226 for "audience" can either be provisioned to the client as part of its 2227 configuration, or dynamically looked up by the client in some 2228 directory. In the latter case the integrity and correctness of the 2229 directory data must be assured. Note that the "audience" hint 2230 provided by the RS as part of the "AS Request Creation Hints" 2231 Section 5.3 is not typically source authenticated and integrity 2232 protected, and should therefore not be treated a trusted value. 2234 6.10. Denial of Service Against or with Introspection 2236 The optional introspection mechanism provided by OAuth and supported 2237 in the ACE framework allows for two types of attacks that need to be 2238 considered by implementers. 2240 First, an attacker could perform a denial of service attack against 2241 the introspection endpoint at the AS in order to prevent validation 2242 of access tokens. To maintain the security of the system, an RS that 2243 is configured to use introspection MUST NOT allow access based on a 2244 token for which it couldn't reach the introspection endpoint. 2246 Second, an attacker could use the fact that an RS performs 2247 introspection to perform a denial of service attack against that RS 2248 by repeatedly sending tokens to its authz-info endpoint that require 2249 an introspection call. RS can mitigate such attacks by implementing 2250 rate limits on how many introspection requests they perform in a 2251 given time interval for a certain client IP address submitting tokens 2252 to /authz-info. When that limit has been reached, incoming requests 2253 from that address are rejected for a certain amount of time. A 2254 general rate limit on the introspection requests should also be 2255 considered, to mitigate distributed attacks. 2257 7. Privacy Considerations 2259 Implementers and users should be aware of the privacy implications of 2260 the different possible deployments of this framework. 2262 The AS is in a very central position and can potentially learn 2263 sensitive information about the clients requesting access tokens. If 2264 the client credentials grant is used, the AS can track what kind of 2265 access the client intends to perform. With other grants this can be 2266 prevented by the Resource Owner. To do so, the resource owner needs 2267 to bind the grants it issues to anonymous, ephemeral credentials that 2268 do not allow the AS to link different grants and thus different 2269 access token requests by the same client. 2271 The claims contained in a token can reveal privacy sensitive 2272 information about the client and the RS to any party having access to 2273 them (whether by processing the content of a self-contained token or 2274 by introspection). The AS SHOULD be configured to minimize the 2275 information about clients and RSs disclosed in the tokens it issues. 2277 If tokens are only integrity protected and not encrypted, they may 2278 reveal information to attackers listening on the wire, or able to 2279 acquire the access tokens in some other way. In the case of CWTs the 2280 token may, e.g., reveal the audience, the scope and the confirmation 2281 method used by the client. The latter may reveal the identity of the 2282 device or application running the client. This may be linkable to 2283 the identity of the person using the client (if there is a person and 2284 not a machine-to-machine interaction). 2286 Clients using asymmetric keys for proof-of-possession should be aware 2287 of the consequences of using the same key pair for proof-of- 2288 possession towards different RSs. A set of colluding RSs or an 2289 attacker able to obtain the access tokens will be able to link the 2290 requests, or even to determine the client's identity. 2292 An unprotected response to an unauthorized request (see Section 5.3) 2293 may disclose information about RS and/or its existing relationship 2294 with C. It is advisable to include as little information as possible 2295 in an unencrypted response. Even the absolute URI of the AS may 2296 reveal sensitive information about the service that RS provides. 2297 Developers must ensure that the RS does not disclose information that 2298 has an impact on the privacy of the stakeholders in the "AS Request 2299 Creation Hints". They may choose to use a different mechanism for 2300 the discovery of the AS if necessary. If means of encrypting 2301 communication between C and RS already exist, more detailed 2302 information may be included with an error response to provide C with 2303 sufficient information to react on that particular error. 2305 8. IANA Considerations 2307 This document creates several registries with a registration policy 2308 of "Expert Review"; guidelines to the experts are given in 2309 Section 8.17. 2311 8.1. ACE Authorization Server Request Creation Hints 2313 This specification establishes the IANA "ACE Authorization Server 2314 Request Creation Hints" registry. The registry has been created to 2315 use the "Expert Review" registration procedure [RFC8126]. It should 2316 be noted that, in addition to the expert review, some portions of the 2317 registry require a specification, potentially a Standards Track RFC, 2318 be supplied as well. 2320 The columns of the registry are: 2322 Name The name of the parameter 2324 CBOR Key CBOR map key for the parameter. Different ranges of values 2325 use different registration policies [RFC8126]. Integer values 2326 from -256 to 255 are designated as Standards Action. Integer 2327 values from -65536 to -257 and from 256 to 65535 are designated as 2328 Specification Required. Integer values greater than 65535 are 2329 designated as Expert Review. Integer values less than -65536 are 2330 marked as Private Use. 2332 Value Type The CBOR data types allowable for the values of this 2333 parameter. 2335 Reference This contains a pointer to the public specification of the 2336 request creation hint abbreviation, if one exists. 2338 This registry will be initially populated by the values in Figure 2. 2339 The Reference column for all of these entries will be this document. 2341 8.2. CoRE Resource Type Registry 2343 IANA is requested to register a new Resource Type (rt=) Link Target 2344 Attribute in the "Resource Type (rt=) Link Target Attribute Values" 2345 subregistry under the "Constrained RESTful Environments (CoRE) 2346 Parameters" [IANA.CoreParameters] registry: 2348 * Value: "ace.ai" 2349 * Description: ACE-OAuth authz-info endpoint resource. 2350 * Reference: [this document] 2352 Specific ACE-OAuth profiles can use this common resource type for 2353 defining their profile-specific discovery processes. 2355 8.3. OAuth Extensions Error Registration 2357 This specification registers the following error values in the OAuth 2358 Extensions Error registry [IANA.OAuthExtensionsErrorRegistry]. 2360 * Error name: "unsupported_pop_key" 2361 * Error usage location: token error response 2362 * Related protocol extension: [this document] 2363 * Change Controller: IETF 2364 * Specification document(s): Section 5.8.3 of [this document] 2366 * Error name: "incompatible_ace_profiles" 2367 * Error usage location: token error response 2368 * Related protocol extension: [this document] 2369 * Change Controller: IETF 2370 * Specification document(s): Section 5.8.3 of [this document] 2372 8.4. OAuth Error Code CBOR Mappings Registry 2374 This specification establishes the IANA "OAuth Error Code CBOR 2375 Mappings" registry. The registry has been created to use the "Expert 2376 Review" registration procedure [RFC8126], except for the value range 2377 designated for private use. 2379 The columns of the registry are: 2381 Name The OAuth Error Code name, refers to the name in Section 5.2. 2382 of [RFC6749], e.g., "invalid_request". 2383 CBOR Value CBOR abbreviation for this error code. Integer values 2384 less than -65536 are marked as "Private Use", all other values use 2385 the registration policy "Expert Review" [RFC8126]. 2386 Reference This contains a pointer to the public specification of the 2387 error code abbreviation, if one exists. 2388 Original Specification This contains a pointer to the public 2389 specification of the error code, if one exists. 2391 This registry will be initially populated by the values in Figure 10. 2392 The Reference column for all of these entries will be this document. 2394 8.5. OAuth Grant Type CBOR Mappings 2396 This specification establishes the IANA "OAuth Grant Type CBOR 2397 Mappings" registry. The registry has been created to use the "Expert 2398 Review" registration procedure [RFC8126], except for the value range 2399 designated for private use. 2401 The columns of this registry are: 2403 Name The name of the grant type as specified in Section 1.3 of 2404 [RFC6749]. 2405 CBOR Value CBOR abbreviation for this grant type. Integer values 2406 less than -65536 are marked as "Private Use", all other values use 2407 the registration policy "Expert Review" [RFC8126]. 2408 Reference This contains a pointer to the public specification of the 2409 grant type abbreviation, if one exists. 2410 Original Specification This contains a pointer to the public 2411 specification of the grant type, if one exists. 2413 This registry will be initially populated by the values in Figure 11. 2414 The Reference column for all of these entries will be this document. 2416 8.6. OAuth Access Token Types 2418 This section registers the following new token type in the "OAuth 2419 Access Token Types" registry [IANA.OAuthAccessTokenTypes]. 2421 * Type name: "PoP" 2422 * Additional Token Endpoint Response Parameters: "cnf", "rs_cnf" see 2423 section 3.1 of [RFC8747] and section 3.1 of 2424 [I-D.ietf-ace-oauth-params]. 2425 * HTTP Authentication Scheme(s): N/A 2426 * Change Controller: IETF 2427 * Specification document(s): [this document] 2429 8.7. OAuth Access Token Type CBOR Mappings 2431 This specification established the IANA "OAuth Access Token Type CBOR 2432 Mappings" registry. The registry has been created to use the "Expert 2433 Review" registration procedure [RFC8126], except for the value range 2434 designated for private use. 2436 The columns of this registry are: 2438 Name The name of token type as registered in the OAuth Access Token 2439 Types registry, e.g., "Bearer". 2440 CBOR Value CBOR abbreviation for this token type. Integer values 2441 less than -65536 are marked as "Private Use", all other values use 2442 the registration policy "Expert Review" [RFC8126]. 2443 Reference This contains a pointer to the public specification of the 2444 OAuth token type abbreviation, if one exists. 2445 Original Specification This contains a pointer to the public 2446 specification of the OAuth token type, if one exists. 2448 8.7.1. Initial Registry Contents 2450 * Name: "Bearer" 2451 * Value: 1 2452 * Reference: [this document] 2453 * Original Specification: [RFC6749] 2455 * Name: "PoP" 2456 * Value: 2 2457 * Reference: [this document] 2458 * Original Specification: [this document] 2460 8.8. ACE Profile Registry 2462 This specification establishes the IANA "ACE Profile" registry. The 2463 registry has been created to use the "Expert Review" registration 2464 procedure [RFC8126]. It should be noted that, in addition to the 2465 expert review, some portions of the registry require a specification, 2466 potentially a Standards Track RFC, be supplied as well. 2468 The columns of this registry are: 2470 Name The name of the profile, to be used as value of the profile 2471 attribute. 2472 Description Text giving an overview of the profile and the context 2473 it is developed for. 2474 CBOR Value CBOR abbreviation for this profile name. Different 2475 ranges of values use different registration policies [RFC8126]. 2476 Integer values from -256 to 255 are designated as Standards 2477 Action. Integer values from -65536 to -257 and from 256 to 65535 2478 are designated as Specification Required. Integer values greater 2479 than 65535 are designated as "Expert Review". Integer values less 2480 than -65536 are marked as Private Use. 2481 Reference This contains a pointer to the public specification of the 2482 profile abbreviation, if one exists. 2484 This registry will be initially empty and will be populated by the 2485 registrations from the ACE framework profiles. 2487 8.9. OAuth Parameter Registration 2489 This specification registers the following parameter in the "OAuth 2490 Parameters" registry [IANA.OAuthParameters]: 2492 * Name: "ace_profile" 2493 * Parameter Usage Location: token response 2494 * Change Controller: IETF 2495 * Reference: Section 5.8.2 and Section 5.8.4.3 of [this document] 2497 8.10. OAuth Parameters CBOR Mappings Registry 2499 This specification establishes the IANA "OAuth Parameters CBOR 2500 Mappings" registry. The registry has been created to use the "Expert 2501 Review" registration procedure [RFC8126], except for the value range 2502 designated for private use. 2504 The columns of this registry are: 2506 Name The OAuth Parameter name, refers to the name in the OAuth 2507 parameter registry, e.g., "client_id". 2509 CBOR Key CBOR map key for this parameter. Integer values less than 2510 -65536 are marked as "Private Use", all other values use the 2511 registration policy "Expert Review" [RFC8126]. 2512 Value Type The allowable CBOR data types for values of this 2513 parameter. 2514 Reference This contains a pointer to the public specification of the 2515 OAuth parameter abbreviation, if one exists. 2516 Original Specification This contains a pointer to the public 2517 specification of the OAuth parameter, if one exists. 2519 This registry will be initially populated by the values in Figure 12. 2520 The Reference column for all of these entries will be this document. 2522 8.11. OAuth Introspection Response Parameter Registration 2524 This specification registers the following parameters in the OAuth 2525 Token Introspection Response registry 2526 [IANA.TokenIntrospectionResponse]. 2528 * Name: "ace_profile" 2529 * Description: The ACE profile used between client and RS. 2530 * Change Controller: IETF 2531 * Reference: Section 5.9.2 of [this document] 2533 * Name: "cnonce" 2534 * Description: "client-nonce". A nonce previously provided to the 2535 AS by the RS via the client. Used to verify token freshness when 2536 the RS cannot synchronize its clock with the AS. 2537 * Change Controller: IETF 2538 * Reference: Section 5.9.2 of [this document] 2540 * Name: "cti" 2541 * Description: "CWT ID". The identifier of a CWT as defined in 2542 [RFC8392]. 2543 * Change Controller: IETF 2544 * Reference: Section 5.9.2 of [this document] 2546 * Name: "exi" 2547 * Description: "Expires in". Lifetime of the token in seconds from 2548 the time the RS first sees it. Used to implement a weaker from of 2549 token expiration for devices that cannot synchronize their 2550 internal clocks. 2551 * Change Controller: IETF 2552 * Reference: Section 5.9.2 of [this document] 2554 8.12. OAuth Token Introspection Response CBOR Mappings Registry 2556 This specification establishes the IANA "OAuth Token Introspection 2557 Response CBOR Mappings" registry. The registry has been created to 2558 use the "Expert Review" registration procedure [RFC8126], except for 2559 the value range designated for private use. 2561 The columns of this registry are: 2563 Name The OAuth Parameter name, refers to the name in the OAuth 2564 parameter registry, e.g., "client_id". 2565 CBOR Key CBOR map key for this parameter. Integer values less than 2566 -65536 are marked as "Private Use", all other values use the 2567 registration policy "Expert Review" [RFC8126]. 2568 Value Type The allowable CBOR data types for values of this 2569 parameter. 2570 Reference This contains a pointer to the public specification of the 2571 introspection response parameter abbreviation, if one exists. 2572 Original Specification This contains a pointer to the public 2573 specification of OAuth Token Introspection parameter, if one 2574 exists. 2576 This registry will be initially populated by the values in Figure 16. 2577 The Reference column for all of these entries will be this document. 2579 Note that the mappings of parameters corresponding to claim names 2580 intentionally coincide with the CWT claim name mappings from 2581 [RFC8392]. 2583 8.13. JSON Web Token Claims 2585 This specification registers the following new claims in the JSON Web 2586 Token (JWT) registry of JSON Web Token Claims 2587 [IANA.JsonWebTokenClaims]: 2589 * Claim Name: "ace_profile" 2590 * Claim Description: The ACE profile a token is supposed to be used 2591 with. 2592 * Change Controller: IETF 2593 * Reference: Section 5.10 of [this document] 2595 * Claim Name: "cnonce" 2596 * Claim Description: "client-nonce". A nonce previously provided to 2597 the AS by the RS via the client. Used to verify token freshness 2598 when the RS cannot synchronize its clock with the AS. 2599 * Change Controller: IETF 2600 * Reference: Section 5.10 of [this document] 2601 * Claim Name: "exi" 2602 * Claim Description: "Expires in". Lifetime of the token in seconds 2603 from the time the RS first sees it. Used to implement a weaker 2604 from of token expiration for devices that cannot synchronize their 2605 internal clocks. 2606 * Change Controller: IETF 2607 * Reference: Section 5.10.3 of [this document] 2609 8.14. CBOR Web Token Claims 2611 This specification registers the following new claims in the "CBOR 2612 Web Token (CWT) Claims" registry [IANA.CborWebTokenClaims]. 2614 * Claim Name: "ace_profile" 2615 * Claim Description: The ACE profile a token is supposed to be used 2616 with. 2617 * JWT Claim Name: ace_profile 2618 * Claim Key: TBD (suggested: 38) 2619 * Claim Value Type(s): integer 2620 * Change Controller: IETF 2621 * Specification Document(s): Section 5.10 of [this document] 2623 * Claim Name: "cnonce" 2624 * Claim Description: The client-nonce sent to the AS by the RS via 2625 the client. 2626 * JWT Claim Name: cnonce 2627 * Claim Key: TBD (suggested: 39) 2628 * Claim Value Type(s): byte string 2629 * Change Controller: IETF 2630 * Specification Document(s): Section 5.10 of [this document] 2632 * Claim Name: "exi" 2633 * Claim Description: The expiration time of a token measured from 2634 when it was received at the RS in seconds. 2635 * JWT Claim Name: exi 2636 * Claim Key: TBD (suggested: 40) 2637 * Claim Value Type(s): integer 2638 * Change Controller: IETF 2639 * Specification Document(s): Section 5.10.3 of [this document] 2641 * Claim Name: "scope" 2642 * Claim Description: The scope of an access token as defined in 2643 [RFC6749]. 2644 * JWT Claim Name: scope 2645 * Claim Key: TBD (suggested: 9) 2646 * Claim Value Type(s): byte string or text string 2647 * Change Controller: IETF 2648 * Specification Document(s): Section 4.2 of [RFC8693] 2650 8.15. Media Type Registrations 2652 This specification registers the 'application/ace+cbor' media type 2653 for messages of the protocols defined in this document carrying 2654 parameters encoded in CBOR. This registration follows the procedures 2655 specified in [RFC6838]. 2657 Type name: application 2659 Subtype name: ace+cbor 2661 Required parameters: N/A 2663 Optional parameters: N/A 2665 Encoding considerations: Must be encoded as CBOR map containing the 2666 protocol parameters defined in [this document]. 2668 Security considerations: See Section 6 of [this document] 2670 Interoperability considerations: N/A 2672 Published specification: [this document] 2674 Applications that use this media type: The type is used by 2675 authorization servers, clients and resource servers that support the 2676 ACE framework with CBOR encoding as specified in [this document]. 2678 Fragment identifier considerations: N/A 2680 Additional information: N/A 2682 Person & email address to contact for further information: 2683 2685 Intended usage: COMMON 2687 Restrictions on usage: none 2689 Author: Ludwig Seitz 2691 Change controller: IETF 2693 8.16. CoAP Content-Format Registry 2695 This specification registers the following entry to the "CoAP 2696 Content-Formats" registry: 2698 Media Type: application/ace+cbor 2700 Encoding: - 2702 ID: TBD (suggested: 19) 2704 Reference: [this document] 2706 8.17. Expert Review Instructions 2708 All of the IANA registries established in this document are defined 2709 to use a registration policy of Expert Review. This section gives 2710 some general guidelines for what the experts should be looking for, 2711 but they are being designated as experts for a reason, so they should 2712 be given substantial latitude. 2714 Expert reviewers should take into consideration the following points: 2716 * Point squatting should be discouraged. Reviewers are encouraged 2717 to get sufficient information for registration requests to ensure 2718 that the usage is not going to duplicate one that is already 2719 registered, and that the point is likely to be used in 2720 deployments. The zones tagged as private use are intended for 2721 testing purposes and closed environments; code points in other 2722 ranges should not be assigned for testing. 2723 * Specifications are needed for the first-come, first-serve range if 2724 they are expected to be used outside of closed environments in an 2725 interoperable way. When specifications are not provided, the 2726 description provided needs to have sufficient information to 2727 identify what the point is being used for. 2728 * Experts should take into account the expected usage of fields when 2729 approving point assignment. The fact that there is a range for 2730 standards track documents does not mean that a standards track 2731 document cannot have points assigned outside of that range. The 2732 length of the encoded value should be weighed against how many 2733 code points of that length are left, the size of device it will be 2734 used on. 2735 * Since a high degree of overlap is expected between these 2736 registries and the contents of the OAuth parameters 2737 [IANA.OAuthParameters] registries, experts should require new 2738 registrations to maintain alignment with parameters from OAuth 2739 that have comparable functionality. Deviation from this alignment 2740 should only be allowed if there are functional differences, that 2741 are motivated by the use case and that cannot be easily or 2742 efficiently addressed by comparable OAuth parameters. 2744 9. Acknowledgments 2746 This document is a product of the ACE working group of the IETF. 2748 Thanks to Eve Maler for her contributions to the use of OAuth 2.0 and 2749 UMA in IoT scenarios, Robert Taylor for his discussion input, and 2750 Malisa Vucinic for his input on the predecessors of this proposal. 2752 Thanks to the authors of draft-ietf-oauth-pop-key-distribution, from 2753 where parts of the security considerations where copied. 2755 Thanks to Stefanie Gerdes, Olaf Bergmann, and Carsten Bormann for 2756 contributing their work on AS discovery from draft-gerdes-ace-dcaf- 2757 authorize (see Section 5.1) and the considerations on multiple access 2758 tokens. 2760 Thanks to Jim Schaad and Mike Jones for their comprehensive reviews. 2762 Thanks to Benjamin Kaduk for his input on various questions related 2763 to this work. 2765 Thanks to Cigdem Sengul for some very useful review comments. 2767 Thanks to Carsten Bormann for contributing the text for the CoRE 2768 Resource Type registry. 2770 Thanks to Roman Danyliw for suggesting the Appendix E (including its 2771 contents). 2773 Ludwig Seitz and Goeran Selander worked on this document as part of 2774 the CelticPlus project CyberWI, with funding from Vinnova. Ludwig 2775 Seitz was also received further funding for this work by Vinnova in 2776 the context of the CelticNext project Critisec. 2778 10. References 2780 10.1. Normative References 2782 [I-D.ietf-ace-oauth-params] 2783 Seitz, L., "Additional OAuth Parameters for Authorization 2784 in Constrained Environments (ACE)", Work in Progress, 2785 Internet-Draft, draft-ietf-ace-oauth-params-15, 6 May 2786 2021, . 2789 [IANA.CborWebTokenClaims] 2790 IANA, "CBOR Web Token (CWT) Claims", 2791 . 2794 [IANA.CoreParameters] 2795 IANA, "Constrained RESTful Environments (CoRE) 2796 Parameters", . 2799 [IANA.JsonWebTokenClaims] 2800 IANA, "JSON Web Token Claims", 2801 . 2803 [IANA.OAuthAccessTokenTypes] 2804 IANA, "OAuth Access Token Types", 2805 . 2808 [IANA.OAuthExtensionsErrorRegistry] 2809 IANA, "OAuth Extensions Error Registry", 2810 . 2813 [IANA.OAuthParameters] 2814 IANA, "OAuth Parameters", 2815 . 2818 [IANA.TokenIntrospectionResponse] 2819 IANA, "OAuth Token Introspection Response", 2820 . 2823 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2824 Requirement Levels", BCP 14, RFC 2119, 2825 DOI 10.17487/RFC2119, March 1997, 2826 . 2828 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2829 Resource Identifier (URI): Generic Syntax", STD 66, 2830 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2831 . 2833 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 2834 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 2835 January 2012, . 2837 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 2838 RFC 6749, DOI 10.17487/RFC6749, October 2012, 2839 . 2841 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 2842 Framework: Bearer Token Usage", RFC 6750, 2843 DOI 10.17487/RFC6750, October 2012, 2844 . 2846 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 2847 Specifications and Registration Procedures", BCP 13, 2848 RFC 6838, DOI 10.17487/RFC6838, January 2013, 2849 . 2851 [RFC6920] Farrell, S., Kutscher, D., Dannewitz, C., Ohlman, B., 2852 Keranen, A., and P. Hallam-Baker, "Naming Things with 2853 Hashes", RFC 6920, DOI 10.17487/RFC6920, April 2013, 2854 . 2856 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2857 Application Protocol (CoAP)", RFC 7252, 2858 DOI 10.17487/RFC7252, June 2014, 2859 . 2861 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 2862 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 2863 . 2865 [RFC7662] Richer, J., Ed., "OAuth 2.0 Token Introspection", 2866 RFC 7662, DOI 10.17487/RFC7662, October 2015, 2867 . 2869 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2870 Writing an IANA Considerations Section in RFCs", BCP 26, 2871 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2872 . 2874 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 2875 RFC 8152, DOI 10.17487/RFC8152, July 2017, 2876 . 2878 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2879 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2880 May 2017, . 2882 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2883 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2884 May 2018, . 2886 [RFC8693] Jones, M., Nadalin, A., Campbell, B., Ed., Bradley, J., 2887 and C. Mortimore, "OAuth 2.0 Token Exchange", RFC 8693, 2888 DOI 10.17487/RFC8693, January 2020, 2889 . 2891 [RFC8747] Jones, M., Seitz, L., Selander, G., Erdtman, S., and H. 2892 Tschofenig, "Proof-of-Possession Key Semantics for CBOR 2893 Web Tokens (CWTs)", RFC 8747, DOI 10.17487/RFC8747, March 2894 2020, . 2896 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 2897 Representation (CBOR)", STD 94, RFC 8949, 2898 DOI 10.17487/RFC8949, December 2020, 2899 . 2901 10.2. Informative References 2903 [BLE] Bluetooth SIG, "Bluetooth Core Specification v5.1", 2904 Section 4.4, January 2019, 2905 . 2908 [I-D.erdtman-ace-rpcc] 2909 Seitz, L. and S. Erdtman, "Raw-Public-Key and Pre-Shared- 2910 Key as OAuth client credentials", Work in Progress, 2911 Internet-Draft, draft-erdtman-ace-rpcc-02, 30 October 2912 2017, . 2915 [I-D.ietf-ace-dtls-authorize] 2916 Gerdes, S., Bergmann, O., Bormann, C., Selander, G., and 2917 L. Seitz, "Datagram Transport Layer Security (DTLS) 2918 Profile for Authentication and Authorization for 2919 Constrained Environments (ACE)", Work in Progress, 2920 Internet-Draft, draft-ietf-ace-dtls-authorize-18, 4 June 2921 2021, . 2924 [I-D.ietf-ace-oscore-profile] 2925 Palombini, F., Seitz, L., Selander, G., and M. Gunnarsson, 2926 "OSCORE Profile of the Authentication and Authorization 2927 for Constrained Environments Framework", Work in Progress, 2928 Internet-Draft, draft-ietf-ace-oscore-profile-19, 6 May 2929 2021, . 2932 [I-D.ietf-quic-transport] 2933 Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 2934 and Secure Transport", Work in Progress, Internet-Draft, 2935 draft-ietf-quic-transport-34, 14 January 2021, 2936 . 2939 [I-D.ietf-tls-dtls13] 2940 Rescorla, E., Tschofenig, H., and N. Modadugu, "The 2941 Datagram Transport Layer Security (DTLS) Protocol Version 2942 1.3", Work in Progress, Internet-Draft, draft-ietf-tls- 2943 dtls13-43, 30 April 2021, . 2946 [Margi10impact] 2947 Margi, C. B., de Oliveira, B.T., de Sousa, G.T., Simplicio 2948 Jr, M.A., Barreto, P.S.L.M., Carvalho, T.C.M.B., Naeslund, 2949 M., and R. Gold, "Impact of Operating Systems on Wireless 2950 Sensor Networks (Security) Applications and Testbeds", 2951 Proceedings of the 19th International Conference on 2952 Computer Communications and Networks (ICCCN), August 2010. 2954 [MQTT5.0] Banks, A., Briggs, E., Borgendale, K., and R. Gupta, "MQTT 2955 Version 5.0", OASIS Standard, March 2019, 2956 . 2959 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 2960 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 2961 . 2963 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2964 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2965 . 2967 [RFC6819] Lodderstedt, T., Ed., McGloin, M., and P. Hunt, "OAuth 2.0 2968 Threat Model and Security Considerations", RFC 6819, 2969 DOI 10.17487/RFC6819, January 2013, 2970 . 2972 [RFC7009] Lodderstedt, T., Ed., Dronia, S., and M. Scurtescu, "OAuth 2973 2.0 Token Revocation", RFC 7009, DOI 10.17487/RFC7009, 2974 August 2013, . 2976 [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for 2977 Constrained-Node Networks", RFC 7228, 2978 DOI 10.17487/RFC7228, May 2014, 2979 . 2981 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2982 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 2983 DOI 10.17487/RFC7231, June 2014, 2984 . 2986 [RFC7521] Campbell, B., Mortimore, C., Jones, M., and Y. Goland, 2987 "Assertion Framework for OAuth 2.0 Client Authentication 2988 and Authorization Grants", RFC 7521, DOI 10.17487/RFC7521, 2989 May 2015, . 2991 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 2992 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 2993 DOI 10.17487/RFC7540, May 2015, 2994 . 2996 [RFC7591] Richer, J., Ed., Jones, M., Bradley, J., Machulak, M., and 2997 P. Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", 2998 RFC 7591, DOI 10.17487/RFC7591, July 2015, 2999 . 3001 [RFC7641] Hartke, K., "Observing Resources in the Constrained 3002 Application Protocol (CoAP)", RFC 7641, 3003 DOI 10.17487/RFC7641, September 2015, 3004 . 3006 [RFC7744] Seitz, L., Ed., Gerdes, S., Ed., Selander, G., Mani, M., 3007 and S. Kumar, "Use Cases for Authentication and 3008 Authorization in Constrained Environments", RFC 7744, 3009 DOI 10.17487/RFC7744, January 2016, 3010 . 3012 [RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in 3013 the Constrained Application Protocol (CoAP)", RFC 7959, 3014 DOI 10.17487/RFC7959, August 2016, 3015 . 3017 [RFC8252] Denniss, W. and J. Bradley, "OAuth 2.0 for Native Apps", 3018 BCP 212, RFC 8252, DOI 10.17487/RFC8252, October 2017, 3019 . 3021 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 3022 Interchange Format", STD 90, RFC 8259, 3023 DOI 10.17487/RFC8259, December 2017, 3024 . 3026 [RFC8414] Jones, M., Sakimura, N., and J. Bradley, "OAuth 2.0 3027 Authorization Server Metadata", RFC 8414, 3028 DOI 10.17487/RFC8414, June 2018, 3029 . 3031 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 3032 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 3033 . 3035 [RFC8516] Keranen, A., ""Too Many Requests" Response Code for the 3036 Constrained Application Protocol", RFC 8516, 3037 DOI 10.17487/RFC8516, January 2019, 3038 . 3040 [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 3041 "Object Security for Constrained RESTful Environments 3042 (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, 3043 . 3045 [RFC8628] Denniss, W., Bradley, J., Jones, M., and H. Tschofenig, 3046 "OAuth 2.0 Device Authorization Grant", RFC 8628, 3047 DOI 10.17487/RFC8628, August 2019, 3048 . 3050 Appendix A. Design Justification 3052 This section provides further insight into the design decisions of 3053 the solution documented in this document. Section 3 lists several 3054 building blocks and briefly summarizes their importance. The 3055 justification for offering some of those building blocks, as opposed 3056 to using OAuth 2.0 as is, is given below. 3058 Common IoT constraints are: 3060 Low Power Radio: 3062 Many IoT devices are equipped with a small battery which needs to 3063 last for a long time. For many constrained wireless devices, the 3064 highest energy cost is associated to transmitting or receiving 3065 messages (roughly by a factor of 10 compared to AES) 3066 [Margi10impact]. It is therefore important to keep the total 3067 communication overhead low, including minimizing the number and 3068 size of messages sent and received, which has an impact of choice 3069 on the message format and protocol. By using CoAP over UDP and 3070 CBOR encoded messages, some of these aspects are addressed. 3071 Security protocols contribute to the communication overhead and 3072 can, in some cases, be optimized. For example, authentication and 3073 key establishment may, in certain cases where security 3074 requirements allow, be replaced by provisioning of security 3075 context by a trusted third party, using transport or application- 3076 layer security. 3077 Low CPU Speed: 3078 Some IoT devices are equipped with processors that are 3079 significantly slower than those found in most current devices on 3080 the Internet. This typically has implications on what timely 3081 cryptographic operations a device is capable of performing, which 3082 in turn impacts, e.g., protocol latency. Symmetric key 3083 cryptography may be used instead of the computationally more 3084 expensive public key cryptography where the security requirements 3085 so allow, but this may also require support for trusted-third- 3086 party-assisted secret key establishment using transport- or 3087 application-layer security. 3088 Small Amount of Memory: 3089 Microcontrollers embedded in IoT devices are often equipped with 3090 only a small amount of RAM and flash memory, which places 3091 limitations on what kind of processing can be performed and how 3092 much code can be put on those devices. To reduce code size, fewer 3093 and smaller protocol implementations can be put on the firmware of 3094 such a device. In this case, CoAP may be used instead of HTTP, 3095 symmetric-key cryptography instead of public-key cryptography, and 3096 CBOR instead of JSON. An authentication and key establishment 3097 protocol, e.g., the DTLS handshake, in comparison with assisted 3098 key establishment, also has an impact on memory and code 3099 footprints. 3100 User Interface Limitations: 3101 Protecting access to resources is both an important security as 3102 well as privacy feature. End users and enterprise customers may 3103 not want to give access to the data collected by their IoT device 3104 or to functions it may offer to third parties. Since the 3105 classical approach of requesting permissions from end users via a 3106 rich user interface does not work in many IoT deployment 3107 scenarios, these functions need to be delegated to user-controlled 3108 devices that are better suitable for such tasks, such as smart 3109 phones and tablets. 3111 Communication Constraints: 3112 In certain constrained settings an IoT device may not be able to 3113 communicate with a given device at all times. Devices may be 3114 sleeping, or just disconnected from the Internet because of 3115 general lack of connectivity in the area, for cost reasons, or for 3116 security reasons, e.g., to avoid an entry point for Denial-of- 3117 Service attacks. 3118 The communication interactions this framework builds upon (as 3119 shown graphically in Figure 1) may be accomplished using a variety 3120 of different protocols, and not all parts of the message flow are 3121 used in all applications due to the communication constraints. 3122 Deployments making use of CoAP are expected, but this framework is 3123 not limited to them. Other protocols such as HTTP, or even 3124 protocols such as Bluetooth Smart communication that do not 3125 necessarily use IP, could also be used. The latter raises the 3126 need for application-layer security over the various interfaces. 3128 In the light of these constraints we have made the following design 3129 decisions: 3131 CBOR, COSE, CWT: 3132 When using this framework, it is RECOMMENDED to use CBOR [RFC8949] 3133 as data format. Where CBOR data needs to be protected, the use of 3134 COSE [RFC8152] is RECOMMENDED. Furthermore, where self-contained 3135 tokens are needed, it is RECOMMENDED to use of CWT [RFC8392]. 3136 These measures aim at reducing the size of messages sent over the 3137 wire, the RAM size of data objects that need to be kept in memory 3138 and the size of libraries that devices need to support. 3139 CoAP: 3140 When using this framework, it is RECOMMENDED to use of CoAP 3141 [RFC7252] instead of HTTP. This does not preclude the use of 3142 other protocols specifically aimed at constrained devices, like, 3143 e.g., Bluetooth Low Energy (see Section 3.2). This aims again at 3144 reducing the size of messages sent over the wire, the RAM size of 3145 data objects that need to be kept in memory and the size of 3146 libraries that devices need to support. 3147 Access Information: 3148 This framework defines the name "Access Information" for data 3149 concerning the RS that the AS returns to the client in an access 3150 token response (see Section 5.8.2). This aims at enabling 3151 scenarios where a powerful client, supporting multiple profiles, 3152 needs to interact with an RS for which it does not know the 3153 supported profiles and the raw public key. 3154 Proof-of-Possession: 3155 This framework makes use of proof-of-possession tokens, using the 3156 "cnf" claim [RFC8747]. A request parameter "cnf" and a Response 3157 parameter "cnf", both having a value space semantically and 3158 syntactically identical to the "cnf" claim, are defined for the 3159 token endpoint, to allow requesting and stating confirmation keys. 3160 This aims at making token theft harder. Token theft is 3161 specifically relevant in constrained use cases, as communication 3162 often passes through middle-boxes, which could be able to steal 3163 bearer tokens and use them to gain unauthorized access. 3164 Authz-Info endpoint: 3165 This framework introduces a new way of providing access tokens to 3166 an RS by exposing a authz-info endpoint, to which access tokens 3167 can be POSTed. This aims at reducing the size of the request 3168 message and the code complexity at the RS. The size of the 3169 request message is problematic, since many constrained protocols 3170 have severe message size limitations at the physical layer (e.g., 3171 in the order of 100 bytes). This means that larger packets get 3172 fragmented, which in turn combines badly with the high rate of 3173 packet loss, and the need to retransmit the whole message if one 3174 packet gets lost. Thus separating sending of the request and 3175 sending of the access tokens helps to reduce fragmentation. 3176 Client Credentials Grant: 3177 In this framework the use of the client credentials grant is 3178 RECOMMENDED for machine-to-machine communication use cases, where 3179 manual intervention of the resource owner to produce a grant token 3180 is not feasible. The intention is that the resource owner would 3181 instead pre-arrange authorization with the AS, based on the 3182 client's own credentials. The client can then (without manual 3183 intervention) obtain access tokens from the AS. 3184 Introspection: 3185 In this framework the use of access token introspection is 3186 RECOMMENDED in cases where the client is constrained in a way that 3187 it can not easily obtain new access tokens (i.e. it has 3188 connectivity issues that prevent it from communicating with the 3189 AS). In that case it is RECOMMENDED to use a long-term token, 3190 that could be a simple reference. The RS is assumed to be able to 3191 communicate with the AS, and can therefore perform introspection, 3192 in order to learn the claims associated with the token reference. 3193 The advantage of such an approach is that the resource owner can 3194 change the claims associated to the token reference without having 3195 to be in contact with the client, thus granting or revoking access 3196 rights. 3198 Appendix B. Roles and Responsibilities 3200 Resource Owner 3201 * Make sure that the RS is registered at the AS. This includes 3202 making known to the AS which profiles, token_type, scopes, and 3203 key types (symmetric/asymmetric) the RS supports. Also making 3204 it known to the AS which audience(s) the RS identifies itself 3205 with. 3207 * Make sure that clients can discover the AS that is in charge of 3208 the RS. 3209 * If the client-credentials grant is used, make sure that the AS 3210 has the necessary, up-to-date, access control policies for the 3211 RS. 3212 Requesting Party 3213 * Make sure that the client is provisioned the necessary 3214 credentials to authenticate to the AS. 3215 * Make sure that the client is configured to follow the security 3216 requirements of the Requesting Party when issuing requests 3217 (e.g., minimum communication security requirements, trust 3218 anchors). 3219 * Register the client at the AS. This includes making known to 3220 the AS which profiles, token_types, and key types (symmetric/ 3221 asymmetric) the client. 3222 Authorization Server 3223 * Register the RS and manage corresponding security contexts. 3224 * Register clients and authentication credentials. 3225 * Allow Resource Owners to configure and update access control 3226 policies related to their registered RSs. 3227 * Expose the token endpoint to allow clients to request tokens. 3228 * Authenticate clients that wish to request a token. 3229 * Process a token request using the authorization policies 3230 configured for the RS. 3231 * Optionally: Expose the introspection endpoint that allows RS's 3232 to submit token introspection requests. 3233 * If providing an introspection endpoint: Authenticate RSs that 3234 wish to get an introspection response. 3235 * If providing an introspection endpoint: Process token 3236 introspection requests. 3237 * Optionally: Handle token revocation. 3238 * Optionally: Provide discovery metadata. See [RFC8414] 3239 * Optionally: Handle refresh tokens. 3240 Client 3241 * Discover the AS in charge of the RS that is to be targeted with 3242 a request. 3243 * Submit the token request (see step (A) of Figure 1). 3244 - Authenticate to the AS. 3245 - Optionally (if not pre-configured): Specify which RS, which 3246 resource(s), and which action(s) the request(s) will target. 3247 - If raw public keys (rpk) or certificates are used, make sure 3248 the AS has the right rpk or certificate for this client. 3249 * Process the access token and Access Information (see step (B) 3250 of Figure 1). 3251 - Check that the Access Information provides the necessary 3252 security parameters (e.g., PoP key, information on 3253 communication security protocols supported by the RS). 3254 - Safely store the proof-of-possession key. 3256 - If provided by the AS: Safely store the refresh token. 3257 * Send the token and request to the RS (see step (C) of 3258 Figure 1). 3259 - Authenticate towards the RS (this could coincide with the 3260 proof of possession process). 3261 - Transmit the token as specified by the AS (default is to the 3262 authz-info endpoint, alternative options are specified by 3263 profiles). 3264 - Perform the proof-of-possession procedure as specified by 3265 the profile in use (this may already have been taken care of 3266 through the authentication procedure). 3267 * Process the RS response (see step (F) of Figure 1) of the RS. 3268 Resource Server 3269 * Expose a way to submit access tokens. By default this is the 3270 authz-info endpoint. 3271 * Process an access token. 3272 - Verify the token is from a recognized AS. 3273 - Check the token's integrity. 3274 - Verify that the token applies to this RS. 3275 - Check that the token has not expired (if the token provides 3276 expiration information). 3277 - Store the token so that it can be retrieved in the context 3278 of a matching request. 3279 Note: The order proposed here is not normative, any process 3280 that arrives at an equivalent result can be used. A noteworthy 3281 consideration is whether one can use cheap operations early on 3282 to quickly discard non-applicable or invalid tokens, before 3283 performing expensive cryptographic operations (e.g. doing an 3284 expiration check before verifying a signature). 3285 * Process a request. 3286 - Set up communication security with the client. 3287 - Authenticate the client. 3288 - Match the client against existing tokens. 3289 - Check that tokens belonging to the client actually authorize 3290 the requested action. 3291 - Optionally: Check that the matching tokens are still valid, 3292 using introspection (if this is possible.) 3293 * Send a response following the agreed upon communication 3294 security mechanism(s). 3295 * Safely store credentials such as raw public keys for 3296 authentication or proof-of-possession keys linked to access 3297 tokens. 3299 Appendix C. Requirements on Profiles 3301 This section lists the requirements on profiles of this framework, 3302 for the convenience of profile designers. 3304 * Optionally define new methods for the client to discover the 3305 necessary permissions and AS for accessing a resource, different 3306 from the one proposed in Section 5.1. Section 4 3307 * Optionally specify new grant types. Section 5.4 3308 * Optionally define the use of client certificates as client 3309 credential type. Section 5.5 3310 * Specify the communication protocol the client and RS the must use 3311 (e.g., CoAP). Section 5 and Section 5.8.4.3 3312 * Specify the security protocol the client and RS must use to 3313 protect their communication (e.g., OSCORE or DTLS). This must 3314 provide encryption, integrity and replay protection. 3315 Section 5.8.4.3 3316 * Specify how the client and the RS mutually authenticate. 3317 Section 4 3318 * Specify the proof-of-possession protocol(s) and how to select one, 3319 if several are available. Also specify which key types (e.g., 3320 symmetric/asymmetric) are supported by a specific proof-of- 3321 possession protocol. Section 5.8.4.2 3322 * Specify a unique ace_profile identifier. Section 5.8.4.3 3323 * If introspection is supported: Specify the communication and 3324 security protocol for introspection. Section 5.9 3325 * Specify the communication and security protocol for interactions 3326 between client and AS. This must provide encryption, integrity 3327 protection, replay protection and a binding between requests and 3328 responses. Section 5 and Section 5.8 3329 * Specify how/if the authz-info endpoint is protected, including how 3330 error responses are protected. Section 5.10.1 3331 * Optionally define other methods of token transport than the authz- 3332 info endpoint. Section 5.10.1 3334 Appendix D. Assumptions on AS Knowledge about C and RS 3336 This section lists the assumptions on what an AS should know about a 3337 client and an RS in order to be able to respond to requests to the 3338 token and introspection endpoints. How this information is 3339 established is out of scope for this document. 3341 * The identifier of the client or RS. 3342 * The profiles that the client or RS supports. 3343 * The scopes that the RS supports. 3344 * The audiences that the RS identifies with. 3345 * The key types (e.g., pre-shared symmetric key, raw public key, key 3346 length, other key parameters) that the client or RS supports. 3347 * The types of access tokens the RS supports (e.g., CWT). 3348 * If the RS supports CWTs, the COSE parameters for the crypto 3349 wrapper (e.g., algorithm, key-wrap algorithm, key-length) that the 3350 RS supports. 3352 * The expiration time for access tokens issued to this RS (unless 3353 the RS accepts a default time chosen by the AS). 3354 * The symmetric key shared between client and AS (if any). 3355 * The symmetric key shared between RS and AS (if any). 3356 * The raw public key of the client or RS (if any). 3357 * Whether the RS has synchronized time (and thus is able to use the 3358 'exp' claim) or not. 3360 Appendix E. Differences to OAuth 2.0 3362 This document adapts OAuth 2.0 to be suitable for constrained 3363 environments. This sections lists the main differences from the 3364 normative requirements of OAuth 2.0. 3366 * Use of TLS -- OAuth 2.0 requires the use of TLS both to protect 3367 the communication between AS and client when requesting an access 3368 token; between client and RS when accessing a resource and between 3369 AS and RS if introspection is used. This framework requires 3370 similar security properties, but does not require that they be 3371 realized with TLS. See Section 5. 3372 * Cardinality of "grant_type" parameter -- In client-to-AS requests 3373 using OAuth 2.0, the "grant_type" parameter is required (per 3374 [RFC6749]). In this framework, this parameter is optional. See 3375 Section 5.8.1. 3376 * Encoding of "scope" parameter -- In client-to-AS requests using 3377 OAuth 2.0, the "scope" parameter is string encoded (per 3378 [RFC6749]). In this framework, this parameter may also be encoded 3379 as a byte string. See Section 5.8.1. 3380 * Cardinality of "token_type" parameter -- in AS-to-client responses 3381 using OAuth 2.0, the token_type parameter is required (per 3382 [RFC6749]). In this framework, this parameter is optional. See 3383 Section 5.8.2. 3384 * Access token retention -- in OAuth 2.0, the access token may be 3385 sent with every request to the RS. The exact use of access tokens 3386 depends on the semantics of the application and the session 3387 management concept it uses. In this framework, the RS must be 3388 able to store these tokens for later use. See Section 5.10.1. 3390 Appendix F. Deployment Examples 3392 There is a large variety of IoT deployments, as is indicated in 3393 Appendix A, and this section highlights a few common variants. This 3394 section is not normative but illustrates how the framework can be 3395 applied. 3397 For each of the deployment variants, there are a number of possible 3398 security setups between clients, resource servers and authorization 3399 servers. The main focus in the following subsections is on how 3400 authorization of a client request for a resource hosted by an RS is 3401 performed. This requires the security of the requests and responses 3402 between the clients and the RS to be considered. 3404 Note: CBOR diagnostic notation is used for examples of requests and 3405 responses. 3407 F.1. Local Token Validation 3409 In this scenario, the case where the resource server is offline is 3410 considered, i.e., it is not connected to the AS at the time of the 3411 access request. This access procedure involves steps A, B, C, and F 3412 of Figure 1. 3414 Since the resource server must be able to verify the access token 3415 locally, self-contained access tokens must be used. 3417 This example shows the interactions between a client, the 3418 authorization server and a temperature sensor acting as a resource 3419 server. Message exchanges A and B are shown in Figure 17. 3421 A: The client first generates a public-private key pair used for 3422 communication security with the RS. 3423 The client sends a CoAP POST request to the token endpoint at the 3424 AS. The security of this request can be transport or application 3425 layer. It is up the communication security profile to define. In 3426 the example it is assumed that both client and AS have performed 3427 mutual authentication e.g. via DTLS. The request contains the 3428 public key of the client and the Audience parameter set to 3429 "tempSensorInLivingRoom", a value that the temperature sensor 3430 identifies itself with. The AS evaluates the request and 3431 authorizes the client to access the resource. 3432 B: The AS responds with a 2.05 Content response containing the 3433 Access Information, including the access token. The PoP access 3434 token contains the public key of the client, and the Access 3435 Information contains the public key of the RS. For communication 3436 security this example uses DTLS RawPublicKey between the client 3437 and the RS. The issued token will have a short validity time, 3438 i.e., "exp" close to "iat", in order to mitigate attacks using 3439 stolen client credentials. The token includes the claim such as 3440 "scope" with the authorized access that an owner of the 3441 temperature device can enjoy. In this example, the "scope" claim, 3442 issued by the AS, informs the RS that the owner of the token, that 3443 can prove the possession of a key is authorized to make a GET 3444 request against the /temperature resource and a POST request on 3445 the /firmware resource. Note that the syntax and semantics of the 3446 scope claim are application specific. 3447 Note: In this example it is assumed that the client knows what 3448 resource it wants to access, and is therefore able to request 3449 specific audience and scope claims for the access token. 3451 Authorization 3452 Client Server 3453 | | 3454 |<=======>| DTLS Connection Establishment 3455 | | and mutual authentication 3456 | | 3457 A: +-------->| Header: POST (Code=0.02) 3458 | POST | Uri-Path:"token" 3459 | | Content-Format: application/ace+cbor 3460 | | Payload: 3461 | | 3462 B: |<--------+ Header: 2.05 Content 3463 | 2.05 | Content-Format: application/ace+cbor 3464 | | Payload: 3465 | | 3467 Figure 17: Token Request and Response Using Client Credentials. 3469 The information contained in the Request-Payload and the Response- 3470 Payload is shown in Figure 18 Note that the parameter "rs_cnf" from 3471 [I-D.ietf-ace-oauth-params] is used to inform the client about the 3472 resource server's public key. 3474 Request-Payload : 3475 { 3476 "audience" : "tempSensorInLivingRoom", 3477 "client_id" : "myclient", 3478 "req_cnf" : { 3479 "COSE_Key" : { 3480 "kid" : b64'1Bg8vub9tLe1gHMzV76e8', 3481 "kty" : "EC", 3482 "crv" : "P-256", 3483 "x" : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU', 3484 "y" : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0' 3485 } 3486 } 3487 } 3489 Response-Payload : 3490 { 3491 "access_token" : b64'0INDoQEKoQVNKkXfb7xaWqMTf6 ...', 3492 "rs_cnf" : { 3493 "COSE_Key" : { 3494 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk', 3495 "kty" : "EC", 3496 "crv" : "P-256", 3497 "x" : b64'MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4', 3498 "y" : b64'4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM' 3499 } 3500 } 3501 } 3503 Figure 18: Request and Response Payload Details. 3505 The content of the access token is shown in Figure 19. 3507 { 3508 "aud" : "tempSensorInLivingRoom", 3509 "iat" : "1563451500", 3510 "exp" : "1563453000", 3511 "scope" : "temperature_g firmware_p", 3512 "cnf" : { 3513 "COSE_Key" : { 3514 "kid" : b64'1Bg8vub9tLe1gHMzV76e8', 3515 "kty" : "EC", 3516 "crv" : "P-256", 3517 "x" : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU', 3518 "y" : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0' 3519 } 3520 } 3521 } 3522 Figure 19: Access Token including Public Key of the client. 3524 Messages C and F are shown in Figure 20 - Figure 21. 3526 C: The client then sends the PoP access token to the authz-info 3527 endpoint at the RS. This is a plain CoAP POST request, i.e., no 3528 transport or application-layer security is used between client and 3529 RS since the token is integrity protected between the AS and RS. 3530 The RS verifies that the PoP access token was created by a known 3531 and trusted AS, that it applies to this RS, and that it is valid. 3532 The RS caches the security context together with authorization 3533 information about this client contained in the PoP access token. 3535 Resource 3536 Client Server 3537 | | 3538 C: +-------->| Header: POST (Code=0.02) 3539 | POST | Uri-Path:"authz-info" 3540 | | Payload: 0INDoQEKoQVN ... 3541 | | 3542 |<--------+ Header: 2.04 Changed 3543 | 2.04 | 3544 | | 3546 Figure 20: Access Token provisioning to RS 3547 The client and the RS runs the DTLS handshake using the raw public 3548 keys established in step B and C. 3549 The client sends a CoAP GET request to /temperature on RS over 3550 DTLS. The RS verifies that the request is authorized, based on 3551 previously established security context. 3552 F: The RS responds over the same DTLS channel with a CoAP 2.05 3553 Content response, containing a resource representation as payload. 3555 Resource 3556 Client Server 3557 | | 3558 |<=======>| DTLS Connection Establishment 3559 | | using Raw Public Keys 3560 | | 3561 +-------->| Header: GET (Code=0.01) 3562 | GET | Uri-Path: "temperature" 3563 | | 3564 | | 3565 | | 3566 F: |<--------+ Header: 2.05 Content 3567 | 2.05 | Payload: 3568 | | 3569 Figure 21: Resource Request and Response protected by DTLS. 3571 F.2. Introspection Aided Token Validation 3573 In this deployment scenario it is assumed that a client is not able 3574 to access the AS at the time of the access request, whereas the RS is 3575 assumed to be connected to the back-end infrastructure. Thus the RS 3576 can make use of token introspection. This access procedure involves 3577 steps A-F of Figure 1, but assumes steps A and B have been carried 3578 out during a phase when the client had connectivity to AS. 3580 Since the client is assumed to be offline, at least for a certain 3581 period of time, a pre-provisioned access token has to be long-lived. 3582 Since the client is constrained, the token will not be self contained 3583 (i.e. not a CWT) but instead just a reference. The resource server 3584 uses its connectivity to learn about the claims associated to the 3585 access token by using introspection, which is shown in the example 3586 below. 3588 In the example interactions between an offline client (key fob), an 3589 RS (online lock), and an AS is shown. It is assumed that there is a 3590 provisioning step where the client has access to the AS. This 3591 corresponds to message exchanges A and B which are shown in 3592 Figure 22. 3594 Authorization consent from the resource owner can be pre-configured, 3595 but it can also be provided via an interactive flow with the resource 3596 owner. An example of this for the key fob case could be that the 3597 resource owner has a connected car, he buys a generic key that he 3598 wants to use with the car. To authorize the key fob he connects it 3599 to his computer that then provides the UI for the device. After that 3600 OAuth 2.0 implicit flow can used to authorize the key for his car at 3601 the car manufacturers AS. 3603 Note: In this example the client does not know the exact door it will 3604 be used to access since the token request is not send at the time of 3605 access. So the scope and audience parameters are set quite wide to 3606 start with, while tailored values narrowing down the claims to the 3607 specific RS being accessed can be provided to that RS during an 3608 introspection step. 3610 A: The client sends a CoAP POST request to the token endpoint at 3611 AS. The request contains the Audience parameter set to "PACS1337" 3612 (PACS, Physical Access System), a value the that identifies the 3613 physical access control system to which the individual doors are 3614 connected. The AS generates an access token as an opaque string, 3615 which it can match to the specific client and the targeted 3616 audience. It furthermore generates a symmetric proof-of- 3617 possession key. The communication security and authentication 3618 between client and AS is assumed to have been provided at 3619 transport layer (e.g. via DTLS) using a pre-shared security 3620 context (psk, rpk or certificate). 3621 B: The AS responds with a CoAP 2.05 Content response, containing 3622 as payload the Access Information, including the access token and 3623 the symmetric proof-of-possession key. Communication security 3624 between C and RS will be DTLS and PreSharedKey. The PoP key is 3625 used as the PreSharedKey. 3627 Note: In this example we are using a symmetric key for a multi-RS 3628 audience, which is not recommended normally (see Section 6.9). 3629 However in this case the risk is deemed to be acceptable, since all 3630 the doors are part of the same physical access control system, and 3631 therefore the risk of a malicious RS impersonating the client towards 3632 another RS is low. 3634 Authorization 3635 Client Server 3636 | | 3637 |<=======>| DTLS Connection Establishment 3638 | | and mutual authentication 3639 | | 3640 A: +-------->| Header: POST (Code=0.02) 3641 | POST | Uri-Path:"token" 3642 | | Content-Format: application/ace+cbor 3643 | | Payload: 3644 | | 3645 B: |<--------+ Header: 2.05 Content 3646 | | Content-Format: application/ace+cbor 3647 | 2.05 | Payload: 3648 | | 3650 Figure 22: Token Request and Response using Client Credentials. 3652 The information contained in the Request-Payload and the Response- 3653 Payload is shown in Figure 23. 3655 Request-Payload: 3656 { 3657 "client_id" : "keyfob", 3658 "audience" : "PACS1337" 3659 } 3661 Response-Payload: 3662 { 3663 "access_token" : b64'VGVzdCB0b2tlbg==', 3664 "cnf" : { 3665 "COSE_Key" : { 3666 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk', 3667 "kty" : "oct", 3668 "alg" : "HS256", 3669 "k": b64'ZoRSOrFzN_FzUA5XKMYoVHyzff5oRJxl-IXRtztJ6uE' 3670 } 3671 } 3672 } 3674 Figure 23: Request and Response Payload for C offline 3676 The access token in this case is just an opaque byte string 3677 referencing the authorization information at the AS. 3679 C: Next, the client POSTs the access token to the authz-info 3680 endpoint in the RS. This is a plain CoAP request, i.e., no DTLS 3681 between client and RS. Since the token is an opaque string, the 3682 RS cannot verify it on its own, and thus defers to respond the 3683 client with a status code until after step E. 3684 D: The RS sends the token to the introspection endpoint on the AS 3685 using a CoAP POST request. In this example RS and AS are assumed 3686 to have performed mutual authentication using a pre shared 3687 security context (psk, rpk or certificate) with the RS acting as 3688 DTLS client. 3689 E: The AS provides the introspection response (2.05 Content) 3690 containing parameters about the token. This includes the 3691 confirmation key (cnf) parameter that allows the RS to verify the 3692 client's proof of possession in step F. Note that our example in 3693 Figure 25 assumes a pre-established key (e.g. one used by the 3694 client and the RS for a previous token) that is now only 3695 referenced by its key-identifier 'kid'. 3696 After receiving message E, the RS responds to the client's POST in 3697 step C with the CoAP response code 2.01 (Created). 3699 Resource 3700 Client Server 3701 | | 3702 C: +-------->| Header: POST (T=CON, Code=0.02) 3703 | POST | Uri-Path:"authz-info" 3704 | | Payload: b64'VGVzdCB0b2tlbg==' 3705 | | 3706 | | Authorization 3707 | | Server 3708 | | | 3709 | D: +--------->| Header: POST (Code=0.02) 3710 | | POST | Uri-Path: "introspect" 3711 | | | Content-Format: "application/ace+cbor" 3712 | | | Payload: 3713 | | | 3714 | E: |<---------+ Header: 2.05 Content 3715 | | 2.05 | Content-Format: "application/ace+cbor" 3716 | | | Payload: 3717 | | | 3718 | | 3719 |<--------+ Header: 2.01 Created 3720 | 2.01 | 3721 | | 3723 Figure 24: Token Introspection for C offline 3724 The information contained in the Request-Payload and the Response- 3725 Payload is shown in Figure 25. 3726 Request-Payload: 3727 { 3728 "token" : b64'VGVzdCB0b2tlbg==', 3729 "client_id" : "FrontDoor", 3730 } 3732 Response-Payload: 3733 { 3734 "active" : true, 3735 "aud" : "lockOfDoor4711", 3736 "scope" : "open, close", 3737 "iat" : 1563454000, 3738 "cnf" : { 3739 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk' 3740 } 3741 } 3743 Figure 25: Request and Response Payload for Introspection 3745 The client uses the symmetric PoP key to establish a DTLS 3746 PreSharedKey secure connection to the RS. The CoAP request PUT is 3747 sent to the uri-path /state on the RS, changing the state of the 3748 door to locked. 3749 F: The RS responds with a appropriate over the secure DTLS 3750 channel. 3752 Resource 3753 Client Server 3754 | | 3755 |<=======>| DTLS Connection Establishment 3756 | | using Pre Shared Key 3757 | | 3758 +-------->| Header: PUT (Code=0.03) 3759 | PUT | Uri-Path: "state" 3760 | | Payload: 3761 | | 3762 F: |<--------+ Header: 2.04 Changed 3763 | 2.04 | Payload: 3764 | | 3766 Figure 26: Resource request and response protected by OSCORE 3768 Authors' Addresses 3770 Ludwig Seitz 3771 Combitech 3772 Djäknegatan 31 3773 SE-211 35 Malmö 3774 Sweden 3776 Email: ludwig.seitz@combitech.com 3778 Goeran Selander 3779 Ericsson 3780 Faroegatan 6 3781 SE-164 80 Kista 3782 Sweden 3784 Email: goran.selander@ericsson.com 3786 Erik Wahlstroem 3787 Sweden 3789 Email: erik@wahlstromstekniska.se 3791 Samuel Erdtman 3792 Spotify AB 3793 Birger Jarlsgatan 61, 4tr 3794 SE-113 56 Stockholm 3795 Sweden 3796 Email: erdtman@spotify.com 3798 Hannes Tschofenig 3799 Arm Ltd. 3800 6067 Absam 3801 Austria 3803 Email: Hannes.Tschofenig@arm.com