idnits 2.17.1 draft-ietf-ace-oauth-authz-42.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- 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 (June 8, 2021) is 1046 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-14 ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) ** Obsolete normative reference: RFC 8152 (Obsoleted by RFC 9052, RFC 9053) == Outdated reference: A later version (-18) exists of draft-ietf-ace-dtls-authorize-16 == Outdated reference: A later version (-19) exists of draft-ietf-ace-oscore-profile-18 -- 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 (~~), 4 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: December 10, 2021 Ericsson 6 E. Wahlstroem 8 S. Erdtman 9 Spotify AB 10 H. Tschofenig 11 Arm Ltd. 12 June 8, 2021 14 Authentication and Authorization for Constrained Environments (ACE) 15 using the OAuth 2.0 Framework (ACE-OAuth) 16 draft-ietf-ace-oauth-authz-42 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 December 10, 2021. 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 53 (https://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 64 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 65 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 6 66 3.1. OAuth 2.0 . . . . . . . . . . . . . . . . . . . . . . . . 7 67 3.2. CoAP . . . . . . . . . . . . . . . . . . . . . . . . . . 10 68 4. Protocol Interactions . . . . . . . . . . . . . . . . . . . . 11 69 5. Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 14 70 5.1. Discovering Authorization Servers . . . . . . . . . . . . 16 71 5.2. Unauthorized Resource Request Message . . . . . . . . . . 17 72 5.3. AS Request Creation Hints . . . . . . . . . . . . . . . . 17 73 5.3.1. The Client-Nonce Parameter . . . . . . . . . . . . . 19 74 5.4. Authorization Grants . . . . . . . . . . . . . . . . . . 20 75 5.5. Client Credentials . . . . . . . . . . . . . . . . . . . 21 76 5.6. AS Authentication . . . . . . . . . . . . . . . . . . . . 21 77 5.7. The Authorization Endpoint . . . . . . . . . . . . . . . 21 78 5.8. The Token Endpoint . . . . . . . . . . . . . . . . . . . 22 79 5.8.1. Client-to-AS Request . . . . . . . . . . . . . . . . 22 80 5.8.2. AS-to-Client Response . . . . . . . . . . . . . . . . 25 81 5.8.3. Error Response . . . . . . . . . . . . . . . . . . . 27 82 5.8.4. Request and Response Parameters . . . . . . . . . . . 28 83 5.8.4.1. Grant Type . . . . . . . . . . . . . . . . . . . 28 84 5.8.4.2. Token Type . . . . . . . . . . . . . . . . . . . 29 85 5.8.4.3. Profile . . . . . . . . . . . . . . . . . . . . . 29 86 5.8.4.4. Client-Nonce . . . . . . . . . . . . . . . . . . 30 87 5.8.5. Mapping Parameters to CBOR . . . . . . . . . . . . . 30 88 5.9. The Introspection Endpoint . . . . . . . . . . . . . . . 31 89 5.9.1. Introspection Request . . . . . . . . . . . . . . . . 32 90 5.9.2. Introspection Response . . . . . . . . . . . . . . . 33 91 5.9.3. Error Response . . . . . . . . . . . . . . . . . . . 34 92 5.9.4. Mapping Introspection Parameters to CBOR . . . . . . 35 93 5.10. The Access Token . . . . . . . . . . . . . . . . . . . . 35 94 5.10.1. The Authorization Information Endpoint . . . . . . . 36 95 5.10.1.1. Verifying an Access Token . . . . . . . . . . . 37 96 5.10.1.2. Protecting the Authorization Information 97 Endpoint . . . . . . . . . . . . . . . . . . . . 39 98 5.10.2. Client Requests to the RS . . . . . . . . . . . . . 39 99 5.10.3. Token Expiration . . . . . . . . . . . . . . . . . . 40 100 5.10.4. Key Expiration . . . . . . . . . . . . . . . . . . . 42 101 6. Security Considerations . . . . . . . . . . . . . . . . . . . 42 102 6.1. Protecting Tokens . . . . . . . . . . . . . . . . . . . . 43 103 6.2. Communication Security . . . . . . . . . . . . . . . . . 44 104 6.3. Long-Term Credentials . . . . . . . . . . . . . . . . . . 44 105 6.4. Unprotected AS Request Creation Hints . . . . . . . . . . 45 106 6.5. Minimal Security Requirements for Communication . 45 107 6.6. Token Freshness and Expiration . . . . . . . . . . . . . 46 108 6.7. Combining Profiles . . . . . . . . . . . . . . . . . . . 47 109 6.8. Unprotected Information . . . . . . . . . . . . . . . . . 47 110 6.9. Identifying Audiences . . . . . . . . . . . . . . . . . . 48 111 6.10. Denial of Service Against or with Introspection . . 48 112 7. Privacy Considerations . . . . . . . . . . . . . . . . . . . 49 113 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 50 114 8.1. ACE Authorization Server Request Creation Hints . . . . . 50 115 8.2. CoRE Resource Type Registry . . . . . . . . . . . . . . . 51 116 8.3. OAuth Extensions Error Registration . . . . . . . . . . . 51 117 8.4. OAuth Error Code CBOR Mappings Registry . . . . . . . . . 51 118 8.5. OAuth Grant Type CBOR Mappings . . . . . . . . . . . . . 52 119 8.6. OAuth Access Token Types . . . . . . . . . . . . . . . . 52 120 8.7. OAuth Access Token Type CBOR Mappings . . . . . . . . . . 52 121 8.7.1. Initial Registry Contents . . . . . . . . . . . . . . 53 122 8.8. ACE Profile Registry . . . . . . . . . . . . . . . . . . 53 123 8.9. OAuth Parameter Registration . . . . . . . . . . . . . . 54 124 8.10. OAuth Parameters CBOR Mappings Registry . . . . . . . . . 54 125 8.11. OAuth Introspection Response Parameter Registration . . . 54 126 8.12. OAuth Token Introspection Response CBOR Mappings Registry 55 127 8.13. JSON Web Token Claims . . . . . . . . . . . . . . . . . . 55 128 8.14. CBOR Web Token Claims . . . . . . . . . . . . . . . . . . 56 129 8.15. Media Type Registrations . . . . . . . . . . . . . . . . 57 130 8.16. CoAP Content-Format Registry . . . . . . . . . . . . . . 58 131 8.17. Expert Review Instructions . . . . . . . . . . . . . . . 58 132 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 59 133 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 59 134 10.1. Normative References . . . . . . . . . . . . . . . . . . 59 135 10.2. Informative References . . . . . . . . . . . . . . . . . 62 136 Appendix A. Design Justification . . . . . . . . . . . . . . . . 65 137 Appendix B. Roles and Responsibilities . . . . . . . . . . . . . 68 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 . . . . . . . . . . . . . . 72 141 Appendix F. Deployment Examples . . . . . . . . . . . . . . . . 73 142 F.1. Local Token Validation . . . . . . . . . . . . . . . . . 73 143 F.2. Introspection Aided Token Validation . . . . . . . . . . 77 144 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 81 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. 269 A fourth building block is CBOR Object Signing and Encryption (COSE) 270 [RFC8152], which enables object-level layer security as an 271 alternative or complement to transport layer security (DTLS [RFC6347] 272 or TLS [RFC8446]). COSE is used to secure self-contained tokens such 273 as proof-of-possession (PoP) tokens, which are an extension to the 274 OAuth bearer tokens. The default token format is defined in CBOR Web 275 Token (CWT) [RFC8392]. Application-layer security for CoAP using 276 COSE can be provided with OSCORE [RFC8613]. 278 With the building blocks listed above, solutions satisfying various 279 IoT device and network constraints are possible. A list of 280 constraints is described in detail in [RFC7228] and a description of 281 how the building blocks mentioned above relate to the various 282 constraints can be found in Appendix A. 284 Luckily, not every IoT device suffers from all constraints. The ACE 285 framework nevertheless takes all these aspects into account and 286 allows several different deployment variants to co-exist, rather than 287 mandating a one-size-fits-all solution. It is important to cover the 288 wide range of possible interworking use cases and the different 289 requirements from a security point of view. Once IoT deployments 290 mature, popular deployment variants will be documented in the form of 291 ACE profiles. 293 3.1. OAuth 2.0 295 The OAuth 2.0 authorization framework enables a client to obtain 296 scoped access to a resource with the permission of a resource owner. 297 Authorization information, or references to it, is passed between the 298 nodes using access tokens. These access tokens are issued to clients 299 by an authorization server with the approval of the resource owner. 300 The client uses the access token to access the protected resources 301 hosted by the resource server. 303 A number of OAuth 2.0 terms are used within this specification: 305 Access Tokens: 306 Access tokens are credentials needed to access protected 307 resources. An access token is a data structure representing 308 authorization permissions issued by the AS to the client. Access 309 tokens are generated by the AS and consumed by the RS. The access 310 token content is opaque to the client. 312 Access tokens can have different formats, and various methods of 313 utilization e.g., cryptographic properties) based on the security 314 requirements of the given deployment. 316 Introspection: 317 Introspection is a method for a resource server or potentially a 318 client, to query the authorization server for the active state and 319 content of a received access token. This is particularly useful 320 in those cases where the authorization decisions are very dynamic 321 and/or where the received access token itself is an opaque 322 reference rather than a self-contained token. More information 323 about introspection in OAuth 2.0 can be found in [RFC7662]. 325 Refresh Tokens: 326 Refresh tokens are credentials used to obtain access tokens. 327 Refresh tokens are issued to the client by the authorization 328 server and are used to obtain a new access token when the current 329 access token expires, or to obtain additional access tokens with 330 identical or narrower scope (such access tokens may have a shorter 331 lifetime and fewer permissions than authorized by the resource 332 owner). Issuing a refresh token is optional at the discretion of 333 the authorization server. If the authorization server issues a 334 refresh token, it is included when issuing an access token (i.e., 335 step (B) in Figure 1). 337 A refresh token in OAuth 2.0 is a string representing the 338 authorization granted to the client by the resource owner. The 339 string is usually opaque to the client. The token denotes an 340 identifier used to retrieve the authorization information. Unlike 341 access tokens, refresh tokens are intended for use only with 342 authorization servers and are never sent to resource servers. In 343 this framework, refresh tokens are encoded in binary instead of 344 strings, if used. 346 Proof of Possession Tokens: 347 A token may be bound to a cryptographic key, which is then used to 348 bind the token to a request authorized by the token. Such tokens 349 are called proof-of-possession tokens (or PoP tokens). 351 The proof-of-possession security concept used here assumes that 352 the AS acts as a trusted third party that binds keys to tokens. 353 In the case of access tokens, these so called PoP keys are then 354 used by the client to demonstrate the possession of the secret to 355 the RS when accessing the resource. The RS, when receiving an 356 access token, needs to verify that the key used by the client 357 matches the one bound to the access token. When this 358 specification uses the term "access token" it is assumed to be a 359 PoP access token unless specifically stated otherwise. 361 The key bound to the token (the PoP key) may use either symmetric 362 or asymmetric cryptography. The appropriate choice of the kind of 363 cryptography depends on the constraints of the IoT devices as well 364 as on the security requirements of the use case. 366 Symmetric PoP key: 367 The AS generates a random symmetric PoP key. The key is either 368 stored to be returned on introspection calls or included in the 369 token. Either the whole token or only the key MUST be 370 encrypted in the latter case. The PoP key is also returned to 371 client together with the token. 373 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: 422 The AS hosts the token endpoint that allows a client to request 423 access tokens. The client makes a POST request to the token 424 endpoint on the AS and receives the access token in the response 425 (if the request was successful). 426 In some deployments, a token introspection endpoint is provided by 427 the AS, which can be used by the RS and potentially the client, if 428 they need to request additional information regarding a received 429 access token. The requesting entity makes a POST request to the 430 introspection endpoint on the AS and receives information about 431 the access token in the response. (See "Introspection" above.) 433 3.2. CoAP 435 CoAP is an application-layer protocol similar to HTTP, but 436 specifically designed for constrained environments. CoAP typically 437 uses datagram-oriented transport, such as UDP, where reordering and 438 loss of packets can occur. A security solution needs to take the 439 latter aspects into account. 441 While HTTP uses headers and query strings to convey additional 442 information about a request, CoAP encodes such information into 443 header parameters called 'options'. 445 CoAP supports application-layer fragmentation of the CoAP payloads 446 through blockwise transfers [RFC7959]. However, blockwise transfer 447 does not increase the size limits of CoAP options, therefore data 448 encoded in options has to be kept small. 450 Transport layer security for CoAP can be provided by DTLS or TLS 451 [RFC6347][RFC8446] [I-D.ietf-tls-dtls13]. CoAP defines a number of 452 proxy operations that require transport layer security to be 453 terminated at the proxy. One approach for protecting CoAP 454 communication end-to-end through proxies, and also to support 455 security for CoAP over a different transport in a uniform way, is to 456 provide security at the application layer using an object-based 457 security mechanism such as COSE [RFC8152]. 459 One application of COSE is OSCORE [RFC8613], which provides end-to- 460 end confidentiality, integrity and replay protection, and a secure 461 binding between CoAP request and response messages. In OSCORE, the 462 CoAP messages are wrapped in COSE objects and sent using CoAP. 464 In this framework the use of CoAP as replacement for HTTP is 465 RECOMMENDED for use in constrained environments. For communication 466 security this framework does not make an explicit protocol 467 recommendation, since the choice depends on the requirements of the 468 specific application. DTLS [RFC6347], [I-D.ietf-tls-dtls13] and 469 OSCORE [RFC8613] are mentioned as examples, other protocols 470 fulfilling the requirements from Section 6.5 are also applicable. 472 4. Protocol Interactions 474 The ACE framework is based on the OAuth 2.0 protocol interactions 475 using the token endpoint and optionally the introspection endpoint. 476 A client obtains an access token, and optionally a refresh token, 477 from an AS using the token endpoint and subsequently presents the 478 access token to an RS to gain access to a protected resource. In 479 most deployments the RS can process the access token locally, however 480 in some cases the RS may present it to the AS via the introspection 481 endpoint to get fresh information. These interactions are shown in 482 Figure 1. An overview of various OAuth concepts is provided in 483 Section 3.1. 485 +--------+ +---------------+ 486 | |---(A)-- Token Request ------->| | 487 | | | Authorization | 488 | |<--(B)-- Access Token ---------| Server | 489 | | + Access Information | | 490 | | + Refresh Token (optional) +---------------+ 491 | | ^ | 492 | | Introspection Request (D)| | 493 | Client | Response | |(E) 494 | | (optional exchange) | | 495 | | | v 496 | | +--------------+ 497 | |---(C)-- Token + Request ----->| | 498 | | | Resource | 499 | |<--(F)-- Protected Resource ---| Server | 500 | | | | 501 +--------+ +--------------+ 503 Figure 1: Basic Protocol Flow. 505 Requesting an Access Token (A): 506 The client makes an access token request to the token endpoint at 507 the AS. This framework assumes the use of PoP access tokens (see 508 Section 3.1 for a short description) wherein the AS binds a key to 509 an access token. The client may include permissions it seeks to 510 obtain, and information about the credentials it wants to use for 511 proof-of-possession (e.g., symmetric/asymmetric cryptography or a 512 reference to a specific key) of the access token. 514 Access Token Response (B): 515 If the request from the client has been successfully verified, 516 authenticated, and authorized, the AS returns an access token and 517 optionally a refresh token. Note that only certain grant types 518 support refresh tokens. The AS can also return additional 519 parameters, referred to as "Access Information". In addition to 520 the response parameters defined by OAuth 2.0 and the PoP access 521 token extension, this framework defines parameters that can be 522 used to inform the client about capabilities of the RS, e.g. the 523 profile the RS supports. More information about these parameters 524 can be found in Section 5.8.4. 526 Resource Request (C): 527 The client interacts with the RS to request access to the 528 protected resource and provides the access token. The protocol to 529 use between the client and the RS is not restricted to CoAP. 530 HTTP, HTTP/2 [RFC7540], QUIC [I-D.ietf-quic-transport], MQTT 531 [MQTT5.0], Bluetooth Low Energy [BLE], etc., are also viable 532 candidates. 534 Depending on the device limitations and the selected protocol, 535 this exchange may be split up into two parts: 537 (1) the client sends the access token containing, or 538 referencing, the authorization information to the RS, that will 539 be used for subsequent resource requests by the client, and 541 (2) the client makes the resource access request, using the 542 communication security protocol and other Access Information 543 obtained from the AS. 545 The client and the RS mutually authenticate using the security 546 protocol specified in the profile (see step B) and the keys 547 obtained in the access token or the Access Information. The RS 548 verifies that the token is integrity protected and originated by 549 the AS. It then compares the claims contained in the access token 550 with the resource request. If the RS is online, validation can be 551 handed over to the AS using token introspection (see messages D 552 and E) over HTTP or CoAP. 554 Token Introspection Request (D): 555 A resource server may be configured to introspect the access token 556 by including it in a request to the introspection endpoint at that 557 AS. Token introspection over CoAP is defined in Section 5.9 and 558 for HTTP in [RFC7662]. 560 Note that token introspection is an optional step and can be 561 omitted if the token is self-contained and the resource server is 562 prepared to perform the token validation on its own. 564 Token Introspection Response (E): 565 The AS validates the token and returns the most recent parameters, 566 such as scope, audience, validity etc. associated with it back to 567 the RS. The RS then uses the received parameters to process the 568 request to either accept or to deny it. 570 Protected Resource (F): 571 If the request from the client is authorized, the RS fulfills the 572 request and returns a response with the appropriate response code. 573 The RS uses the dynamically established keys to protect the 574 response, according to the communication security protocol used. 576 The OAuth 2.0 framework defines a number of "protocol flows" via 577 grant types, which have been extended further with extensions to 578 OAuth 2.0 (such as [RFC7521] and [RFC8628]). What grant type works 579 best depends on the usage scenario and [RFC7744] describes many 580 different IoT use cases but there are two grant types that cover a 581 majority of these scenarios, namely the Authorization Code Grant 582 (described in Section 4.1 of [RFC7521]) and the Client Credentials 583 Grant (described in Section 4.4 of [RFC7521]). The Authorization 584 Code Grant is a good fit for use with apps running on smart phones 585 and tablets that request access to IoT devices, a common scenario in 586 the smart home environment, where users need to go through an 587 authentication and authorization phase (at least during the initial 588 setup phase). The native apps guidelines described in [RFC8252] are 589 applicable to this use case. The Client Credential Grant is a good 590 fit for use with IoT devices where the OAuth client itself is 591 constrained. In such a case, the resource owner has pre-arranged 592 access rights for the client with the authorization server, which is 593 often accomplished using a commissioning tool. 595 The consent of the resource owner, for giving a client access to a 596 protected resource, can be provided dynamically as in the traditional 597 OAuth flows, or it could be pre-configured by the resource owner as 598 authorization policies at the AS, which the AS evaluates when a token 599 request arrives. The resource owner and the requesting party (i.e., 600 client owner) are not shown in Figure 1. 602 This framework supports a wide variety of communication security 603 mechanisms between the ACE entities, such as client, AS, and RS. It 604 is assumed that the client has been registered (also called enrolled 605 or onboarded) to an AS using a mechanism defined outside the scope of 606 this document. In practice, various techniques for onboarding have 607 been used, such as factory-based provisioning or the use of 608 commissioning tools. Regardless of the onboarding technique, this 609 provisioning procedure implies that the client and the AS exchange 610 credentials and configuration parameters. These credentials are used 611 to mutually authenticate each other and to protect messages exchanged 612 between the client and the AS. 614 It is also assumed that the RS has been registered with the AS, 615 potentially in a similar way as the client has been registered with 616 the AS. Established keying material between the AS and the RS allows 617 the AS to apply cryptographic protection to the access token to 618 ensure that its content cannot be modified, and if needed, that the 619 content is confidentiality protected. Confidentiality protection of 620 the access token content would be provided on top of confidentiality 621 protection via a communication security protocol. 623 The keying material necessary for establishing communication security 624 between C and RS is dynamically established as part of the protocol 625 described in this document. 627 At the start of the protocol, there is an optional discovery step 628 where the client discovers the resource server and the resources this 629 server hosts. In this step, the client might also determine what 630 permissions are needed to access the protected resource. A generic 631 procedure is described in Section 5.1; profiles MAY define other 632 procedures for discovery. 634 In Bluetooth Low Energy, for example, advertisements are broadcast by 635 a peripheral, including information about the primary services. In 636 CoAP, as a second example, a client can make a request to "/.well- 637 known/core" to obtain information about available resources, which 638 are returned in a standardized format as described in [RFC6690]. 640 5. Framework 642 The following sections detail the profiling and extensions of OAuth 643 2.0 for constrained environments, which constitutes the ACE 644 framework. 646 Credential Provisioning 647 In constrained environments it cannot be assumed that the client 648 and the RS are part of a common key infrastructure. Therefore, 649 the AS provisions credentials and associated information to allow 650 mutual authentication between the client and the RS. The 651 resulting security association between the client and the RS may 652 then also be used to bind these credentials to the access tokens 653 the client uses. 655 Proof-of-Possession 656 The ACE framework, by default, implements proof-of-possession for 657 access tokens, i.e., that the token holder can prove being a 658 holder of the key bound to the token. The binding is provided by 659 the "cnf" claim [RFC8747] indicating what key is used for proof- 660 of-possession. If a client needs to submit a new access token, 661 e.g., to obtain additional access rights, they can request that 662 the AS binds this token to the same key as the previous one. 664 ACE Profiles 665 The client or RS may be limited in the encodings or protocols it 666 supports. To support a variety of different deployment settings, 667 specific interactions between client and RS are defined in an ACE 668 profile. In ACE framework the AS is expected to manage the 669 matching of compatible profile choices between a client and an RS. 670 The AS informs the client of the selected profile using the 671 "ace_profile" parameter in the token response. 673 OAuth 2.0 requires the use of TLS both to protect the communication 674 between AS and client when requesting an access token; between client 675 and RS when accessing a resource and between AS and RS if 676 introspection is used. In constrained settings TLS is not always 677 feasible, or desirable. Nevertheless it is REQUIRED that the 678 communications named above are encrypted, integrity protected and 679 protected against message replay. It is also REQUIRED that the 680 communicating endpoints perform mutual authentication. Furthermore 681 it MUST be assured that responses are bound to the requests in the 682 sense that the receiver of a response can be certain that the 683 response actually belongs to a certain request. Note that setting up 684 such a secure communication may require some unprotected messages to 685 be exchanged first (e.g. sending the token from the client to the 686 RS). 688 Profiles MUST specify a communication security protocol between 689 client and RS that provides the features required above. Profiles 690 MUST specify a communication security protocol RECOMMENDED to be used 691 between client and AS that provides the features required above. 692 Profiles MUST specify for introspection a communication security 693 protocol RECOMMENDED to be used between RS and AS that provides the 694 features required above. These recommendations enable 695 interoperability between different implementations without the need 696 to define a new profile if the communication between C and AS, or 697 between RS and AS, is protected with a different security protocol 698 complying with the security requirements above. 700 In OAuth 2.0 the communication with the Token and the Introspection 701 endpoints at the AS is assumed to be via HTTP and may use Uri-query 702 parameters. When profiles of this framework use CoAP instead, it is 703 REQUIRED to use of the following alternative instead of Uri-query 704 parameters: The sender (client or RS) encodes the parameters of its 705 request as a CBOR map and submits that map as the payload of the POST 706 request. The CBOR encoding for a number of OAuth 2.0 parameters is 707 specified in this document, if a profile needs to use other OAuth 2.0 708 parameters with CoAP it MUST specify their CBOR encoding. 710 Profiles that use CBOR encoding of protocol message parameters at the 711 outermost encoding layer MUST use the content format 'application/ 712 ace+cbor'. If CoAP is used for communication, the Content-Format 713 MUST be abbreviated with the ID: 19 (see Section 8.16). 715 The OAuth 2.0 AS uses a JSON structure in the payload of its 716 responses both to client and RS. If CoAP is used, it is REQUIRED to 717 use CBOR [RFC8949] instead of JSON. Depending on the profile, the 718 CBOR payload MAY be enclosed in a non-CBOR cryptographic wrapper. 720 5.1. Discovering Authorization Servers 722 C must discover the AS in charge of RS to determine where to request 723 the access token. To do so, C must 1. find out the AS URI to which 724 the token request message must be sent and 2. MUST validate that the 725 AS with this URI is authorized to provide access tokens for this RS. 727 In order to determine the AS URI, C MAY send an initial Unauthorized 728 Resource Request message to RS. RS then denies the request and sends 729 the address of its AS back to C (see Section 5.2). How C validates 730 the AS authorization is not in scope for this document. C may, e.g., 731 ask its owner if this AS is authorized for this RS. C may also use a 732 mechanism that addresses both problems at once (e.g. by querying a 733 dedicated secure service provided by the client owner) . 735 5.2. Unauthorized Resource Request Message 737 An Unauthorized Resource Request message is a request for any 738 resource hosted by RS for which the client does not have 739 authorization granted. RSes MUST treat any request for a protected 740 resource as an Unauthorized Resource Request message when any of the 741 following hold: 743 o The request has been received on an unsecured channel. 745 o The RS has no valid access token for the sender of the request 746 regarding the requested action on that resource. 748 o The RS has a valid access token for the sender of the request, but 749 that token does not authorize the requested action on the 750 requested resource. 752 Note: These conditions ensure that the RS can handle requests 753 autonomously once access was granted and a secure channel has been 754 established between C and RS. The authz-info endpoint, as part of 755 the process for authorizing to protected resources, is not itself a 756 protected resource and MUST NOT be protected as specified above (cf. 757 Section 5.10.1). 759 Unauthorized Resource Request messages MUST be denied with an 760 "unauthorized_client" error response. In this response, the Resource 761 Server SHOULD provide proper "AS Request Creation Hints" to enable 762 the client to request an access token from RS's AS as described in 763 Section 5.3. 765 The handling of all client requests (including unauthorized ones) by 766 the RS is described in Section 5.10.2. 768 5.3. AS Request Creation Hints 770 The "AS Request Creation Hints" message is sent by an RS as a 771 response to an Unauthorized Resource Request message (see 772 Section 5.2) to help the sender of the Unauthorized Resource Request 773 message acquire a valid access token. The "AS Request Creation 774 Hints" message is a CBOR or JSON map, with an OPTIONAL element "AS" 775 specifying an absolute URI (see Section 4.3 of [RFC3986]) that 776 identifies the appropriate AS for the RS. 778 The message can also contain the following OPTIONAL parameters: 780 o A "audience" element contains an identifier the client should 781 request at the AS, as suggested by the RS. With this parameter, 782 when included in the access token request to the AS, the AS is 783 able to restrict the use of access token to specific RSs. See 784 Section 6.9 for a discussion of this parameter. 786 o A "kid" element containing the key identifier of a key used in an 787 existing security association between the client and the RS. The 788 RS expects the client to request an access token bound to this 789 key, in order to avoid having to re-establish the security 790 association. 792 o A "cnonce" element containing a client-nonce. See Section 5.3.1. 794 o A "scope" element containing the suggested scope that the client 795 should request towards the AS. 797 Figure 2 summarizes the parameters that may be part of the "AS 798 Request Creation Hints". 800 /-----------+----------+---------------------\ 801 | Name | CBOR Key | Value Type | 802 |-----------+----------+---------------------| 803 | AS | 1 | text string | 804 | kid | 2 | byte string | 805 | audience | 5 | text string | 806 | scope | 9 | text or byte string | 807 | cnonce | 39 | byte string | 808 \-----------+----------+---------------------/ 810 Figure 2: AS Request Creation Hints 812 Note that the schema part of the AS parameter may need to be adapted 813 to the security protocol that is used between the client and the AS. 814 Thus the example AS value "coap://as.example.com/token" might need to 815 be transformed to "coaps://as.example.com/token". It is assumed that 816 the client can determine the correct schema part on its own depending 817 on the way it communicates with the AS. 819 Figure 3 shows an example for an "AS Request Creation Hints" message 820 payload using CBOR [RFC8949] diagnostic notation, using the parameter 821 names instead of the CBOR keys for better human readability. 823 4.01 Unauthorized 824 Content-Format: application/ace+cbor 825 Payload : 826 { 827 "AS" : "coaps://as.example.com/token", 828 "audience" : "coaps://rs.example.com" 829 "scope" : "rTempC", 830 "cnonce" : h'e0a156bb3f' 831 } 833 Figure 3: AS Request Creation Hints payload example 835 In the example above, the response parameter "AS" points the receiver 836 of this message to the URI "coaps://as.example.com/token" to request 837 access tokens. The RS sending this response uses an internal clock 838 that is not synchronized with the clock of the AS. Therefore, it can 839 not reliably verify the expiration time of access tokens it receives. 840 To ensure a certain level of access token freshness nevertheless, the 841 RS has included a "cnonce" parameter (see Section 5.3.1) in the 842 response. (The hex-sequence of the cnonce parameter is encoded in 843 CBOR-based notation in this example.) 845 Figure 4 illustrates the mandatory to use binary encoding of the 846 message payload shown in Figure 3. 848 a4 # map(4) 849 01 # unsigned(1) (=AS) 850 78 1c # text(28) 851 636f6170733a2f2f61732e657861 852 6d706c652e636f6d2f746f6b656e # "coaps://as.example.com/token" 853 05 # unsigned(5) (=audience) 854 76 # text(22) 855 636f6170733a2f2f72732e657861 856 6d706c652e636f6d # "coaps://rs.example.com" 857 09 # unsigned(9) (=scope) 858 66 # text(6) 859 7254656d7043 # "rTempC" 860 18 27 # unsigned(39) (=cnonce) 861 45 # bytes(5) 862 e0a156bb3f # 864 Figure 4: AS Request Creation Hints example encoded in CBOR 866 5.3.1. The Client-Nonce Parameter 868 If the RS does not synchronize its clock with the AS, it could be 869 tricked into accepting old access tokens, that are either expired or 870 have been compromised. In order to ensure some level of token 871 freshness in that case, the RS can use the "cnonce" (client-nonce) 872 parameter. The processing requirements for this parameter are as 873 follows: 875 o An RS sending a "cnonce" parameter in an "AS Request Creation 876 Hints" message MUST store information to validate that a given 877 cnonce is fresh. How this is implemented internally is out of 878 scope for this specification. Expiration of client-nonces should 879 be based roughly on the time it would take a client to obtain an 880 access token after receiving the "AS Request Creation Hints" 881 message, with some allowance for unexpected delays. 883 o A client receiving a "cnonce" parameter in an "AS Request Creation 884 Hints" message MUST include this in the parameters when requesting 885 an access token at the AS, using the "cnonce" parameter from 886 Section 5.8.4.4. 888 o If an AS grants an access token request containing a "cnonce" 889 parameter, it MUST include this value in the access token, using 890 the "cnonce" claim specified in Section 5.10. 892 o An RS that is using the client-nonce mechanism and that receives 893 an access token MUST verify that this token contains a cnonce 894 claim, with a client-nonce value that is fresh according to the 895 information stored at the first step above. If the cnonce claim 896 is not present or if the cnonce claim value is not fresh, the RS 897 MUST discard the access token. If this was an interaction with 898 the authz-info endpoint the RS MUST also respond with an error 899 message using a response code equivalent to the CoAP code 4.01 900 (Unauthorized). 902 5.4. Authorization Grants 904 To request an access token, the client obtains authorization from the 905 resource owner or uses its client credentials as a grant. The 906 authorization is expressed in the form of an authorization grant. 908 The OAuth framework [RFC6749] defines four grant types. The grant 909 types can be split up into two groups, those granted on behalf of the 910 resource owner (password, authorization code, implicit) and those for 911 the client (client credentials). Further grant types have been added 912 later, such as [RFC7521] defining an assertion-based authorization 913 grant. 915 The grant type is selected depending on the use case. In cases where 916 the client acts on behalf of the resource owner, the authorization 917 code grant is recommended. If the client acts on behalf of the 918 resource owner, but does not have any display or has very limited 919 interaction possibilities, it is recommended to use the device code 920 grant defined in [RFC8628]. In cases where the client acts 921 autonomously the client credentials grant is recommended. 923 For details on the different grant types, see section 1.3 of 924 [RFC6749]. The OAuth 2.0 framework provides an extension mechanism 925 for defining additional grant types, so profiles of this framework 926 MAY define additional grant types, if needed. 928 5.5. Client Credentials 930 Authentication of the client is mandatory independent of the grant 931 type when requesting an access token from the token endpoint. In the 932 case of the client credentials grant type, the authentication and 933 grant coincide. 935 Client registration and provisioning of client credentials to the 936 client is out of scope for this specification. 938 The OAuth framework defines one client credential type in section 939 2.3.1 of [RFC6749]: client id and client secret. 940 [I-D.erdtman-ace-rpcc] adds raw-public-key and pre-shared-key to the 941 client credentials types. Profiles of this framework MAY extend with 942 an additional client credentials type using client certificates. 944 5.6. AS Authentication 946 The client credential grant does not, by default, authenticate the AS 947 that the client connects to. In classic OAuth, the AS is 948 authenticated with a TLS server certificate. 950 Profiles of this framework MUST specify how clients authenticate the 951 AS and how communication security is implemented. By default, server 952 side TLS certificates, as defined by OAuth 2.0, are required. 954 5.7. The Authorization Endpoint 956 The OAuth 2.0 authorization endpoint is used to interact with the 957 resource owner and obtain an authorization grant, in certain grant 958 flows. The primary use case for the ACE-OAuth framework is for 959 machine-to-machine interactions that do not involve the resource 960 owner in the authorization flow; therefore, this endpoint is out of 961 scope here. Future profiles may define constrained adaptation 962 mechanisms for this endpoint as well. Non-constrained clients 963 interacting with constrained resource servers can use the 964 specification in section 3.1 of [RFC6749] and the attack 965 countermeasures suggested in section 4.2 of [RFC6819]. 967 5.8. The Token Endpoint 969 In standard OAuth 2.0, the AS provides the token endpoint for 970 submitting access token requests. This framework extends the 971 functionality of the token endpoint, giving the AS the possibility to 972 help the client and RS to establish shared keys or to exchange their 973 public keys. Furthermore, this framework defines encodings using 974 CBOR, as a substitute for JSON. 976 The endpoint may also be exposed over HTTPS as in classical OAuth or 977 even other transports. A profile MUST define the details of the 978 mapping between the fields described below, and these transports. If 979 HTTPS is used, the semantics of Sections 4.1.3 and 4.1.4 of the OAuth 980 2.0 specification MUST be followed (with additions as described 981 below). If the CoAP is some other transport with CBOR payload format 982 is supported, the semantics described in this section MUST be 983 followed. 985 For the AS to be able to issue a token, the client MUST be 986 authenticated and present a valid grant for the scopes requested. 987 Profiles of this framework MUST specify how the AS authenticates the 988 client and how the communication between client and AS is protected, 989 fulfilling the requirements specified in Section 5. 991 The default name of this endpoint in an url-path SHOULD be '/token'. 992 However, implementations are not required to use this name and can 993 define their own instead. 995 The figures of this section use CBOR diagnostic notation without the 996 integer abbreviations for the parameters or their values for 997 illustrative purposes. Note that implementations MUST use the 998 integer abbreviations and the binary CBOR encoding, if the CBOR 999 encoding is used. 1001 5.8.1. Client-to-AS Request 1003 The client sends a POST request to the token endpoint at the AS. The 1004 profile MUST specify how the communication is protected. The content 1005 of the request consists of the parameters specified in the relevant 1006 subsection of section 4 of the OAuth 2.0 specification [RFC6749], 1007 depending on the grant type, with the following exceptions and 1008 additions: 1010 o The parameter "grant_type" is OPTIONAL in the context of this 1011 framework (as opposed to REQUIRED in RFC6749). If that parameter 1012 is missing, the default value "client_credentials" is implied. 1014 o The "audience" parameter from [RFC8693] is OPTIONAL to request an 1015 access token bound to a specific audience. 1017 o The "cnonce" parameter defined in Section 5.8.4.4 is REQUIRED if 1018 the RS provided a client-nonce in the "AS Request Creation Hints" 1019 message Section 5.3 1021 o The "scope" parameter MAY be encoded as a byte string instead of 1022 the string encoding specified in section 3.3 of [RFC6749], in 1023 order allow compact encoding of complex scopes. The syntax of 1024 such a binary encoding is explicitly not specified here and left 1025 to profiles or applications. Note specifically that a binary 1026 encoded scope does not necessarily use the space character '0x20' 1027 to delimit scope-tokens. 1029 o The client can send an empty (null value) "ace_profile" parameter 1030 to indicate that it wants the AS to include the "ace_profile" 1031 parameter in the response. See Section 5.8.4.3. 1033 o A client MUST be able to use the parameters from 1034 [I-D.ietf-ace-oauth-params] in an access token request to the 1035 token endpoint and the AS MUST be able to process these additional 1036 parameters. 1038 The default behavior, is that the AS generates a symmetric proof-of- 1039 possession key for the client. In order to use an asymmetric key 1040 pair or to re-use a key previously established with the RS, the 1041 client is supposed to use the "req_cnf" parameter from 1042 [I-D.ietf-ace-oauth-params]. 1044 If CoAP is used then these parameters MUST be provided in a CBOR map, 1045 see Figure 12. 1047 When HTTP is used as a transport then the client makes a request to 1048 the token endpoint, the parameters MUST be encoded as defined in 1049 Appendix B of [RFC6749]. 1051 The following examples illustrate different types of requests for 1052 proof-of-possession tokens. 1054 Figure 5 shows a request for a token with a symmetric proof-of- 1055 possession key. The content is displayed in CBOR diagnostic 1056 notation, without abbreviations for better readability. 1058 Header: POST (Code=0.02) 1059 Uri-Host: "as.example.com" 1060 Uri-Path: "token" 1061 Content-Format: "application/ace+cbor" 1062 Payload: 1063 { 1064 "client_id" : "myclient", 1065 "audience" : "tempSensor4711" 1066 } 1068 Figure 5: Example request for an access token bound to a symmetric 1069 key. 1071 Figure 6 shows a request for a token with an asymmetric proof-of- 1072 possession key. Note that in this example OSCORE [RFC8613] is used 1073 to provide object-security, therefore the Content-Format is 1074 "application/oscore" wrapping the "application/ace+cbor" type 1075 content. The OSCORE option has a decoded interpretation appended in 1076 parentheses for the reader's convenience. Also note that in this 1077 example the audience is implicitly known by both client and AS. 1078 Furthermore note that this example uses the "req_cnf" parameter from 1079 [I-D.ietf-ace-oauth-params]. 1081 Header: POST (Code=0.02) 1082 Uri-Host: "as.example.com" 1083 Uri-Path: "token" 1084 OSCORE: 0x09, 0x05, 0x44, 0x6C 1085 (h=0, k=1, n=001, partialIV= 0x05, kid=[0x44, 0x6C]) 1086 Content-Format: "application/oscore" 1087 Payload: 1088 0x44025d1 ... (full payload omitted for brevity) ... 68b3825e 1090 Decrypted payload: 1091 { 1092 "client_id" : "myclient", 1093 "req_cnf" : { 1094 "COSE_Key" : { 1095 "kty" : "EC", 1096 "kid" : h'11', 1097 "crv" : "P-256", 1098 "x" : b64'usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8', 1099 "y" : b64'IBOL+C3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4' 1100 } 1101 } 1102 } 1104 Figure 6: Example token request bound to an asymmetric key. 1106 Figure 7 shows a request for a token where a previously communicated 1107 proof-of-possession key is only referenced using the "req_cnf" 1108 parameter from [I-D.ietf-ace-oauth-params]. 1110 Header: POST (Code=0.02) 1111 Uri-Host: "as.example.com" 1112 Uri-Path: "token" 1113 Content-Format: "application/ace+cbor" 1114 Payload: 1115 { 1116 "client_id" : "myclient", 1117 "audience" : "valve424", 1118 "scope" : "read", 1119 "req_cnf" : { 1120 "kid" : b64'6kg0dXJM13U' 1121 } 1122 } 1124 Figure 7: Example request for an access token bound to a key 1125 reference. 1127 Refresh tokens are typically not stored as securely as proof-of- 1128 possession keys in requesting clients. Proof-of-possession based 1129 refresh token requests MUST NOT request different proof-of-possession 1130 keys or different audiences in token requests. Refresh token 1131 requests can only use to request access tokens bound to the same 1132 proof-of-possession key and the same audience as access tokens issued 1133 in the initial token request. 1135 5.8.2. AS-to-Client Response 1137 If the access token request has been successfully verified by the AS 1138 and the client is authorized to obtain an access token corresponding 1139 to its access token request, the AS sends a response with the 1140 response code equivalent to the CoAP response code 2.01 (Created). 1141 If client request was invalid, or not authorized, the AS returns an 1142 error response as described in Section 5.8.3. 1144 Note that the AS decides which token type and profile to use when 1145 issuing a successful response. It is assumed that the AS has prior 1146 knowledge of the capabilities of the client and the RS (see 1147 Appendix D). This prior knowledge may, for example, be set by the 1148 use of a dynamic client registration protocol exchange [RFC7591]. If 1149 the client has requested a specific proof-of-possession key using the 1150 "req_cnf" parameter from [I-D.ietf-ace-oauth-params], this may also 1151 influence which profile the AS selects, as it needs to support the 1152 use of the key type requested the client. 1154 The content of the successful reply is the Access Information. When 1155 using CoAP, the payload MUST be encoded as a CBOR map, when using 1156 HTTP the encoding is a JSON map as specified in section 5.1 of 1157 [RFC6749]. In both cases the parameters specified in Section 5.1 of 1158 [RFC6749] are used, with the following additions and changes: 1160 ace_profile: 1161 OPTIONAL unless the request included an empty ace_profile 1162 parameter in which case it is MANDATORY. This indicates the 1163 profile that the client MUST use towards the RS. See 1164 Section 5.8.4.3 for the formatting of this parameter. If this 1165 parameter is absent, the AS assumes that the client implicitly 1166 knows which profile to use towards the RS. 1168 token_type: 1169 This parameter is OPTIONAL, as opposed to 'required' in [RFC6749]. 1170 By default implementations of this framework SHOULD assume that 1171 the token_type is "PoP". If a specific use case requires another 1172 token_type (e.g., "Bearer") to be used then this parameter is 1173 REQUIRED. 1175 Furthermore [I-D.ietf-ace-oauth-params] defines additional parameters 1176 that the AS MUST be able to use when responding to a request to the 1177 token endpoint. 1179 Figure 8 summarizes the parameters that can currently be part of the 1180 Access Information. Future extensions may define additional 1181 parameters. 1183 /-------------------+-------------------------------\ 1184 | Parameter name | Specified in | 1185 |-------------------+-------------------------------| 1186 | access_token | RFC 6749 | 1187 | token_type | RFC 6749 | 1188 | expires_in | RFC 6749 | 1189 | refresh_token | RFC 6749 | 1190 | scope | RFC 6749 | 1191 | state | RFC 6749 | 1192 | error | RFC 6749 | 1193 | error_description | RFC 6749 | 1194 | error_uri | RFC 6749 | 1195 | ace_profile | [this document] | 1196 | cnf | [I-D.ietf-ace-oauth-params] | 1197 | rs_cnf | [I-D.ietf-ace-oauth-params] | 1198 \-------------------+-------------------------------/ 1200 Figure 8: Access Information parameters 1202 Figure 9 shows a response containing a token and a "cnf" parameter 1203 with a symmetric proof-of-possession key, which is defined in 1204 [I-D.ietf-ace-oauth-params]. Note that the key identifier 'kid' is 1205 only used to simplify indexing and retrieving the key, and no 1206 assumptions should be made that it is unique in the domains of either 1207 the client or the RS. 1209 Header: Created (Code=2.01) 1210 Content-Format: "application/ace+cbor" 1211 Payload: 1212 { 1213 "access_token" : b64'SlAV32hkKG ... 1214 (remainder of CWT omitted for brevity; 1215 CWT contains COSE_Key in the "cnf" claim)', 1216 "ace_profile" : "coap_dtls", 1217 "expires_in" : "3600", 1218 "cnf" : { 1219 "COSE_Key" : { 1220 "kty" : "Symmetric", 1221 "kid" : b64'39Gqlw', 1222 "k" : b64'hJtXhkV8FJG+Onbc6mxCcQh' 1223 } 1224 } 1225 } 1227 Figure 9: Example AS response with an access token bound to a 1228 symmetric key. 1230 5.8.3. Error Response 1232 The error responses for interactions with the AS are generally 1233 equivalent to the ones defined in Section 5.2 of [RFC6749], with the 1234 following exceptions: 1236 o When using CoAP the payload MUST be encoded as a CBOR map, with 1237 the Content-Format "application/ace+cbor". When using HTTP the 1238 payload is encoded in JSON as specified in section 5.2 of 1239 [RFC6749]. 1241 o A response code equivalent to the CoAP code 4.00 (Bad Request) 1242 MUST be used for all error responses, except for invalid_client 1243 where a response code equivalent to the CoAP code 4.01 1244 (Unauthorized) MAY be used under the same conditions as specified 1245 in Section 5.2 of [RFC6749]. 1247 o The parameters "error", "error_description" and "error_uri" MUST 1248 be abbreviated using the codes specified in Figure 12, when a CBOR 1249 encoding is used. 1251 o The error code (i.e., value of the "error" parameter) MUST be 1252 abbreviated as specified in Figure 10, when a CBOR encoding is 1253 used. 1255 /---------------------------+-------------\ 1256 | Name | CBOR Values | 1257 |---------------------------+-------------| 1258 | invalid_request | 1 | 1259 | invalid_client | 2 | 1260 | invalid_grant | 3 | 1261 | unauthorized_client | 4 | 1262 | unsupported_grant_type | 5 | 1263 | invalid_scope | 6 | 1264 | unsupported_pop_key | 7 | 1265 | incompatible_ace_profiles | 8 | 1266 \---------------------------+-------------/ 1268 Figure 10: CBOR abbreviations for common error codes 1270 In addition to the error responses defined in OAuth 2.0, the 1271 following behavior MUST be implemented by the AS: 1273 o If the client submits an asymmetric key in the token request that 1274 the RS cannot process, the AS MUST reject that request with a 1275 response code equivalent to the CoAP code 4.00 (Bad Request) 1276 including the error code "unsupported_pop_key" specified in 1277 Figure 10. 1279 o If the client and the RS it has requested an access token for do 1280 not share a common profile, the AS MUST reject that request with a 1281 response code equivalent to the CoAP code 4.00 (Bad Request) 1282 including the error code "incompatible_ace_profiles" specified in 1283 Figure 10. 1285 5.8.4. Request and Response Parameters 1287 This section provides more detail about the new parameters that can 1288 be used in access token requests and responses, as well as 1289 abbreviations for more compact encoding of existing parameters and 1290 common parameter values. 1292 5.8.4.1. Grant Type 1294 The abbreviations specified in the registry defined in Section 8.5 1295 MUST be used in CBOR encodings instead of the string values defined 1296 in [RFC6749], if CBOR payloads are used. 1298 /--------------------+------------+------------------------\ 1299 | Name | CBOR Value | Original Specification | 1300 |--------------------+------------+------------------------| 1301 | password | 0 | s. 4.3.2 of [RFC6749] | 1302 | authorization_code | 1 | s. 4.1.3 of [RFC6749] | 1303 | client_credentials | 2 | s. 4.4.2 of [RFC6749] | 1304 | refresh_token | 3 | s. 6 of [RFC6749] | 1305 \--------------------+------------+------------------------/ 1307 Figure 11: CBOR abbreviations for common grant types 1309 5.8.4.2. Token Type 1311 The "token_type" parameter, defined in section 5.1 of [RFC6749], 1312 allows the AS to indicate to the client which type of access token it 1313 is receiving (e.g., a bearer token). 1315 This document registers the new value "PoP" for the OAuth Access 1316 Token Types registry, specifying a proof-of-possession token. How 1317 the proof-of-possession by the client to the RS is performed MUST be 1318 specified by the profiles. 1320 The values in the "token_type" parameter MUST use the CBOR 1321 abbreviations defined in the registry specified by Section 8.7, if a 1322 CBOR encoding is used. 1324 In this framework the "pop" value for the "token_type" parameter is 1325 the default. The AS may, however, provide a different value from 1326 those registered in [IANA.OAuthAccessTokenTypes]. 1328 5.8.4.3. Profile 1330 Profiles of this framework MUST define the communication protocol and 1331 the communication security protocol between the client and the RS. 1332 The security protocol MUST provide encryption, integrity and replay 1333 protection. It MUST also provide a binding between requests and 1334 responses. Furthermore profiles MUST define a list of allowed proof- 1335 of-possession methods, if they support proof-of-possession tokens. 1337 A profile MUST specify an identifier that MUST be used to uniquely 1338 identify itself in the "ace_profile" parameter. The textual 1339 representation of the profile identifier is intended for human 1340 readability and for JSON-based interactions, it MUST NOT be used for 1341 CBOR-based interactions. Profiles MUST register their identifier in 1342 the registry defined in Section 8.8. 1344 Profiles MAY define additional parameters for both the token request 1345 and the Access Information in the access token response in order to 1346 support negotiation or signaling of profile specific parameters. 1348 Clients that want the AS to provide them with the "ace_profile" 1349 parameter in the access token response can indicate that by sending a 1350 ace_profile parameter with a null value for CBOR-based interactions, 1351 or an empty string if CBOR is not used, in the access token request. 1353 5.8.4.4. Client-Nonce 1355 This parameter MUST be sent from the client to the AS, if it 1356 previously received a "cnonce" parameter in the "AS Request Creation 1357 Hints" Section 5.3. The parameter is encoded as a byte string for 1358 CBOR-based interactions, and as a string (Base64 encoded binary) if 1359 CBOR is not used. It MUST copy the value from the cnonce parameter 1360 in the "AS Request Creation Hints". 1362 5.8.5. Mapping Parameters to CBOR 1364 If CBOR encoding is used, all OAuth parameters in access token 1365 requests and responses MUST be mapped to CBOR types as specified in 1366 the registry defined by Section 8.10, using the given integer 1367 abbreviation for the map keys. 1369 Note that we have aligned the abbreviations corresponding to claims 1370 with the abbreviations defined in [RFC8392]. 1372 Note also that abbreviations from -24 to 23 have a 1 byte encoding 1373 size in CBOR. We have thus chosen to assign abbreviations in that 1374 range to parameters we expect to be used most frequently in 1375 constrained scenarios. 1377 /-------------------+----------+---------------------\ 1378 | Name | CBOR Key | Value Type | 1379 |-------------------+----------+---------------------| 1380 | access_token | 1 | byte string | 1381 | expires_in | 2 | unsigned integer | 1382 | audience | 5 | text string | 1383 | scope | 9 | text or byte string | 1384 | client_id | 24 | text string | 1385 | client_secret | 25 | byte string | 1386 | response_type | 26 | text string | 1387 | redirect_uri | 27 | text string | 1388 | state | 28 | text string | 1389 | code | 29 | byte string | 1390 | error | 30 | integer | 1391 | error_description | 31 | text string | 1392 | error_uri | 32 | text string | 1393 | grant_type | 33 | unsigned integer | 1394 | token_type | 34 | integer | 1395 | username | 35 | text string | 1396 | password | 36 | text string | 1397 | refresh_token | 37 | byte string | 1398 | ace_profile | 38 | integer | 1399 | cnonce | 39 | byte string | 1400 \-------------------+----------+---------------------/ 1402 Figure 12: CBOR mappings used in token requests and responses 1404 5.9. The Introspection Endpoint 1406 Token introspection [RFC7662] MAY be implemented by the AS, and the 1407 RS. When implemented, it MAY be used by the RS and to query the AS 1408 for metadata about a given token, e.g., validity or scope. Analogous 1409 to the protocol defined in [RFC7662] for HTTP and JSON, this section 1410 defines adaptations to more constrained environments using CBOR and 1411 leaving the choice of the application protocol to the profile. 1413 Communication between the requesting entity and the introspection 1414 endpoint at the AS MUST be integrity protected and encrypted. The 1415 communication security protocol MUST also provide a binding between 1416 requests and responses. Furthermore, the two interacting parties 1417 MUST perform mutual authentication. Finally, the AS SHOULD verify 1418 that the requesting entity has the right to access introspection 1419 information about the provided token. Profiles of this framework 1420 that support introspection MUST specify how authentication and 1421 communication security between the requesting entity and the AS is 1422 implemented. 1424 The default name of this endpoint in an url-path SHOULD be 1425 '/introspect'. However, implementations are not required to use this 1426 name and can define their own instead. 1428 The figures of this section use the CBOR diagnostic notation without 1429 the integer abbreviations for the parameters and their values for 1430 better readability. 1432 5.9.1. Introspection Request 1434 The requesting entity sends a POST request to the introspection 1435 endpoint at the AS. The profile MUST specify how the communication 1436 is protected. If CoAP is used, the payload MUST be encoded as a CBOR 1437 map with a "token" entry containing the access token. Further 1438 optional parameters representing additional context that is known by 1439 the requesting entity to aid the AS in its response MAY be included. 1441 For CoAP-based interaction, all messages MUST use the content type 1442 "application/ace+cbor". For HTTP the encoding defined in section 2.1 1443 of [RFC7662] is used. 1445 The same parameters are required and optional as in Section 2.1 of 1446 [RFC7662]. 1448 For example, Figure 13 shows an RS calling the token introspection 1449 endpoint at the AS to query about an OAuth 2.0 proof-of-possession 1450 token. Note that object security based on OSCORE [RFC8613] is 1451 assumed in this example, therefore the Content-Format is 1452 "application/oscore". Figure 14 shows the decoded payload. 1454 Header: POST (Code=0.02) 1455 Uri-Host: "as.example.com" 1456 Uri-Path: "introspect" 1457 OSCORE: 0x09, 0x05, 0x25 1458 Content-Format: "application/oscore" 1459 Payload: 1460 ... COSE content ... 1462 Figure 13: Example introspection request. 1464 { 1465 "token" : b64'7gj0dXJQ43U', 1466 "token_type_hint" : "PoP" 1467 } 1469 Figure 14: Decoded payload. 1471 5.9.2. Introspection Response 1473 If the introspection request is authorized and successfully 1474 processed, the AS sends a response with the response code equivalent 1475 to the CoAP code 2.01 (Created). If the introspection request was 1476 invalid, not authorized or couldn't be processed the AS returns an 1477 error response as described in Section 5.9.3. 1479 In a successful response, the AS encodes the response parameters in a 1480 map. If CoAP is used, this MUST be encoded as a CBOR map, if HTTP is 1481 used the JSON encoding specified in section 2.2 of [RFC7662] is used. 1482 The map containing the response payload includes the same required 1483 and optional parameters as in Section 2.2 of [RFC7662] with the 1484 following additions: 1486 ace_profile OPTIONAL. This indicates the profile that the RS MUST 1487 use with the client. See Section 5.8.4.3 for more details on the 1488 formatting of this parameter. If this parameter is absent, the AS 1489 assumes that the RS implicitly knows which profile to use towards 1490 the client. 1492 cnonce OPTIONAL. A client-nonce provided to the AS by the client. 1493 The RS MUST verify that this corresponds to the client-nonce 1494 previously provided to the client in the "AS Request Creation 1495 Hints". See Section 5.3 and Section 5.8.4.4. 1497 exi OPTIONAL. The "expires-in" claim associated to this access 1498 token. See Section 5.10.3. 1500 Furthermore [I-D.ietf-ace-oauth-params] defines more parameters that 1501 the AS MUST be able to use when responding to a request to the 1502 introspection endpoint. 1504 For example, Figure 15 shows an AS response to the introspection 1505 request in Figure 13. Note that this example contains the "cnf" 1506 parameter defined in [I-D.ietf-ace-oauth-params]. 1508 Header: Created (Code=2.01) 1509 Content-Format: "application/ace+cbor" 1510 Payload: 1511 { 1512 "active" : true, 1513 "scope" : "read", 1514 "ace_profile" : "coap_dtls", 1515 "cnf" : { 1516 "COSE_Key" : { 1517 "kty" : "Symmetric", 1518 "kid" : b64'39Gqlw', 1519 "k" : b64'hJtXhkV8FJG+Onbc6mxCcQh' 1520 } 1521 } 1522 } 1524 Figure 15: Example introspection response. 1526 5.9.3. Error Response 1528 The error responses for CoAP-based interactions with the AS are 1529 equivalent to the ones for HTTP-based interactions as defined in 1530 Section 2.3 of [RFC7662], with the following differences: 1532 o If content is sent and CoAP is used the payload MUST be encoded as 1533 a CBOR map and the Content-Format "application/ace+cbor" MUST be 1534 used. For HTTP the encoding defined in section 2.3 of [RFC6749] 1535 is used. 1537 o If the credentials used by the requesting entity (usually the RS) 1538 are invalid the AS MUST respond with the response code equivalent 1539 to the CoAP code 4.01 (Unauthorized) and use the required and 1540 optional parameters from Section 2.3 in [RFC7662]. 1542 o If the requesting entity does not have the right to perform this 1543 introspection request, the AS MUST respond with a response code 1544 equivalent to the CoAP code 4.03 (Forbidden). In this case no 1545 payload is returned. 1547 o The parameters "error", "error_description" and "error_uri" MUST 1548 be abbreviated using the codes specified in Figure 12. 1550 o The error codes MUST be abbreviated using the codes specified in 1551 the registry defined by Section 8.4. 1553 Note that a properly formed and authorized query for an inactive or 1554 otherwise invalid token does not warrant an error response by this 1555 specification. In these cases, the authorization server MUST instead 1556 respond with an introspection response with the "active" field set to 1557 "false". 1559 5.9.4. Mapping Introspection Parameters to CBOR 1561 If CBOR is used, the introspection request and response parameters 1562 MUST be mapped to CBOR types as specified in the registry defined by 1563 Section 8.12, using the given integer abbreviation for the map key. 1565 Note that we have aligned abbreviations that correspond to a claim 1566 with the abbreviations defined in [RFC8392] and the abbreviations of 1567 parameters with the same name from Section 5.8.5. 1569 /-------------------+----------+-------------------------\ 1570 | Parameter name | CBOR Key | Value Type | 1571 |-------------------+----------+-------------------------| 1572 | iss | 1 | text string | 1573 | sub | 2 | text string | 1574 | aud | 3 | text string | 1575 | exp | 4 | integer or | 1576 | | | floating-point number | 1577 | nbf | 5 | integer or | 1578 | | | floating-point number | 1579 | iat | 6 | integer or | 1580 | | | floating-point number | 1581 | cti | 7 | byte string | 1582 | scope | 9 | text or byte string | 1583 | active | 10 | True or False | 1584 | token | 11 | byte string | 1585 | client_id | 24 | text string | 1586 | error | 30 | integer | 1587 | error_description | 31 | text string | 1588 | error_uri | 32 | text string | 1589 | token_type_hint | 33 | text string | 1590 | token_type | 34 | integer | 1591 | username | 35 | text string | 1592 | ace_profile | 38 | integer | 1593 | cnonce | 39 | byte string | 1594 | exi | 40 | unsigned integer | 1595 \-------------------+----------+-------------------------/ 1597 Figure 16: CBOR Mappings to Token Introspection Parameters. 1599 5.10. The Access Token 1601 In this framework the use of CBOR Web Token (CWT) as specified in 1602 [RFC8392] is RECOMMENDED. 1604 In order to facilitate offline processing of access tokens, this 1605 document uses the "cnf" claim from [RFC8747] and the "scope" claim 1606 from [RFC8693] for JWT- and CWT-encoded tokens. In addition to 1607 string encoding specified for the "scope" claim, a binary encoding 1608 MAY be used. The syntax of such an encoding is explicitly not 1609 specified here and left to profiles or applications, specifically 1610 note that a binary encoded scope does not necessarily use the space 1611 character '0x20' to delimit scope-tokens. 1613 If the AS needs to convey a hint to the RS about which profile it 1614 should use to communicate with the client, the AS MAY include an 1615 "ace_profile" claim in the access token, with the same syntax and 1616 semantics as defined in Section 5.8.4.3. 1618 If the client submitted a client-nonce parameter in the access token 1619 request Section 5.8.4.4, the AS MUST include the value of this 1620 parameter in the "cnonce" claim specified here. The "cnonce" claim 1621 uses binary encoding. 1623 5.10.1. The Authorization Information Endpoint 1625 The access token, containing authorization information and 1626 information about the proof-of-possession method used by the client, 1627 needs to be transported to the RS so that the RS can authenticate and 1628 authorize the client request. 1630 This section defines a method for transporting the access token to 1631 the RS using a RESTful protocol such as CoAP. Profiles of this 1632 framework MAY define other methods for token transport. 1634 The method consists of an authz-info endpoint, implemented by the RS. 1635 A client using this method MUST make a POST request to the authz-info 1636 endpoint at the RS with the access token in the payload. The CoAP 1637 Content-Format or HTTP Media Type MUST reflect the format of the 1638 token, e.g. application/cwt for CBOR Web Tokens, if no Content-Format 1639 or Media Type is defined for the token format, application/octet- 1640 stream MUST be used. 1642 The RS receiving the token MUST verify the validity of the token. If 1643 the token is valid, the RS MUST respond to the POST request with a 1644 response code equivalent to CoAP's 2.01 (Created). Section 5.10.1.1 1645 outlines how an RS MUST proceed to verify the validity of an access 1646 token. 1648 The RS MUST be prepared to store at least one access token for future 1649 use. This is a difference to how access tokens are handled in OAuth 1650 2.0, where the access token is typically sent along with each 1651 request, and therefore not stored at the RS. 1653 When using this framework it is RECOMMENDED that an RS stores only 1654 one token per proof-of-possession key. This means that an additional 1655 token linked to the same key will supersede any existing token at the 1656 RS, by replacing the corresponding authorization information. The 1657 reason is that this greatly simplifies (constrained) implementations, 1658 with respect to required storage and resolving a request to the 1659 applicable token. The use of multiple access tokens for a single 1660 client increases the strain on the resource server as it must 1661 consider every access token and calculate the actual permissions of 1662 the client. Also, tokens may contradict each other which may lead 1663 the server to enforce wrong permissions. If one of the access tokens 1664 expires earlier than others, the resulting permissions may offer 1665 insufficient protection. 1667 If the payload sent to the authz-info endpoint does not parse to a 1668 token, the RS MUST respond with a response code equivalent to the 1669 CoAP code 4.00 (Bad Request). 1671 The RS MAY make an introspection request to validate the token before 1672 responding to the POST request to the authz-info endpoint, e.g. if 1673 the token is an opaque reference. Some transport protocols may 1674 provide a way to indicate that the RS is busy and the client should 1675 retry after an interval; this type of status update would be 1676 appropriate while the RS is waiting for an introspection response. 1678 Profiles MUST specify whether the authz-info endpoint is protected, 1679 including whether error responses from this endpoint are protected. 1680 Note that since the token contains information that allow the client 1681 and the RS to establish a security context in the first place, mutual 1682 authentication may not be possible at this point. 1684 The default name of this endpoint in an url-path is '/authz-info', 1685 however implementations are not required to use this name and can 1686 define their own instead. 1688 5.10.1.1. Verifying an Access Token 1690 When an RS receives an access token, it MUST verify it before storing 1691 it. The details of token verification depends on various aspects, 1692 including the token encoding, the type of token, the security 1693 protection applied to the token, and the claims. The token encoding 1694 matters since the security protection differs between the token 1695 encodings. For example, a CWT token uses COSE while a JWT token uses 1696 JOSE. The type of token also has an influence on the verification 1697 procedure since tokens may be self-contained whereby token 1698 verification may happen locally at the RS while a token-by-reference 1699 requires further interaction with the authorization server, for 1700 example using token introspection, to obtain the claims associated 1701 with the token reference. Self-contained tokens MUST, at least be 1702 integrity protected but they MAY also be encrypted. 1704 For self-contained tokens the RS MUST process the security protection 1705 of the token first, as specified by the respective token format. For 1706 CWT the description can be found in [RFC8392] and for JWT the 1707 relevant specification is [RFC7519]. This MUST include a 1708 verification that security protection (and thus the token) was 1709 generated by an AS that has the right to issue access tokens for this 1710 RS. 1712 In case the token is communicated by reference the RS needs to obtain 1713 the claims first. When the RS uses token introspection the relevant 1714 specification is [RFC7662] with CoAP transport specified in 1715 Section 5.9. 1717 Errors may happen during this initial processing stage: 1719 o If the verification of the security wrapper fails, or the token 1720 was issued by an AS that does not have the right to issue tokens 1721 for the receiving RS, the RS MUST discard the token and, if this 1722 was an interaction with authz-info, return an error message with a 1723 response code equivalent to the CoAP code 4.01 (Unauthorized). 1725 o If the claims cannot be obtained the RS MUST discard the token 1726 and, in case of an interaction via the authz-info endpoint, return 1727 an error message with a response code equivalent to the CoAP code 1728 4.00 (Bad Request). 1730 Next, the RS MUST verify claims, if present, contained in the access 1731 token. Errors are returned when claim checks fail, in the order of 1732 priority of this list: 1734 iss The issuer claim (if present) must identify the AS that has 1735 produced the security protection for the access token. If that is 1736 not the case the RS MUST discard the token. If this was an 1737 interaction with authz-info, the RS MUST also respond with a 1738 response code equivalent to the CoAP code 4.01 (Unauthorized). 1740 exp The expiration date must be in the future. If that is not the 1741 case the RS MUST discard the token. If this was an interaction 1742 with authz-info the RS MUST also respond with a response code 1743 equivalent to the CoAP code 4.01 (Unauthorized). Note that the RS 1744 has to terminate access rights to the protected resources at the 1745 time when the tokens expire. 1747 aud The audience claim must refer to an audience that the RS 1748 identifies with. If that is not the case the RS MUST discard the 1749 token. If this was an interaction with authz-info, the RS MUST 1750 also respond with a response code equivalent to the CoAP code 4.03 1751 (Forbidden). 1753 scope The RS must recognize value of the scope claim. If that is 1754 not the case the RS MUST discard the token. If this was an 1755 interaction with authz-info, the RS MUST also respond with a 1756 response code equivalent to the CoAP code 4.00 (Bad Request). The 1757 RS MAY provide additional information in the error response, to 1758 clarify what went wrong. 1760 Additional processing may be needed for other claims in a way 1761 specific to a profile or the underlying application. 1763 Note that the Subject (sub) claim cannot always be verified when the 1764 token is submitted to the RS since the client may not have 1765 authenticated yet. Also note that a counter for the expires_in (exi) 1766 claim MUST be initialized when the RS first verifies this token. 1768 Also note that profiles of this framework may define access token 1769 transport mechanisms that do not allow for error responses. 1770 Therefore the error messages specified here only apply if the token 1771 was sent to the authz-info endpoint. 1773 When sending error responses, the RS MAY use the error codes from 1774 Section 3.1 of [RFC6750], to provide additional details to the 1775 client. 1777 5.10.1.2. Protecting the Authorization Information Endpoint 1779 As this framework can be used in RESTful environments, it is 1780 important to make sure that attackers cannot perform unauthorized 1781 requests on the authz-info endpoints, other than submitting access 1782 tokens. 1784 Specifically it SHOULD NOT be possible to perform GET, DELETE or PUT 1785 on the authz-info endpoint. 1787 The RS SHOULD implement rate limiting measures to mitigate attacks 1788 aiming to overload the processing capacity of the RS by repeatedly 1789 submitting tokens. For CoAP-based communication the RS could use the 1790 mechanisms from [RFC8516] to indicate that it is overloaded. 1792 5.10.2. Client Requests to the RS 1794 Before sending a request to an RS, the client MUST verify that the 1795 keys used to protect this communication are still valid. See 1796 Section 5.10.4 for details on how the client determines the validity 1797 of the keys used. 1799 If an RS receives a request from a client, and the target resource 1800 requires authorization, the RS MUST first verify that it has an 1801 access token that authorizes this request, and that the client has 1802 performed the proof-of-possession binding that token to the request. 1804 The response code MUST be 4.01 (Unauthorized) in case the client has 1805 not performed the proof-of-possession, or if RS has no valid access 1806 token for the client. If RS has an access token for the client but 1807 the token does not authorize access for the resource that was 1808 requested, RS MUST reject the request with a 4.03 (Forbidden). If RS 1809 has an access token for the client but it does not cover the action 1810 that was requested on the resource, RS MUST reject the request with a 1811 4.05 (Method Not Allowed). 1813 Note: The use of the response codes 4.03 and 4.05 is intended to 1814 prevent infinite loops where a dumb client optimistically tries to 1815 access a requested resource with any access token received from AS. 1816 As malicious clients could pretend to be C to determine C's 1817 privileges, these detailed response codes must be used only when a 1818 certain level of security is already available which can be achieved 1819 only when the client is authenticated. 1821 Note: The RS MAY use introspection for timely validation of an access 1822 token, at the time when a request is presented. 1824 Note: Matching the claims of the access token (e.g., scope) to a 1825 specific request is application specific. 1827 If the request matches a valid token and the client has performed the 1828 proof-of-possession for that token, the RS continues to process the 1829 request as specified by the underlying application. 1831 5.10.3. Token Expiration 1833 Depending on the capabilities of the RS, there are various ways in 1834 which it can verify the expiration of a received access token. Here 1835 follows a list of the possibilities including what functionality they 1836 require of the RS. 1838 o The token is a CWT and includes an "exp" claim and possibly the 1839 "nbf" claim. The RS verifies these by comparing them to values 1840 from its internal clock as defined in [RFC7519]. In this case the 1841 RS's internal clock must reflect the current date and time, or at 1842 least be synchronized with the AS's clock. How this clock 1843 synchronization would be performed is out of scope for this 1844 specification. 1846 o The RS verifies the validity of the token by performing an 1847 introspection request as specified in Section 5.9. This requires 1848 the RS to have a reliable network connection to the AS and to be 1849 able to handle two secure sessions in parallel (C to RS and RS to 1850 AS). 1852 o In order to support token expiration for devices that have no 1853 reliable way of synchronizing their internal clocks, this 1854 specification defines the following approach: The claim "exi" 1855 ("expires in") can be used, to provide the RS with the lifetime of 1856 the token in seconds from the time the RS first receives the 1857 token. This mechanism only works for self-contained tokens, i.e. 1858 CWTs and JWTs. For CWTs this parameter is encoded as unsigned 1859 integer, while JWTs encode this as JSON number. 1861 o Processing this claim requires that the RS does the following: 1863 * For each token the RS receives, that contains an "exi" claim: 1864 Keep track of the time it received that token and revisit that 1865 list regularly to expunge expired tokens. 1867 * Keep track of the identifiers of tokens containing the "exi" 1868 claim that have expired (in order to avoid accepting them 1869 again). In order to avoid an unbounded memory usage growth, 1870 this MUST be implemented in the following way when the "exi" 1871 claim is used: 1873 + When creating the token, the AS MUST add a 'cti' claim ( or 1874 'jti' for JWTs) to the access token. The value of this 1875 claim MUST be created as the binary representation of the 1876 concatenation of the identifier of the RS with a sequence 1877 number counting the tokens containing an 'exi' claim, issued 1878 by this AS for the RS. 1880 + The RS MUST store the highest sequence number of an expired 1881 token containing the "exi" claim that it has seen, and treat 1882 tokens with lower sequence numbers as expired. Note that 1883 this could lead to discarding valid tokens with lower 1884 sequence numbers, if the AS where to issue tokens of 1885 different validity time for the same RS. The assumption is 1886 that typically tokens in such a scenario would all have the 1887 same validity time. 1889 If a token that authorizes a long running request such as a CoAP 1890 Observe [RFC7641] expires, the RS MUST send an error response with 1891 the response code equivalent to the CoAP code 4.01 (Unauthorized) to 1892 the client and then terminate processing the long running request. 1894 5.10.4. Key Expiration 1896 The AS provides the client with key material that the RS uses. This 1897 can either be a common symmetric PoP-key, or an asymmetric key used 1898 by the RS to authenticate towards the client. Since there is 1899 currently no expiration metadata associated to those keys, the client 1900 has no way of knowing if these keys are still valid. This may lead 1901 to situations where the client sends requests containing sensitive 1902 information to the RS using a key that is expired and possibly in the 1903 hands of an attacker, or accepts responses from the RS that are not 1904 properly protected and could possibly have been forged by an 1905 attacker. 1907 In order to prevent this, the client must assume that those keys are 1908 only valid as long as the related access token is. Since the access 1909 token is opaque to the client, one of the following methods MUST be 1910 used to inform the client about the validity of an access token: 1912 o The client knows a default validity time for all tokens it is 1913 using (i.e. how long a token is valid after being issued). This 1914 information could be provisioned to the client when it is 1915 registered at the AS, or published by the AS in a way that the 1916 client can query. 1918 o The AS informs the client about the token validity using the 1919 "expires_in" parameter in the Access Information. 1921 A client that is not able to obtain information about the expiration 1922 of a token MUST NOT use this token. 1924 6. Security Considerations 1926 Security considerations applicable to authentication and 1927 authorization in RESTful environments provided in OAuth 2.0 [RFC6749] 1928 apply to this work. Furthermore [RFC6819] provides additional 1929 security considerations for OAuth which apply to IoT deployments as 1930 well. If the introspection endpoint is used, the security 1931 considerations from [RFC7662] also apply. 1933 The following subsections address issues specific to this document 1934 and it's use in constrained environments. 1936 6.1. Protecting Tokens 1938 A large range of threats can be mitigated by protecting the contents 1939 of the access token by using a digital signature or a keyed message 1940 digest (MAC) or an Authenticated Encryption with Associated Data 1941 (AEAD) algorithm. Consequently, the token integrity protection MUST 1942 be applied to prevent the token from being modified, particularly 1943 since it contains a reference to the symmetric key or the asymmetric 1944 key used for proof-of-possession. If the access token contains the 1945 symmetric key, this symmetric key MUST be encrypted by the 1946 authorization server so that only the resource server can decrypt it. 1947 Note that using an AEAD algorithm is preferable over using a MAC 1948 unless the token needs to be publicly readable. 1950 If the token is intended for multiple recipients (i.e. an audience 1951 that is a group), integrity protection of the token with a symmetric 1952 key, shared between the AS and the recipients, is not sufficient, 1953 since any of the recipients could modify the token undetected by the 1954 other recipients. Therefore a token with a multi-recipient audience 1955 MUST be protected with an asymmetric signature. 1957 It is important for the authorization server to include the identity 1958 of the intended recipient (the audience), typically a single resource 1959 server (or a list of resource servers), in the token. The same 1960 shared secret MUST NOT be used as proof-of-possession key with 1961 multiple resource servers since the benefit from using the proof-of- 1962 possession concept is then significantly reduced. 1964 If clients are capable of doing so, they should frequently request 1965 fresh access tokens, as this allows the AS to keep the lifetime of 1966 the tokens short. This allows the AS to use shorter proof-of- 1967 possession key sizes, which translate to a performance benefit for 1968 the client and for the resource server. Shorter keys also lead to 1969 shorter messages (particularly with asymmetric keying material). 1971 When authorization servers bind symmetric keys to access tokens, they 1972 SHOULD scope these access tokens to a specific permission. 1974 In certain situations it may be necessary to revoke an access token 1975 that is still valid. Client-initiated revocation is specified in 1976 [RFC7009] for OAuth 2.0. Other revocation mechanisms are currently 1977 not specified, as the underlying assumption in OAuth is that access 1978 tokens are issued with a relatively short lifetime. This may not 1979 hold true for disconnected constrained devices, needing access tokens 1980 with relatively long lifetimes, and would therefore necessitate 1981 further standardization work that is out of scope for this document. 1983 6.2. Communication Security 1985 Communication with the authorization server MUST use confidentiality 1986 protection. This step is extremely important since the client or the 1987 RS may obtain the proof-of-possession key from the authorization 1988 server for use with a specific access token. Not using 1989 confidentiality protection exposes this secret (and the access token) 1990 to an eavesdropper thereby completely negating proof-of-possession 1991 security. The requirements for communication security of profiles 1992 are specified in Section 5. 1994 Additional protection for the access token can be applied by 1995 encrypting it, for example encryption of CWTs is specified in 1996 Section 5.1 of [RFC8392]. Such additional protection can be 1997 necessary if the token is later transferred over an insecure 1998 connection (e.g. when it is sent to the authz-info endpoint). 2000 Care must by taken by developers to prevent leakage of the PoP 2001 credentials (i.e., the private key or the symmetric key). An 2002 adversary in possession of the PoP credentials bound to the access 2003 token will be able to impersonate the client. Be aware that this is 2004 a real risk with many constrained environments, since adversaries may 2005 get physical access to the devices and can therefore use physical 2006 extraction techniques to gain access to memory contents. This risk 2007 can be mitigated to some extent by making sure that keys are 2008 refreshed frequently, by using software isolation techniques and by 2009 using hardware security. 2011 6.3. Long-Term Credentials 2013 Both clients and RSs have long-term credentials that are used to 2014 secure communications, and authenticate to the AS. These credentials 2015 need to be protected against unauthorized access. In constrained 2016 devices, deployed in publicly accessible places, such protection can 2017 be difficult to achieve without specialized hardware (e.g. secure key 2018 storage memory). 2020 If credentials are lost or compromised, the operator of the affected 2021 devices needs to have procedures to invalidate any access these 2022 credentials give and to revoke tokens linked to such credentials. 2023 The loss of a credential linked to a specific device MUST NOT lead to 2024 a compromise of other credentials not linked to that device, 2025 therefore secret keys used for authentication MUST NOT be shared 2026 between more than two parties. 2028 Operators of clients or RS SHOULD have procedures in place to replace 2029 credentials that are suspected to have been compromised or that have 2030 been lost. 2032 Operators also SHOULD have procedures for decommissioning devices, 2033 that include securely erasing credentials and other security critical 2034 material in the devices being decommissioned. 2036 6.4. Unprotected AS Request Creation Hints 2038 Initially, no secure channel exists to protect the communication 2039 between C and RS. Thus, C cannot determine if the "AS Request 2040 Creation Hints" contained in an unprotected response from RS to an 2041 unauthorized request (see Section 5.3) are authentic. C therefore 2042 MUST determine if an AS is authorized to provide access tokens for a 2043 certain RS. How this determination is implemented is out of scope 2044 for this document and left to the applications. 2046 6.5. Minimal Security Requirements for Communication 2048 This section summarizes the minimal requirements for the 2049 communication security of the different protocol interactions. 2051 C-AS All communication between the client and the Authorization 2052 Server MUST be encrypted, integrity and replay protected. 2053 Furthermore responses from the AS to the client MUST be bound to 2054 the client's request to avoid attacks where the attacker swaps the 2055 intended response for an older one valid for a previous request. 2056 This requires that the client and the Authorization Server have 2057 previously exchanged either a shared secret or their public keys 2058 in order to negotiate a secure communication. Furthermore the 2059 client MUST be able to determine whether an AS has the authority 2060 to issue access tokens for a certain RS. This can for example be 2061 done through pre-configured lists, or through an online lookup 2062 mechanism that in turn also must be secured. 2064 RS-AS The communication between the Resource Server and the 2065 Authorization Server via the introspection endpoint MUST be 2066 encrypted, integrity and replay protected. Furthermore responses 2067 from the AS to the RS MUST be bound to the RS's request. This 2068 requires that the RS and the Authorization Server have previously 2069 exchanged either a shared secret, or their public keys in order to 2070 negotiate a secure communication. Furthermore the RS MUST be able 2071 to determine whether an AS has the authority to issue access 2072 tokens itself. This is usually configured out of band, but could 2073 also be performed through an online lookup mechanism provided that 2074 it is also secured in the same way. 2076 C-RS The initial communication between the client and the Resource 2077 Server can not be secured in general, since the RS is not in 2078 possession of on access token for that client, which would carry 2079 the necessary parameters. If both parties support DTLS without 2080 client authentication it is RECOMMEND to use this mechanism for 2081 protecting the initial communication. After the client has 2082 successfully transmitted the access token to the RS, a secure 2083 communication protocol MUST be established between client and RS 2084 for the actual resource request. This protocol MUST provide 2085 confidentiality, integrity and replay protection as well as a 2086 binding between requests and responses. This requires that the 2087 client learned either the RS's public key or received a symmetric 2088 proof-of-possession key bound to the access token from the AS. 2089 The RS must have learned either the client's public key or a 2090 shared symmetric key from the claims in the token or an 2091 introspection request. Since ACE does not provide profile 2092 negotiation between C and RS, the client MUST have learned what 2093 profile the RS supports (e.g. from the AS or pre-configured) and 2094 initiate the communication accordingly. 2096 6.6. Token Freshness and Expiration 2098 An RS that is offline faces the problem of clock drift. Since it 2099 cannot synchronize its clock with the AS, it may be tricked into 2100 accepting old access tokens that are no longer valid or have been 2101 compromised. In order to prevent this, an RS may use the nonce-based 2102 mechanism (cnonce) defined in Section 5.3 to ensure freshness of an 2103 Access Token subsequently presented to this RS. 2105 Another problem with clock drift is that evaluating the standard 2106 token expiration claim "exp" can give unpredictable results. 2108 Acceptable ranges of clock drift are highly dependent on the concrete 2109 application. Important factors are how long access tokens are valid, 2110 and how critical timely expiration of access token is. 2112 The expiration mechanism implemented by the "exi" claim, based on the 2113 first time the RS sees the token was defined to provide a more 2114 predictable alternative. The "exi" approach has some drawbacks that 2115 need to be considered: 2117 A malicious client may hold back tokens with the "exi" claim in 2118 order to prolong their lifespan. 2120 If an RS loses state (e.g. due to an unscheduled reboot), it may 2121 lose the current values of counters tracking the "exi" claims of 2122 tokens it is storing. 2124 The first drawback is inherent to the deployment scenario and the 2125 "exi" solution. It can therefore not be mitigated without requiring 2126 the RS be online at times. The second drawback can be mitigated by 2127 regularly storing the value of "exi" counters to persistent memory. 2129 6.7. Combining Profiles 2131 There may be use cases were different profiles of this framework are 2132 combined. For example, an MQTT-TLS profile is used between the 2133 client and the RS in combination with a CoAP-DTLS profile for 2134 interactions between the client and the AS. The security of a 2135 profile MUST NOT depend on the assumption that the profile is used 2136 for all the different types of interactions in this framework. 2138 6.8. Unprotected Information 2140 Communication with the authz-info endpoint, as well as the various 2141 error responses defined in this framework, all potentially include 2142 sending information over an unprotected channel. These messages may 2143 leak information to an adversary, or may be manipulated by active 2144 attackers to induce incorrect behavior. For example error responses 2145 for requests to the Authorization Information endpoint can reveal 2146 information about an otherwise opaque access token to an adversary 2147 who has intercepted this token. 2149 As far as error messages are concerned, this framework is written 2150 under the assumption that, in general, the benefits of detailed error 2151 messages outweigh the risk due to information leakage. For 2152 particular use cases, where this assessment does not apply, detailed 2153 error messages can be replaced by more generic ones. 2155 In some scenarios it may be possible to protect the communication 2156 with the authz-info endpoint (e.g. through DTLS with only server-side 2157 authentication). In cases where this is not possible, it is 2158 RECOMMENDED to use encrypted CWTs or tokens that are opaque 2159 references and need to be subjected to introspection by the RS. 2161 If the initial unauthorized resource request message (see 2162 Section 5.2) is used, the client MUST make sure that it is not 2163 sending sensitive content in this request. While GET and DELETE 2164 requests only reveal the target URI of the resource, POST and PUT 2165 requests would reveal the whole payload of the intended operation. 2167 Since the client is not authenticated at the point when it is 2168 submitting an access token to the authz-info endpoint, attackers may 2169 be pretending to be a client and trying to trick an RS to use an 2170 obsolete profile that in turn specifies a vulnerable security 2171 mechanism via the authz-info endpoint. Such an attack would require 2172 a valid access token containing an "ace_profile" claim requesting the 2173 use of said obsolete profile. Resource Owners should update the 2174 configuration of their RS's to prevent them from using such obsolete 2175 profiles. 2177 6.9. Identifying Audiences 2179 The audience claim as defined in [RFC7519] and the equivalent 2180 "audience" parameter from [RFC8693] are intentionally vague on how to 2181 match the audience value to a specific RS. This is intended to allow 2182 application specific semantics to be used. This section attempts to 2183 give some general guidance for the use of audiences in constrained 2184 environments. 2186 URLs are not a good way of identifying mobile devices that can switch 2187 networks and thus be associated with new URLs. If the audience 2188 represents a single RS, and asymmetric keys are used, the RS can be 2189 uniquely identified by a hash of its public key. If this approach is 2190 used it is RECOMMENDED to apply the procedure from section 3 of 2191 [RFC6920]. 2193 If the audience addresses a group of resource servers, the mapping of 2194 group identifier to individual RS has to be provisioned to each RS 2195 before the group-audience is usable. Managing dynamic groups could 2196 be an issue, if any RS is not always reachable when the groups' 2197 memberships change. Furthermore, issuing access tokens bound to 2198 symmetric proof-of-possession keys that apply to a group-audience is 2199 problematic, as an RS that is in possession of the access token can 2200 impersonate the client towards the other RSs that are part of the 2201 group. It is therefore NOT RECOMMENDED to issue access tokens bound 2202 to a group audience and symmetric proof-of possession keys. 2204 Even the client must be able to determine the correct values to put 2205 into the "audience" parameter, in order to obtain a token for the 2206 intended RS. Errors in this process can lead to the client 2207 inadvertently obtaining a token for the wrong RS. The correct values 2208 for "audience" can either be provisioned to the client as part of its 2209 configuration, or dynamically looked up by the client in some 2210 directory. In the latter case the integrity and correctness of the 2211 directory data must be assured. Note that the "audience" hint 2212 provided by the RS as part of the "AS Request Creation Hints" 2213 Section 5.3 is not typically source authenticated and integrity 2214 protected, and should therefore not be treated a trusted value. 2216 6.10. Denial of Service Against or with Introspection 2218 The optional introspection mechanism provided by OAuth and supported 2219 in the ACE framework allows for two types of attacks that need to be 2220 considered by implementers. 2222 First, an attacker could perform a denial of service attack against 2223 the introspection endpoint at the AS in order to prevent validation 2224 of access tokens. To maintain the security of the system, an RS that 2225 is configured to use introspection MUST NOT allow access based on a 2226 token for which it couldn't reach the introspection endpoint. 2228 Second, an attacker could use the fact that an RS performs 2229 introspection to perform a denial of service attack against that RS 2230 by repeatedly sending tokens to its authz-info endpoint that require 2231 an introspection call. RS can mitigate such attacks by implementing 2232 rate limits on how many introspection requests they perform in a 2233 given time interval for a certain client IP address submitting tokens 2234 to /authz-info. When that limit has been reached, incoming requests 2235 from that address are rejected for a certain amount of time. A 2236 general rate limit on the introspection requests should also be 2237 considered, to mitigate distributed attacks. 2239 7. Privacy Considerations 2241 Implementers and users should be aware of the privacy implications of 2242 the different possible deployments of this framework. 2244 The AS is in a very central position and can potentially learn 2245 sensitive information about the clients requesting access tokens. If 2246 the client credentials grant is used, the AS can track what kind of 2247 access the client intends to perform. With other grants this can be 2248 prevented by the Resource Owner. To do so, the resource owner needs 2249 to bind the grants it issues to anonymous, ephemeral credentials that 2250 do not allow the AS to link different grants and thus different 2251 access token requests by the same client. 2253 The claims contained in a token can reveal privacy sensitive 2254 information about the client and the RS to any party having access to 2255 them (whether by processing the content of a self-contained token or 2256 by introspection). The AS SHOULD be configured to minimize the 2257 information about clients and RSs disclosed in the tokens it issues. 2259 If tokens are only integrity protected and not encrypted, they may 2260 reveal information to attackers listening on the wire, or able to 2261 acquire the access tokens in some other way. In the case of CWTs the 2262 token may, e.g., reveal the audience, the scope and the confirmation 2263 method used by the client. The latter may reveal the identity of the 2264 device or application running the client. This may be linkable to 2265 the identity of the person using the client (if there is a person and 2266 not a machine-to-machine interaction). 2268 Clients using asymmetric keys for proof-of-possession should be aware 2269 of the consequences of using the same key pair for proof-of- 2270 possession towards different RSs. A set of colluding RSs or an 2271 attacker able to obtain the access tokens will be able to link the 2272 requests, or even to determine the client's identity. 2274 An unprotected response to an unauthorized request (see Section 5.3) 2275 may disclose information about RS and/or its existing relationship 2276 with C. It is advisable to include as little information as possible 2277 in an unencrypted response. Even the absolute URI of the AS may 2278 reveal sensitive information about the service that RS provides. 2279 Developers must ensure that the RS does not disclose information that 2280 has an impact on the privacy of the stakeholders in the "AS Request 2281 Creation Hints". They may choose to use a different mechanism for 2282 the discovery of the AS if necessary. If means of encrypting 2283 communication between C and RS already exist, more detailed 2284 information may be included with an error response to provide C with 2285 sufficient information to react on that particular error. 2287 8. IANA Considerations 2289 This document creates several registries with a registration policy 2290 of "Expert Review"; guidelines to the experts are given in 2291 Section 8.17. 2293 8.1. ACE Authorization Server Request Creation Hints 2295 This specification establishes the IANA "ACE Authorization Server 2296 Request Creation Hints" registry. The registry has been created to 2297 use the "Expert Review" registration procedure [RFC8126]. It should 2298 be noted that, in addition to the expert review, some portions of the 2299 registry require a specification, potentially a Standards Track RFC, 2300 be supplied as well. 2302 The columns of the registry are: 2304 Name The name of the parameter 2306 CBOR Key CBOR map key for the parameter. Different ranges of values 2307 use different registration policies [RFC8126]. Integer values 2308 from -256 to 255 are designated as Standards Action. Integer 2309 values from -65536 to -257 and from 256 to 65535 are designated as 2310 Specification Required. Integer values greater than 65535 are 2311 designated as Expert Review. Integer values less than -65536 are 2312 marked as Private Use. 2314 Value Type The CBOR data types allowable for the values of this 2315 parameter. 2317 Reference This contains a pointer to the public specification of the 2318 request creation hint abbreviation, if one exists. 2320 This registry will be initially populated by the values in Figure 2. 2321 The Reference column for all of these entries will be this document. 2323 8.2. CoRE Resource Type Registry 2325 IANA is requested to register a new Resource Type (rt=) Link Target 2326 Attribute in the "Resource Type (rt=) Link Target Attribute Values" 2327 subregistry under the "Constrained RESTful Environments (CoRE) 2328 Parameters" [IANA.CoreParameters] registry: 2330 o Value: "ace.ai" 2331 o Description: ACE-OAuth authz-info endpoint resource. 2332 o Reference: [this document] 2334 Specific ACE-OAuth profiles can use this common resource type for 2335 defining their profile-specific discovery processes. 2337 8.3. OAuth Extensions Error Registration 2339 This specification registers the following error values in the OAuth 2340 Extensions Error registry [IANA.OAuthExtensionsErrorRegistry]. 2342 o Error name: "unsupported_pop_key" 2343 o Error usage location: token error response 2344 o Related protocol extension: [this document] 2345 o Change Controller: IESG 2346 o Specification document(s): Section 5.8.3 of [this document] 2348 o Error name: "incompatible_ace_profiles" 2349 o Error usage location: token error response 2350 o Related protocol extension: [this document] 2351 o Change Controller: IESG 2352 o Specification document(s): Section 5.8.3 of [this document] 2354 8.4. OAuth Error Code CBOR Mappings Registry 2356 This specification establishes the IANA "OAuth Error Code CBOR 2357 Mappings" registry. The registry has been created to use the "Expert 2358 Review" registration procedure [RFC8126], except for the value range 2359 designated for private use. 2361 The columns of the registry are: 2363 Name The OAuth Error Code name, refers to the name in Section 5.2. 2364 of [RFC6749], e.g., "invalid_request". 2365 CBOR Value CBOR abbreviation for this error code. Integer values 2366 less than -65536 are marked as "Private Use", all other values use 2367 the registration policy "Expert Review" [RFC8126]. 2368 Reference This contains a pointer to the public specification of the 2369 error code abbreviation, if one exists. 2371 This registry will be initially populated by the values in Figure 10. 2372 The Reference column for all of these entries will be this document. 2374 8.5. OAuth Grant Type CBOR Mappings 2376 This specification establishes the IANA "OAuth Grant Type CBOR 2377 Mappings" registry. The registry has been created to use the "Expert 2378 Review" registration procedure [RFC8126], except for the value range 2379 designated for private use. 2381 The columns of this registry are: 2383 Name The name of the grant type as specified in Section 1.3 of 2384 [RFC6749]. 2385 CBOR Value CBOR abbreviation for this grant type. Integer values 2386 less than -65536 are marked as "Private Use", all other values use 2387 the registration policy "Expert Review" [RFC8126]. 2388 Reference This contains a pointer to the public specification of the 2389 grant type abbreviation, if one exists. 2390 Original Specification This contains a pointer to the public 2391 specification of the grant type, if one exists. 2393 This registry will be initially populated by the values in Figure 11. 2394 The Reference column for all of these entries will be this document. 2396 8.6. OAuth Access Token Types 2398 This section registers the following new token type in the "OAuth 2399 Access Token Types" registry [IANA.OAuthAccessTokenTypes]. 2401 o Type name: "PoP" 2402 o Additional Token Endpoint Response Parameters: "cnf", "rs_cnf" see 2403 section 3.3 of [I-D.ietf-ace-oauth-params]. 2404 o HTTP Authentication Scheme(s): N/A 2405 o Change Controller: IETF 2406 o Specification document(s): [this document] 2408 8.7. OAuth Access Token Type CBOR Mappings 2410 This specification established the IANA "OAuth Access Token Type CBOR 2411 Mappings" registry. The registry has been created to use the "Expert 2412 Review" registration procedure [RFC8126], except for the value range 2413 designated for private use. 2415 The columns of this registry are: 2417 Name The name of token type as registered in the OAuth Access Token 2418 Types registry, e.g., "Bearer". 2420 CBOR Value CBOR abbreviation for this token type. Integer values 2421 less than -65536 are marked as "Private Use", all other values use 2422 the registration policy "Expert Review" [RFC8126]. 2423 Reference This contains a pointer to the public specification of the 2424 OAuth token type abbreviation, if one exists. 2425 Original Specification This contains a pointer to the public 2426 specification of the OAuth token type, if one exists. 2428 8.7.1. Initial Registry Contents 2430 o Name: "Bearer" 2431 o Value: 1 2432 o Reference: [this document] 2433 o Original Specification: [RFC6749] 2435 o Name: "PoP" 2436 o Value: 2 2437 o Reference: [this document] 2438 o Original Specification: [this document] 2440 8.8. ACE Profile Registry 2442 This specification establishes the IANA "ACE Profile" registry. The 2443 registry has been created to use the "Expert Review" registration 2444 procedure [RFC8126]. It should be noted that, in addition to the 2445 expert review, some portions of the registry require a specification, 2446 potentially a Standards Track RFC, be supplied as well. 2448 The columns of this registry are: 2450 Name The name of the profile, to be used as value of the profile 2451 attribute. 2452 Description Text giving an overview of the profile and the context 2453 it is developed for. 2454 CBOR Value CBOR abbreviation for this profile name. Different 2455 ranges of values use different registration policies [RFC8126]. 2456 Integer values from -256 to 255 are designated as Standards 2457 Action. Integer values from -65536 to -257 and from 256 to 65535 2458 are designated as Specification Required. Integer values greater 2459 than 65535 are designated as "Expert Review". Integer values less 2460 than -65536 are marked as Private Use. 2461 Reference This contains a pointer to the public specification of the 2462 profile abbreviation, if one exists. 2464 This registry will be initially empty and will be populated by the 2465 registrations from the ACE framework profiles. 2467 8.9. OAuth Parameter Registration 2469 This specification registers the following parameter in the "OAuth 2470 Parameters" registry [IANA.OAuthParameters]: 2472 o Name: "ace_profile" 2473 o Parameter Usage Location: token response 2474 o Change Controller: IESG 2475 o Reference: Section 5.8.2 and Section 5.8.4.3 of [this document] 2477 8.10. OAuth Parameters CBOR Mappings Registry 2479 This specification establishes the IANA "OAuth Parameters CBOR 2480 Mappings" registry. The registry has been created to use the "Expert 2481 Review" registration procedure [RFC8126], except for the value range 2482 designated for private use. 2484 The columns of this registry are: 2486 Name The OAuth Parameter name, refers to the name in the OAuth 2487 parameter registry, e.g., "client_id". 2488 CBOR Key CBOR map key for this parameter. Integer values less than 2489 -65536 are marked as "Private Use", all other values use the 2490 registration policy "Expert Review" [RFC8126]. 2491 Value Type The allowable CBOR data types for values of this 2492 parameter. 2493 Reference This contains a pointer to the public specification of the 2494 OAuth parameter abbreviation, if one exists. 2496 This registry will be initially populated by the values in Figure 12. 2497 The Reference column for all of these entries will be this document. 2499 8.11. OAuth Introspection Response Parameter Registration 2501 This specification registers the following parameters in the OAuth 2502 Token Introspection Response registry 2503 [IANA.TokenIntrospectionResponse]. 2505 o Name: "ace_profile" 2506 o Description: The ACE profile used between client and RS. 2507 o Change Controller: IESG 2508 o Reference: Section 5.9.2 of [this document] 2510 o Name: "cnonce" 2511 o Description: "client-nonce". A nonce previously provided to the 2512 AS by the RS via the client. Used to verify token freshness when 2513 the RS cannot synchronize its clock with the AS. 2514 o Change Controller: IESG 2515 o Reference: Section 5.9.2 of [this document] 2517 o Name: "exi" 2518 o Description: "Expires in". Lifetime of the token in seconds from 2519 the time the RS first sees it. Used to implement a weaker from of 2520 token expiration for devices that cannot synchronize their 2521 internal clocks. 2522 o Change Controller: IESG 2523 o Reference: Section 5.9.2 of [this document] 2525 8.12. OAuth Token Introspection Response CBOR Mappings Registry 2527 This specification establishes the IANA "OAuth Token Introspection 2528 Response CBOR Mappings" registry. The registry has been created to 2529 use the "Expert Review" registration procedure [RFC8126], except for 2530 the value range designated for private use. 2532 The columns of this registry are: 2534 Name The OAuth Parameter name, refers to the name in the OAuth 2535 parameter registry, e.g., "client_id". 2536 CBOR Key CBOR map key for this parameter. Integer values less than 2537 -65536 are marked as "Private Use", all other values use the 2538 registration policy "Expert Review" [RFC8126]. 2539 Value Type The allowable CBOR data types for values of this 2540 parameter. 2541 Reference This contains a pointer to the public specification of the 2542 introspection response parameter abbreviation, if one exists. 2544 This registry will be initially populated by the values in Figure 16. 2545 The Reference column for all of these entries will be this document. 2547 Note that the mappings of parameters corresponding to claim names 2548 intentionally coincide with the CWT claim name mappings from 2549 [RFC8392]. 2551 8.13. JSON Web Token Claims 2553 This specification registers the following new claims in the JSON Web 2554 Token (JWT) registry of JSON Web Token Claims 2555 [IANA.JsonWebTokenClaims]: 2557 o Claim Name: "ace_profile" 2558 o Claim Description: The ACE profile a token is supposed to be used 2559 with. 2560 o Change Controller: IESG 2561 o Reference: Section 5.10 of [this document] 2562 o Claim Name: "cnonce" 2563 o Claim Description: "client-nonce". A nonce previously provided to 2564 the AS by the RS via the client. Used to verify token freshness 2565 when the RS cannot synchronize its clock with the AS. 2566 o Change Controller: IESG 2567 o Reference: Section 5.10 of [this document] 2569 o Claim Name: "exi" 2570 o Claim Description: "Expires in". Lifetime of the token in seconds 2571 from the time the RS first sees it. Used to implement a weaker 2572 from of token expiration for devices that cannot synchronize their 2573 internal clocks. 2574 o Change Controller: IESG 2575 o Reference: Section 5.10.3 of [this document] 2577 8.14. CBOR Web Token Claims 2579 This specification registers the following new claims in the "CBOR 2580 Web Token (CWT) Claims" registry [IANA.CborWebTokenClaims]. 2582 o Claim Name: "ace_profile" 2583 o Claim Description: The ACE profile a token is supposed to be used 2584 with. 2585 o JWT Claim Name: ace_profile 2586 o Claim Key: TBD (suggested: 38) 2587 o Claim Value Type(s): integer 2588 o Change Controller: IESG 2589 o Specification Document(s): Section 5.10 of [this document] 2591 o Claim Name: "cnonce" 2592 o Claim Description: The client-nonce sent to the AS by the RS via 2593 the client. 2594 o JWT Claim Name: cnonce 2595 o Claim Key: TBD (suggested: 39) 2596 o Claim Value Type(s): byte string 2597 o Change Controller: IESG 2598 o Specification Document(s): Section 5.10 of [this document] 2600 o Claim Name: "exi" 2601 o Claim Description: The expiration time of a token measured from 2602 when it was received at the RS in seconds. 2603 o JWT Claim Name: exi 2604 o Claim Key: TBD (suggested: 40) 2605 o Claim Value Type(s): integer 2606 o Change Controller: IESG 2607 o Specification Document(s): Section 5.10.3 of [this document] 2609 o Claim Name: "scope" 2610 o Claim Description: The scope of an access token as defined in 2611 [RFC6749]. 2612 o JWT Claim Name: scope 2613 o Claim Key: TBD (suggested: 9) 2614 o Claim Value Type(s): byte string or text string 2615 o Change Controller: IESG 2616 o Specification Document(s): Section 4.2 of [RFC8693] 2618 8.15. Media Type Registrations 2620 This specification registers the 'application/ace+cbor' media type 2621 for messages of the protocols defined in this document carrying 2622 parameters encoded in CBOR. This registration follows the procedures 2623 specified in [RFC6838]. 2625 Type name: application 2627 Subtype name: ace+cbor 2629 Required parameters: N/A 2631 Optional parameters: N/A 2633 Encoding considerations: Must be encoded as CBOR map containing the 2634 protocol parameters defined in [this document]. 2636 Security considerations: See Section 6 of [this document] 2638 Interoperability considerations: N/A 2640 Published specification: [this document] 2642 Applications that use this media type: The type is used by 2643 authorization servers, clients and resource servers that support the 2644 ACE framework with CBOR encoding as specified in [this document]. 2646 Fragment identifier considerations: N/A 2648 Additional information: N/A 2650 Person & email address to contact for further information: 2651 2653 Intended usage: COMMON 2655 Restrictions on usage: none 2657 Author: Ludwig Seitz 2658 Change controller: IESG 2660 8.16. CoAP Content-Format Registry 2662 This specification registers the following entry to the "CoAP 2663 Content-Formats" registry: 2665 Media Type: application/ace+cbor 2667 Encoding: - 2669 ID: TBD (suggested: 19) 2671 Reference: [this document] 2673 8.17. Expert Review Instructions 2675 All of the IANA registries established in this document are defined 2676 to use a registration policy of Expert Review. This section gives 2677 some general guidelines for what the experts should be looking for, 2678 but they are being designated as experts for a reason, so they should 2679 be given substantial latitude. 2681 Expert reviewers should take into consideration the following points: 2683 o Point squatting should be discouraged. Reviewers are encouraged 2684 to get sufficient information for registration requests to ensure 2685 that the usage is not going to duplicate one that is already 2686 registered, and that the point is likely to be used in 2687 deployments. The zones tagged as private use are intended for 2688 testing purposes and closed environments; code points in other 2689 ranges should not be assigned for testing. 2690 o Specifications are needed for the first-come, first-serve range if 2691 they are expected to be used outside of closed environments in an 2692 interoperable way. When specifications are not provided, the 2693 description provided needs to have sufficient information to 2694 identify what the point is being used for. 2695 o Experts should take into account the expected usage of fields when 2696 approving point assignment. The fact that there is a range for 2697 standards track documents does not mean that a standards track 2698 document cannot have points assigned outside of that range. The 2699 length of the encoded value should be weighed against how many 2700 code points of that length are left, the size of device it will be 2701 used on. 2702 o Since a high degree of overlap is expected between these 2703 registries and the contents of the OAuth parameters 2704 [IANA.OAuthParameters] registries, experts should require new 2705 registrations to maintain alignment with parameters from OAuth 2706 that have comparable functionality. Deviation from this alignment 2707 should only be allowed if there are functional differences, that 2708 are motivated by the use case and that cannot be easily or 2709 efficiently addressed by comparable OAuth parameters. 2711 9. Acknowledgments 2713 This document is a product of the ACE working group of the IETF. 2715 Thanks to Eve Maler for her contributions to the use of OAuth 2.0 and 2716 UMA in IoT scenarios, Robert Taylor for his discussion input, and 2717 Malisa Vucinic for his input on the predecessors of this proposal. 2719 Thanks to the authors of draft-ietf-oauth-pop-key-distribution, from 2720 where parts of the security considerations where copied. 2722 Thanks to Stefanie Gerdes, Olaf Bergmann, and Carsten Bormann for 2723 contributing their work on AS discovery from draft-gerdes-ace-dcaf- 2724 authorize (see Section 5.1) and the considerations on multiple access 2725 tokens. 2727 Thanks to Jim Schaad and Mike Jones for their comprehensive reviews. 2729 Thanks to Benjamin Kaduk for his input on various questions related 2730 to this work. 2732 Thanks to Cigdem Sengul for some very useful review comments. 2734 Thanks to Carsten Bormann for contributing the text for the CoRE 2735 Resource Type registry. 2737 Thanks to Roman Danyliw for suggesting the Appendix E (including its 2738 contents). 2740 Ludwig Seitz and Goeran Selander worked on this document as part of 2741 the CelticPlus project CyberWI, with funding from Vinnova. Ludwig 2742 Seitz was also received further funding for this work by Vinnova in 2743 the context of the CelticNext project Critisec. 2745 10. References 2747 10.1. Normative References 2749 [I-D.ietf-ace-oauth-params] 2750 Seitz, L., "Additional OAuth Parameters for Authorization 2751 in Constrained Environments (ACE)", draft-ietf-ace-oauth- 2752 params-14 (work in progress), March 2021. 2754 [IANA.CborWebTokenClaims] 2755 IANA, "CBOR Web Token (CWT) Claims", 2756 . 2759 [IANA.CoreParameters] 2760 IANA, "Constrained RESTful Environments (CoRE) 2761 Parameters", . 2764 [IANA.JsonWebTokenClaims] 2765 IANA, "JSON Web Token Claims", 2766 . 2768 [IANA.OAuthAccessTokenTypes] 2769 IANA, "OAuth Access Token Types", 2770 . 2773 [IANA.OAuthExtensionsErrorRegistry] 2774 IANA, "OAuth Extensions Error Registry", 2775 . 2778 [IANA.OAuthParameters] 2779 IANA, "OAuth Parameters", 2780 . 2783 [IANA.TokenIntrospectionResponse] 2784 IANA, "OAuth Token Introspection Response", 2785 . 2788 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2789 Requirement Levels", BCP 14, RFC 2119, 2790 DOI 10.17487/RFC2119, March 1997, 2791 . 2793 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2794 Resource Identifier (URI): Generic Syntax", STD 66, 2795 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2796 . 2798 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 2799 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 2800 January 2012, . 2802 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 2803 RFC 6749, DOI 10.17487/RFC6749, October 2012, 2804 . 2806 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 2807 Framework: Bearer Token Usage", RFC 6750, 2808 DOI 10.17487/RFC6750, October 2012, 2809 . 2811 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 2812 Specifications and Registration Procedures", BCP 13, 2813 RFC 6838, DOI 10.17487/RFC6838, January 2013, 2814 . 2816 [RFC6920] Farrell, S., Kutscher, D., Dannewitz, C., Ohlman, B., 2817 Keranen, A., and P. Hallam-Baker, "Naming Things with 2818 Hashes", RFC 6920, DOI 10.17487/RFC6920, April 2013, 2819 . 2821 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2822 Application Protocol (CoAP)", RFC 7252, 2823 DOI 10.17487/RFC7252, June 2014, 2824 . 2826 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 2827 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 2828 . 2830 [RFC7662] Richer, J., Ed., "OAuth 2.0 Token Introspection", 2831 RFC 7662, DOI 10.17487/RFC7662, October 2015, 2832 . 2834 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2835 Writing an IANA Considerations Section in RFCs", BCP 26, 2836 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2837 . 2839 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 2840 RFC 8152, DOI 10.17487/RFC8152, July 2017, 2841 . 2843 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2844 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2845 May 2017, . 2847 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2848 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2849 May 2018, . 2851 [RFC8693] Jones, M., Nadalin, A., Campbell, B., Ed., Bradley, J., 2852 and C. Mortimore, "OAuth 2.0 Token Exchange", RFC 8693, 2853 DOI 10.17487/RFC8693, January 2020, 2854 . 2856 [RFC8747] Jones, M., Seitz, L., Selander, G., Erdtman, S., and H. 2857 Tschofenig, "Proof-of-Possession Key Semantics for CBOR 2858 Web Tokens (CWTs)", RFC 8747, DOI 10.17487/RFC8747, March 2859 2020, . 2861 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 2862 Representation (CBOR)", STD 94, RFC 8949, 2863 DOI 10.17487/RFC8949, December 2020, 2864 . 2866 10.2. Informative References 2868 [BLE] Bluetooth SIG, "Bluetooth Core Specification v5.1", 2869 Section 4.4, January 2019, 2870 . 2873 [I-D.erdtman-ace-rpcc] 2874 Seitz, L. and S. Erdtman, "Raw-Public-Key and Pre-Shared- 2875 Key as OAuth client credentials", draft-erdtman-ace- 2876 rpcc-02 (work in progress), October 2017. 2878 [I-D.ietf-ace-dtls-authorize] 2879 Gerdes, S., Bergmann, O., Bormann, C., Selander, G., and 2880 L. Seitz, "Datagram Transport Layer Security (DTLS) 2881 Profile for Authentication and Authorization for 2882 Constrained Environments (ACE)", draft-ietf-ace-dtls- 2883 authorize-16 (work in progress), March 2021. 2885 [I-D.ietf-ace-oscore-profile] 2886 Palombini, F., Seitz, L., Selander, G., and M. Gunnarsson, 2887 "OSCORE Profile of the Authentication and Authorization 2888 for Constrained Environments Framework", draft-ietf-ace- 2889 oscore-profile-18 (work in progress), April 2021. 2891 [I-D.ietf-quic-transport] 2892 Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 2893 and Secure Transport", draft-ietf-quic-transport-34 (work 2894 in progress), January 2021. 2896 [I-D.ietf-tls-dtls13] 2897 Rescorla, E., Tschofenig, H., and N. Modadugu, "The 2898 Datagram Transport Layer Security (DTLS) Protocol Version 2899 1.3", draft-ietf-tls-dtls13-43 (work in progress), April 2900 2021. 2902 [Margi10impact] 2903 Margi, C., de Oliveira, B., de Sousa, G., Simplicio Jr, 2904 M., Barreto, P., Carvalho, T., Naeslund, M., and R. Gold, 2905 "Impact of Operating Systems on Wireless Sensor Networks 2906 (Security) Applications and Testbeds", Proceedings of 2907 the 19th International Conference on Computer 2908 Communications and Networks (ICCCN), August 2010. 2910 [MQTT5.0] Banks, A., Briggs, E., Borgendale, K., and R. Gupta, "MQTT 2911 Version 5.0", OASIS Standard, March 2019, 2912 . 2915 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 2916 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 2917 . 2919 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2920 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2921 . 2923 [RFC6819] Lodderstedt, T., Ed., McGloin, M., and P. Hunt, "OAuth 2.0 2924 Threat Model and Security Considerations", RFC 6819, 2925 DOI 10.17487/RFC6819, January 2013, 2926 . 2928 [RFC7009] Lodderstedt, T., Ed., Dronia, S., and M. Scurtescu, "OAuth 2929 2.0 Token Revocation", RFC 7009, DOI 10.17487/RFC7009, 2930 August 2013, . 2932 [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for 2933 Constrained-Node Networks", RFC 7228, 2934 DOI 10.17487/RFC7228, May 2014, 2935 . 2937 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2938 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 2939 DOI 10.17487/RFC7231, June 2014, 2940 . 2942 [RFC7521] Campbell, B., Mortimore, C., Jones, M., and Y. Goland, 2943 "Assertion Framework for OAuth 2.0 Client Authentication 2944 and Authorization Grants", RFC 7521, DOI 10.17487/RFC7521, 2945 May 2015, . 2947 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 2948 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 2949 DOI 10.17487/RFC7540, May 2015, 2950 . 2952 [RFC7591] Richer, J., Ed., Jones, M., Bradley, J., Machulak, M., and 2953 P. Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", 2954 RFC 7591, DOI 10.17487/RFC7591, July 2015, 2955 . 2957 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2958 Application Protocol (CoAP)", RFC 7641, 2959 DOI 10.17487/RFC7641, September 2015, 2960 . 2962 [RFC7744] Seitz, L., Ed., Gerdes, S., Ed., Selander, G., Mani, M., 2963 and S. Kumar, "Use Cases for Authentication and 2964 Authorization in Constrained Environments", RFC 7744, 2965 DOI 10.17487/RFC7744, January 2016, 2966 . 2968 [RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in 2969 the Constrained Application Protocol (CoAP)", RFC 7959, 2970 DOI 10.17487/RFC7959, August 2016, 2971 . 2973 [RFC8252] Denniss, W. and J. Bradley, "OAuth 2.0 for Native Apps", 2974 BCP 212, RFC 8252, DOI 10.17487/RFC8252, October 2017, 2975 . 2977 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 2978 Interchange Format", STD 90, RFC 8259, 2979 DOI 10.17487/RFC8259, December 2017, 2980 . 2982 [RFC8414] Jones, M., Sakimura, N., and J. Bradley, "OAuth 2.0 2983 Authorization Server Metadata", RFC 8414, 2984 DOI 10.17487/RFC8414, June 2018, 2985 . 2987 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 2988 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 2989 . 2991 [RFC8516] Keranen, A., ""Too Many Requests" Response Code for the 2992 Constrained Application Protocol", RFC 8516, 2993 DOI 10.17487/RFC8516, January 2019, 2994 . 2996 [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 2997 "Object Security for Constrained RESTful Environments 2998 (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, 2999 . 3001 [RFC8628] Denniss, W., Bradley, J., Jones, M., and H. Tschofenig, 3002 "OAuth 2.0 Device Authorization Grant", RFC 8628, 3003 DOI 10.17487/RFC8628, August 2019, 3004 . 3006 Appendix A. Design Justification 3008 This section provides further insight into the design decisions of 3009 the solution documented in this document. Section 3 lists several 3010 building blocks and briefly summarizes their importance. The 3011 justification for offering some of those building blocks, as opposed 3012 to using OAuth 2.0 as is, is given below. 3014 Common IoT constraints are: 3016 Low Power Radio: 3018 Many IoT devices are equipped with a small battery which needs to 3019 last for a long time. For many constrained wireless devices, the 3020 highest energy cost is associated to transmitting or receiving 3021 messages (roughly by a factor of 10 compared to AES) 3022 [Margi10impact]. It is therefore important to keep the total 3023 communication overhead low, including minimizing the number and 3024 size of messages sent and received, which has an impact of choice 3025 on the message format and protocol. By using CoAP over UDP and 3026 CBOR encoded messages, some of these aspects are addressed. 3027 Security protocols contribute to the communication overhead and 3028 can, in some cases, be optimized. For example, authentication and 3029 key establishment may, in certain cases where security 3030 requirements allow, be replaced by provisioning of security 3031 context by a trusted third party, using transport or application- 3032 layer security. 3034 Low CPU Speed: 3036 Some IoT devices are equipped with processors that are 3037 significantly slower than those found in most current devices on 3038 the Internet. This typically has implications on what timely 3039 cryptographic operations a device is capable of performing, which 3040 in turn impacts, e.g., protocol latency. Symmetric key 3041 cryptography may be used instead of the computationally more 3042 expensive public key cryptography where the security requirements 3043 so allow, but this may also require support for trusted-third- 3044 party-assisted secret key establishment using transport- or 3045 application-layer security. 3046 Small Amount of Memory: 3048 Microcontrollers embedded in IoT devices are often equipped with 3049 only a small amount of RAM and flash memory, which places 3050 limitations on what kind of processing can be performed and how 3051 much code can be put on those devices. To reduce code size, fewer 3052 and smaller protocol implementations can be put on the firmware of 3053 such a device. In this case, CoAP may be used instead of HTTP, 3054 symmetric-key cryptography instead of public-key cryptography, and 3055 CBOR instead of JSON. An authentication and key establishment 3056 protocol, e.g., the DTLS handshake, in comparison with assisted 3057 key establishment, also has an impact on memory and code 3058 footprints. 3060 User Interface Limitations: 3062 Protecting access to resources is both an important security as 3063 well as privacy feature. End users and enterprise customers may 3064 not want to give access to the data collected by their IoT device 3065 or to functions it may offer to third parties. Since the 3066 classical approach of requesting permissions from end users via a 3067 rich user interface does not work in many IoT deployment 3068 scenarios, these functions need to be delegated to user-controlled 3069 devices that are better suitable for such tasks, such as smart 3070 phones and tablets. 3072 Communication Constraints: 3074 In certain constrained settings an IoT device may not be able to 3075 communicate with a given device at all times. Devices may be 3076 sleeping, or just disconnected from the Internet because of 3077 general lack of connectivity in the area, for cost reasons, or for 3078 security reasons, e.g., to avoid an entry point for Denial-of- 3079 Service attacks. 3081 The communication interactions this framework builds upon (as 3082 shown graphically in Figure 1) may be accomplished using a variety 3083 of different protocols, and not all parts of the message flow are 3084 used in all applications due to the communication constraints. 3085 Deployments making use of CoAP are expected, but this framework is 3086 not limited to them. Other protocols such as HTTP, or even 3087 protocols such as Bluetooth Smart communication that do not 3088 necessarily use IP, could also be used. The latter raises the 3089 need for application-layer security over the various interfaces. 3091 In the light of these constraints we have made the following design 3092 decisions: 3094 CBOR, COSE, CWT: 3096 When using this framework, it is RECOMMENDED to use CBOR [RFC8949] 3097 as data format. Where CBOR data needs to be protected, the use of 3098 COSE [RFC8152] is RECOMMENDED. Furthermore, where self-contained 3099 tokens are needed, it is RECOMMENDED to use of CWT [RFC8392]. 3100 These measures aim at reducing the size of messages sent over the 3101 wire, the RAM size of data objects that need to be kept in memory 3102 and the size of libraries that devices need to support. 3104 CoAP: 3106 When using this framework, it is RECOMMENDED to use of CoAP 3107 [RFC7252] instead of HTTP. This does not preclude the use of 3108 other protocols specifically aimed at constrained devices, like, 3109 e.g., Bluetooth Low Energy (see Section 3.2). This aims again at 3110 reducing the size of messages sent over the wire, the RAM size of 3111 data objects that need to be kept in memory and the size of 3112 libraries that devices need to support. 3114 Access Information: 3116 This framework defines the name "Access Information" for data 3117 concerning the RS that the AS returns to the client in an access 3118 token response (see Section 5.8.2). This aims at enabling 3119 scenarios where a powerful client, supporting multiple profiles, 3120 needs to interact with an RS for which it does not know the 3121 supported profiles and the raw public key. 3123 Proof-of-Possession: 3125 This framework makes use of proof-of-possession tokens, using the 3126 "cnf" claim [RFC8747]. A request parameter "cnf" and a Response 3127 parameter "cnf", both having a value space semantically and 3128 syntactically identical to the "cnf" claim, are defined for the 3129 token endpoint, to allow requesting and stating confirmation keys. 3130 This aims at making token theft harder. Token theft is 3131 specifically relevant in constrained use cases, as communication 3132 often passes through middle-boxes, which could be able to steal 3133 bearer tokens and use them to gain unauthorized access. 3135 Authz-Info endpoint: 3137 This framework introduces a new way of providing access tokens to 3138 an RS by exposing a authz-info endpoint, to which access tokens 3139 can be POSTed. This aims at reducing the size of the request 3140 message and the code complexity at the RS. The size of the 3141 request message is problematic, since many constrained protocols 3142 have severe message size limitations at the physical layer (e.g., 3143 in the order of 100 bytes). This means that larger packets get 3144 fragmented, which in turn combines badly with the high rate of 3145 packet loss, and the need to retransmit the whole message if one 3146 packet gets lost. Thus separating sending of the request and 3147 sending of the access tokens helps to reduce fragmentation. 3149 Client Credentials Grant: 3151 In this framework the use of the client credentials grant is 3152 RECOMMENDED for machine-to-machine communication use cases, where 3153 manual intervention of the resource owner to produce a grant token 3154 is not feasible. The intention is that the resource owner would 3155 instead pre-arrange authorization with the AS, based on the 3156 client's own credentials. The client can then (without manual 3157 intervention) obtain access tokens from the AS. 3159 Introspection: 3161 In this framework the use of access token introspection is 3162 RECOMMENDED in cases where the client is constrained in a way that 3163 it can not easily obtain new access tokens (i.e. it has 3164 connectivity issues that prevent it from communicating with the 3165 AS). In that case it is RECOMMENDED to use a long-term token, 3166 that could be a simple reference. The RS is assumed to be able to 3167 communicate with the AS, and can therefore perform introspection, 3168 in order to learn the claims associated with the token reference. 3169 The advantage of such an approach is that the resource owner can 3170 change the claims associated to the token reference without having 3171 to be in contact with the client, thus granting or revoking access 3172 rights. 3174 Appendix B. Roles and Responsibilities 3176 Resource Owner 3178 * Make sure that the RS is registered at the AS. This includes 3179 making known to the AS which profiles, token_type, scopes, and 3180 key types (symmetric/asymmetric) the RS supports. Also making 3181 it known to the AS which audience(s) the RS identifies itself 3182 with. 3183 * Make sure that clients can discover the AS that is in charge of 3184 the RS. 3185 * If the client-credentials grant is used, make sure that the AS 3186 has the necessary, up-to-date, access control policies for the 3187 RS. 3189 Requesting Party 3191 * Make sure that the client is provisioned the necessary 3192 credentials to authenticate to the AS. 3193 * Make sure that the client is configured to follow the security 3194 requirements of the Requesting Party when issuing requests 3195 (e.g., minimum communication security requirements, trust 3196 anchors). 3197 * Register the client at the AS. This includes making known to 3198 the AS which profiles, token_types, and key types (symmetric/ 3199 asymmetric) the client. 3201 Authorization Server 3203 * Register the RS and manage corresponding security contexts. 3204 * Register clients and authentication credentials. 3205 * Allow Resource Owners to configure and update access control 3206 policies related to their registered RSs. 3207 * Expose the token endpoint to allow clients to request tokens. 3208 * Authenticate clients that wish to request a token. 3209 * Process a token request using the authorization policies 3210 configured for the RS. 3211 * Optionally: Expose the introspection endpoint that allows RS's 3212 to submit token introspection requests. 3213 * If providing an introspection endpoint: Authenticate RSs that 3214 wish to get an introspection response. 3215 * If providing an introspection endpoint: Process token 3216 introspection requests. 3217 * Optionally: Handle token revocation. 3218 * Optionally: Provide discovery metadata. See [RFC8414] 3219 * Optionally: Handle refresh tokens. 3221 Client 3223 * Discover the AS in charge of the RS that is to be targeted with 3224 a request. 3225 * Submit the token request (see step (A) of Figure 1). 3227 + Authenticate to the AS. 3229 + Optionally (if not pre-configured): Specify which RS, which 3230 resource(s), and which action(s) the request(s) will target. 3231 + If raw public keys (rpk) or certificates are used, make sure 3232 the AS has the right rpk or certificate for this client. 3233 * Process the access token and Access Information (see step (B) 3234 of Figure 1). 3236 + Check that the Access Information provides the necessary 3237 security parameters (e.g., PoP key, information on 3238 communication security protocols supported by the RS). 3239 + Safely store the proof-of-possession key. 3240 + If provided by the AS: Safely store the refresh token. 3241 * Send the token and request to the RS (see step (C) of 3242 Figure 1). 3244 + Authenticate towards the RS (this could coincide with the 3245 proof of possession process). 3246 + Transmit the token as specified by the AS (default is to the 3247 authz-info endpoint, alternative options are specified by 3248 profiles). 3249 + Perform the proof-of-possession procedure as specified by 3250 the profile in use (this may already have been taken care of 3251 through the authentication procedure). 3252 * Process the RS response (see step (F) of Figure 1) of the RS. 3254 Resource Server 3256 * Expose a way to submit access tokens. By default this is the 3257 authz-info endpoint. 3258 * Process an access token. 3260 + Verify the token is from a recognized AS. 3261 + Check the token's integrity. 3262 + Verify that the token applies to this RS. 3263 + Check that the token has not expired (if the token provides 3264 expiration information). 3265 + Store the token so that it can be retrieved in the context 3266 of a matching request. 3268 Note: The order proposed here is not normative, any process 3269 that arrives at an equivalent result can be used. A noteworthy 3270 consideration is whether one can use cheap operations early on 3271 to quickly discard non-applicable or invalid tokens, before 3272 performing expensive cryptographic operations (e.g. doing an 3273 expiration check before verifying a signature). 3275 * Process a request. 3277 + Set up communication security with the client. 3278 + Authenticate the client. 3279 + Match the client against existing tokens. 3280 + Check that tokens belonging to the client actually authorize 3281 the requested action. 3282 + Optionally: Check that the matching tokens are still valid, 3283 using introspection (if this is possible.) 3284 * Send a response following the agreed upon communication 3285 security mechanism(s). 3286 * Safely store credentials such as raw public keys for 3287 authentication or proof-of-possession keys linked to access 3288 tokens. 3290 Appendix C. Requirements on Profiles 3292 This section lists the requirements on profiles of this framework, 3293 for the convenience of profile designers. 3295 o Optionally define new methods for the client to discover the 3296 necessary permissions and AS for accessing a resource, different 3297 from the one proposed in Section 5.1. Section 4 3298 o Optionally specify new grant types. Section 5.4 3299 o Optionally define the use of client certificates as client 3300 credential type. Section 5.5 3301 o Specify the communication protocol the client and RS the must use 3302 (e.g., CoAP). Section 5 and Section 5.8.4.3 3303 o Specify the security protocol the client and RS must use to 3304 protect their communication (e.g., OSCORE or DTLS). This must 3305 provide encryption, integrity and replay protection. 3306 Section 5.8.4.3 3307 o Specify how the client and the RS mutually authenticate. 3308 Section 4 3309 o Specify the proof-of-possession protocol(s) and how to select one, 3310 if several are available. Also specify which key types (e.g., 3311 symmetric/asymmetric) are supported by a specific proof-of- 3312 possession protocol. Section 5.8.4.2 3313 o Specify a unique ace_profile identifier. Section 5.8.4.3 3314 o If introspection is supported: Specify the communication and 3315 security protocol for introspection. Section 5.9 3316 o Specify the communication and security protocol for interactions 3317 between client and AS. This must provide encryption, integrity 3318 protection, replay protection and a binding between requests and 3319 responses. Section 5 and Section 5.8 3320 o Specify how/if the authz-info endpoint is protected, including how 3321 error responses are protected. Section 5.10.1 3322 o Optionally define other methods of token transport than the authz- 3323 info endpoint. Section 5.10.1 3325 Appendix D. Assumptions on AS Knowledge about C and RS 3327 This section lists the assumptions on what an AS should know about a 3328 client and an RS in order to be able to respond to requests to the 3329 token and introspection endpoints. How this information is 3330 established is out of scope for this document. 3332 o The identifier of the client or RS. 3333 o The profiles that the client or RS supports. 3334 o The scopes that the RS supports. 3335 o The audiences that the RS identifies with. 3336 o The key types (e.g., pre-shared symmetric key, raw public key, key 3337 length, other key parameters) that the client or RS supports. 3338 o The types of access tokens the RS supports (e.g., CWT). 3339 o If the RS supports CWTs, the COSE parameters for the crypto 3340 wrapper (e.g., algorithm, key-wrap algorithm, key-length) that the 3341 RS supports. 3342 o The expiration time for access tokens issued to this RS (unless 3343 the RS accepts a default time chosen by the AS). 3344 o The symmetric key shared between client and AS (if any). 3345 o The symmetric key shared between RS and AS (if any). 3346 o The raw public key of the client or RS (if any). 3347 o Whether the RS has synchronized time (and thus is able to use the 3348 'exp' claim) or not. 3350 Appendix E. Differences to OAuth 2.0 3352 This document adapts OAuth 2.0 to be suitable for constrained 3353 environments. This sections lists the main differences from the 3354 normative requirements of OAuth 2.0. 3356 o Use of TLS -- OAuth 2.0 requires the use of TLS both to protect 3357 the communication between AS and client when requesting an access 3358 token; between client and RS when accessing a resource and between 3359 AS and RS if introspection is used. This framework requires 3360 similar security properties, but does not require that they be 3361 realized with TLS. See Section 5. 3362 o Cardinality of "grant_type" parameter -- In client-to-AS requests 3363 using OAuth 2.0, the "grant_type" parameter is required (per 3364 [RFC6749]). In this framework, this parameter is optional. See 3365 Section 5.8.1. 3366 o Encoding of "scope" parameter -- In client-to-AS requests using 3367 OAuth 2.0, the "scope" parameter is string encoded (per 3368 [RFC6749]). In this framework, this parameter may also be encoded 3369 as a byte string. See Section 5.8.1. 3370 o Cardinality of "token_type" parameter -- in AS-to-client responses 3371 using OAuth 2.0, the token_type parameter is required (per 3373 [RFC6749]). In this framework, this parameter is optional. See 3374 Section 5.8.2. 3375 o Access token retention -- in OAuth 2.0, the access token is sent 3376 with each request to the RS. In this framework, the RS must be 3377 able to store these tokens for later use. See Section 5.10.1. 3379 Appendix F. Deployment Examples 3381 There is a large variety of IoT deployments, as is indicated in 3382 Appendix A, and this section highlights a few common variants. This 3383 section is not normative but illustrates how the framework can be 3384 applied. 3386 For each of the deployment variants, there are a number of possible 3387 security setups between clients, resource servers and authorization 3388 servers. The main focus in the following subsections is on how 3389 authorization of a client request for a resource hosted by an RS is 3390 performed. This requires the security of the requests and responses 3391 between the clients and the RS to be considered. 3393 Note: CBOR diagnostic notation is used for examples of requests and 3394 responses. 3396 F.1. Local Token Validation 3398 In this scenario, the case where the resource server is offline is 3399 considered, i.e., it is not connected to the AS at the time of the 3400 access request. This access procedure involves steps A, B, C, and F 3401 of Figure 1. 3403 Since the resource server must be able to verify the access token 3404 locally, self-contained access tokens must be used. 3406 This example shows the interactions between a client, the 3407 authorization server and a temperature sensor acting as a resource 3408 server. Message exchanges A and B are shown in Figure 17. 3410 A: The client first generates a public-private key pair used for 3411 communication security with the RS. 3412 The client sends a CoAP POST request to the token endpoint at the 3413 AS. The security of this request can be transport or application 3414 layer. It is up the communication security profile to define. In 3415 the example it is assumed that both client and AS have performed 3416 mutual authentication e.g. via DTLS. The request contains the 3417 public key of the client and the Audience parameter set to 3418 "tempSensorInLivingRoom", a value that the temperature sensor 3419 identifies itself with. The AS evaluates the request and 3420 authorizes the client to access the resource. 3422 B: The AS responds with a 2.05 Content response containing the 3423 Access Information, including the access token. The PoP access 3424 token contains the public key of the client, and the Access 3425 Information contains the public key of the RS. For communication 3426 security this example uses DTLS RawPublicKey between the client 3427 and the RS. The issued token will have a short validity time, 3428 i.e., "exp" close to "iat", in order to mitigate attacks using 3429 stolen client credentials. The token includes the claim such as 3430 "scope" with the authorized access that an owner of the 3431 temperature device can enjoy. In this example, the "scope" claim, 3432 issued by the AS, informs the RS that the owner of the token, that 3433 can prove the possession of a key is authorized to make a GET 3434 request against the /temperature resource and a POST request on 3435 the /firmware resource. Note that the syntax and semantics of the 3436 scope claim are application specific. 3437 Note: In this example it is assumed that the client knows what 3438 resource it wants to access, and is therefore able to request 3439 specific audience and scope claims for the access token. 3441 Authorization 3442 Client Server 3443 | | 3444 |<=======>| DTLS Connection Establishment 3445 | | and mutual authentication 3446 | | 3447 A: +-------->| Header: POST (Code=0.02) 3448 | POST | Uri-Path:"token" 3449 | | Content-Format: application/ace+cbor 3450 | | Payload: 3451 | | 3452 B: |<--------+ Header: 2.05 Content 3453 | 2.05 | Content-Format: application/ace+cbor 3454 | | Payload: 3455 | | 3457 Figure 17: Token Request and Response Using Client Credentials. 3459 The information contained in the Request-Payload and the Response- 3460 Payload is shown in Figure 18 Note that the parameter "rs_cnf" from 3461 [I-D.ietf-ace-oauth-params] is used to inform the client about the 3462 resource server's public key. 3464 Request-Payload : 3465 { 3466 "audience" : "tempSensorInLivingRoom", 3467 "client_id" : "myclient", 3468 "req_cnf" : { 3469 "COSE_Key" : { 3470 "kid" : b64'1Bg8vub9tLe1gHMzV76e8', 3471 "kty" : "EC", 3472 "crv" : "P-256", 3473 "x" : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU', 3474 "y" : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0' 3475 } 3476 } 3477 } 3479 Response-Payload : 3480 { 3481 "access_token" : b64'0INDoQEKoQVNKkXfb7xaWqMTf6 ...', 3482 "rs_cnf" : { 3483 "COSE_Key" : { 3484 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk', 3485 "kty" : "EC", 3486 "crv" : "P-256", 3487 "x" : b64'MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4', 3488 "y" : b64'4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM' 3489 } 3490 } 3491 } 3493 Figure 18: Request and Response Payload Details. 3495 The content of the access token is shown in Figure 19. 3497 { 3498 "aud" : "tempSensorInLivingRoom", 3499 "iat" : "1563451500", 3500 "exp" : "1563453000", 3501 "scope" : "temperature_g firmware_p", 3502 "cnf" : { 3503 "COSE_Key" : { 3504 "kid" : b64'1Bg8vub9tLe1gHMzV76e8', 3505 "kty" : "EC", 3506 "crv" : "P-256", 3507 "x" : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU', 3508 "y" : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0' 3509 } 3510 } 3511 } 3513 Figure 19: Access Token including Public Key of the client. 3515 Messages C and F are shown in Figure 20 - Figure 21. 3517 C: The client then sends the PoP access token to the authz-info 3518 endpoint at the RS. This is a plain CoAP POST request, i.e., no 3519 transport or application-layer security is used between client and 3520 RS since the token is integrity protected between the AS and RS. 3521 The RS verifies that the PoP access token was created by a known 3522 and trusted AS, that it applies to this RS, and that it is valid. 3523 The RS caches the security context together with authorization 3524 information about this client contained in the PoP access token. 3526 Resource 3527 Client Server 3528 | | 3529 C: +-------->| Header: POST (Code=0.02) 3530 | POST | Uri-Path:"authz-info" 3531 | | Payload: 0INDoQEKoQVN ... 3532 | | 3533 |<--------+ Header: 2.04 Changed 3534 | 2.04 | 3535 | | 3537 Figure 20: Access Token provisioning to RS 3538 The client and the RS runs the DTLS handshake using the raw public 3539 keys established in step B and C. 3540 The client sends a CoAP GET request to /temperature on RS over 3541 DTLS. The RS verifies that the request is authorized, based on 3542 previously established security context. 3544 F: The RS responds over the same DTLS channel with a CoAP 2.05 3545 Content response, containing a resource representation as payload. 3547 Resource 3548 Client Server 3549 | | 3550 |<=======>| DTLS Connection Establishment 3551 | | using Raw Public Keys 3552 | | 3553 +-------->| Header: GET (Code=0.01) 3554 | GET | Uri-Path: "temperature" 3555 | | 3556 | | 3557 | | 3558 F: |<--------+ Header: 2.05 Content 3559 | 2.05 | Payload: 3560 | | 3562 Figure 21: Resource Request and Response protected by DTLS. 3564 F.2. Introspection Aided Token Validation 3566 In this deployment scenario it is assumed that a client is not able 3567 to access the AS at the time of the access request, whereas the RS is 3568 assumed to be connected to the back-end infrastructure. Thus the RS 3569 can make use of token introspection. This access procedure involves 3570 steps A-F of Figure 1, but assumes steps A and B have been carried 3571 out during a phase when the client had connectivity to AS. 3573 Since the client is assumed to be offline, at least for a certain 3574 period of time, a pre-provisioned access token has to be long-lived. 3575 Since the client is constrained, the token will not be self contained 3576 (i.e. not a CWT) but instead just a reference. The resource server 3577 uses its connectivity to learn about the claims associated to the 3578 access token by using introspection, which is shown in the example 3579 below. 3581 In the example interactions between an offline client (key fob), an 3582 RS (online lock), and an AS is shown. It is assumed that there is a 3583 provisioning step where the client has access to the AS. This 3584 corresponds to message exchanges A and B which are shown in 3585 Figure 22. 3587 Authorization consent from the resource owner can be pre-configured, 3588 but it can also be provided via an interactive flow with the resource 3589 owner. An example of this for the key fob case could be that the 3590 resource owner has a connected car, he buys a generic key that he 3591 wants to use with the car. To authorize the key fob he connects it 3592 to his computer that then provides the UI for the device. After that 3593 OAuth 2.0 implicit flow can used to authorize the key for his car at 3594 the car manufacturers AS. 3596 Note: In this example the client does not know the exact door it will 3597 be used to access since the token request is not send at the time of 3598 access. So the scope and audience parameters are set quite wide to 3599 start with, while tailored values narrowing down the claims to the 3600 specific RS being accessed can be provided to that RS during an 3601 introspection step. 3603 A: The client sends a CoAP POST request to the token endpoint at 3604 AS. The request contains the Audience parameter set to "PACS1337" 3605 (PACS, Physical Access System), a value the that identifies the 3606 physical access control system to which the individual doors are 3607 connected. The AS generates an access token as an opaque string, 3608 which it can match to the specific client and the targeted 3609 audience. It furthermore generates a symmetric proof-of- 3610 possession key. The communication security and authentication 3611 between client and AS is assumed to have been provided at 3612 transport layer (e.g. via DTLS) using a pre-shared security 3613 context (psk, rpk or certificate). 3614 B: The AS responds with a CoAP 2.05 Content response, containing 3615 as payload the Access Information, including the access token and 3616 the symmetric proof-of-possession key. Communication security 3617 between C and RS will be DTLS and PreSharedKey. The PoP key is 3618 used as the PreSharedKey. 3620 Note: In this example we are using a symmetric key for a multi-RS 3621 audience, which is not recommended normally (see Section 6.9). 3622 However in this case the risk is deemed to be acceptable, since all 3623 the doors are part of the same physical access control system, and 3624 therefore the risk of a malicious RS impersonating the client towards 3625 another RS is low. 3627 Authorization 3628 Client Server 3629 | | 3630 |<=======>| DTLS Connection Establishment 3631 | | and mutual authentication 3632 | | 3633 A: +-------->| Header: POST (Code=0.02) 3634 | POST | Uri-Path:"token" 3635 | | Content-Format: application/ace+cbor 3636 | | Payload: 3637 | | 3638 B: |<--------+ Header: 2.05 Content 3639 | | Content-Format: application/ace+cbor 3640 | 2.05 | Payload: 3641 | | 3643 Figure 22: Token Request and Response using Client Credentials. 3645 The information contained in the Request-Payload and the Response- 3646 Payload is shown in Figure 23. 3648 Request-Payload: 3649 { 3650 "client_id" : "keyfob", 3651 "audience" : "PACS1337" 3652 } 3654 Response-Payload: 3655 { 3656 "access_token" : b64'VGVzdCB0b2tlbg==', 3657 "cnf" : { 3658 "COSE_Key" : { 3659 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk', 3660 "kty" : "oct", 3661 "alg" : "HS256", 3662 "k": b64'ZoRSOrFzN_FzUA5XKMYoVHyzff5oRJxl-IXRtztJ6uE' 3663 } 3664 } 3665 } 3667 Figure 23: Request and Response Payload for C offline 3669 The access token in this case is just an opaque byte string 3670 referencing the authorization information at the AS. 3672 C: Next, the client POSTs the access token to the authz-info 3673 endpoint in the RS. This is a plain CoAP request, i.e., no DTLS 3674 between client and RS. Since the token is an opaque string, the 3675 RS cannot verify it on its own, and thus defers to respond the 3676 client with a status code until after step E. 3677 D: The RS sends the token to the introspection endpoint on the AS 3678 using a CoAP POST request. In this example RS and AS are assumed 3679 to have performed mutual authentication using a pre shared 3680 security context (psk, rpk or certificate) with the RS acting as 3681 DTLS client. 3682 E: The AS provides the introspection response (2.05 Content) 3683 containing parameters about the token. This includes the 3684 confirmation key (cnf) parameter that allows the RS to verify the 3685 client's proof of possession in step F. Note that our example in 3686 Figure 25 assumes a pre-established key (e.g. one used by the 3687 client and the RS for a previous token) that is now only 3688 referenced by its key-identifier 'kid'. 3689 After receiving message E, the RS responds to the client's POST in 3690 step C with the CoAP response code 2.01 (Created). 3692 Resource 3693 Client Server 3694 | | 3695 C: +-------->| Header: POST (T=CON, Code=0.02) 3696 | POST | Uri-Path:"authz-info" 3697 | | Payload: b64'VGVzdCB0b2tlbg==' 3698 | | 3699 | | Authorization 3700 | | Server 3701 | | | 3702 | D: +--------->| Header: POST (Code=0.02) 3703 | | POST | Uri-Path: "introspect" 3704 | | | Content-Format: "application/ace+cbor" 3705 | | | Payload: 3706 | | | 3707 | E: |<---------+ Header: 2.05 Content 3708 | | 2.05 | Content-Format: "application/ace+cbor" 3709 | | | Payload: 3710 | | | 3711 | | 3712 |<--------+ Header: 2.01 Created 3713 | 2.01 | 3714 | | 3716 Figure 24: Token Introspection for C offline 3717 The information contained in the Request-Payload and the Response- 3718 Payload is shown in Figure 25. 3720 Request-Payload: 3721 { 3722 "token" : b64'VGVzdCB0b2tlbg==', 3723 "client_id" : "FrontDoor", 3724 } 3726 Response-Payload: 3727 { 3728 "active" : true, 3729 "aud" : "lockOfDoor4711", 3730 "scope" : "open, close", 3731 "iat" : 1563454000, 3732 "cnf" : { 3733 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk' 3734 } 3735 } 3737 Figure 25: Request and Response Payload for Introspection 3739 The client uses the symmetric PoP key to establish a DTLS 3740 PreSharedKey secure connection to the RS. The CoAP request PUT is 3741 sent to the uri-path /state on the RS, changing the state of the 3742 door to locked. 3743 F: The RS responds with a appropriate over the secure DTLS 3744 channel. 3746 Resource 3747 Client Server 3748 | | 3749 |<=======>| DTLS Connection Establishment 3750 | | using Pre Shared Key 3751 | | 3752 +-------->| Header: PUT (Code=0.03) 3753 | PUT | Uri-Path: "state" 3754 | | Payload: 3755 | | 3756 F: |<--------+ Header: 2.04 Changed 3757 | 2.04 | Payload: 3758 | | 3760 Figure 26: Resource request and response protected by OSCORE 3762 Authors' Addresses 3763 Ludwig Seitz 3764 Combitech 3765 Djaeknegatan 31 3766 Malmoe 211 35 3767 Sweden 3769 Email: ludwig.seitz@combitech.com 3771 Goeran Selander 3772 Ericsson 3773 Faroegatan 6 3774 Kista 164 80 3775 Sweden 3777 Email: goran.selander@ericsson.com 3779 Erik Wahlstroem 3780 Sweden 3782 Email: erik@wahlstromstekniska.se 3784 Samuel Erdtman 3785 Spotify AB 3786 Birger Jarlsgatan 61, 4tr 3787 Stockholm 113 56 3788 Sweden 3790 Email: erdtman@spotify.com 3792 Hannes Tschofenig 3793 Arm Ltd. 3794 Absam 6067 3795 Austria 3797 Email: Hannes.Tschofenig@arm.com