idnits 2.17.1 draft-ietf-ace-oauth-authz-18.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 (January 17, 2019) is 1897 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 (-11) exists of draft-ietf-ace-cwt-proof-of-possession-05 == Outdated reference: A later version (-16) exists of draft-ietf-ace-oauth-params-01 ** 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 (-16) exists of draft-ietf-core-object-security-15 == Outdated reference: A later version (-15) exists of draft-ietf-oauth-device-flow-13 == Outdated reference: A later version (-43) exists of draft-ietf-tls-dtls13-30 -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 7049 (Obsoleted by RFC 8949) -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) Summary: 2 errors (**), 0 flaws (~~), 6 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 ACE Working Group L. Seitz 3 Internet-Draft RISE 4 Intended status: Standards Track G. Selander 5 Expires: July 21, 2019 Ericsson 6 E. Wahlstroem 8 S. Erdtman 9 Spotify AB 10 H. Tschofenig 11 Arm Ltd. 12 January 17, 2019 14 Authentication and Authorization for Constrained Environments (ACE) 15 using the OAuth 2.0 Framework (ACE-OAuth) 16 draft-ietf-ace-oauth-authz-18 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 CoAP, thus making a well-known and widely used 24 authorization solution suitable for IoT devices. Existing 25 specifications are used where possible, but where the constraints of 26 IoT devices require it, extensions are added and profiles are 27 defined. 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 http://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 July 21, 2019. 46 Copyright Notice 48 Copyright (c) 2019 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 (http://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 . . . . . . . . . . . . . . . . . . . . 10 69 5. Framework . . . . . . . . . . . . . . . . . . . . . . . . . . 14 70 5.1. Discovering Authorization Servers . . . . . . . . . . . . 15 71 5.1.1. Unauthorized Resource Request Message . . . . . . . . 15 72 5.1.2. AS Information . . . . . . . . . . . . . . . . . . . 16 73 5.2. Authorization Grants . . . . . . . . . . . . . . . . . . 17 74 5.3. Client Credentials . . . . . . . . . . . . . . . . . . . 18 75 5.4. AS Authentication . . . . . . . . . . . . . . . . . . . . 18 76 5.5. The Authorization Endpoint . . . . . . . . . . . . . . . 19 77 5.6. The Token Endpoint . . . . . . . . . . . . . . . . . . . 19 78 5.6.1. Client-to-AS Request . . . . . . . . . . . . . . . . 20 79 5.6.2. AS-to-Client Response . . . . . . . . . . . . . . . . 22 80 5.6.3. Error Response . . . . . . . . . . . . . . . . . . . 24 81 5.6.4. Request and Response Parameters . . . . . . . . . . . 25 82 5.6.4.1. Grant Type . . . . . . . . . . . . . . . . . . . 25 83 5.6.4.2. Token Type . . . . . . . . . . . . . . . . . . . 26 84 5.6.4.3. Profile . . . . . . . . . . . . . . . . . . . . . 26 85 5.6.5. Mapping Parameters to CBOR . . . . . . . . . . . . . 27 86 5.7. The Introspection Endpoint . . . . . . . . . . . . . . . 27 87 5.7.1. Introspection Request . . . . . . . . . . . . . . . . 28 88 5.7.2. Introspection Response . . . . . . . . . . . . . . . 29 89 5.7.3. Error Response . . . . . . . . . . . . . . . . . . . 30 90 5.7.4. Mapping Introspection parameters to CBOR . . . . . . 31 91 5.8. The Access Token . . . . . . . . . . . . . . . . . . . . 31 92 5.8.1. The Authorization Information Endpoint . . . . . . . 32 93 5.8.1.1. Verifying an Access Token . . . . . . . . . . . . 33 94 5.8.1.2. Protecting the Authzorization Information 95 Endpoint . . . . . . . . . . . . . . . . . . . . 35 96 5.8.2. Client Requests to the RS . . . . . . . . . . . . . . 35 97 5.8.3. Token Expiration . . . . . . . . . . . . . . . . . . 36 98 6. Security Considerations . . . . . . . . . . . . . . . . . . . 36 99 6.1. Unprotected AS Information . . . . . . . . . . . . . . . 38 100 6.2. Minimal security requirements for communication . 38 101 6.3. Use of Nonces for Replay Protection . . . . . . . . . . . 39 102 6.4. Combining profiles . . . . . . . . . . . . . . . . . . . 39 103 6.5. Unprotected Information . . . . . . . . . . . . . . . . . 39 104 6.6. Denial of service against or with Introspection . . 40 105 7. Privacy Considerations . . . . . . . . . . . . . . . . . . . 40 106 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 41 107 8.1. Authorization Server Information . . . . . . . . . . . . 41 108 8.2. OAuth Extensions Error Registration . . . . . . . . . . . 42 109 8.3. OAuth Error Code CBOR Mappings Registry . . . . . . . . . 42 110 8.4. OAuth Grant Type CBOR Mappings . . . . . . . . . . . . . 43 111 8.5. OAuth Access Token Types . . . . . . . . . . . . . . . . 43 112 8.6. OAuth Token Type CBOR Mappings . . . . . . . . . . . . . 43 113 8.6.1. Initial Registry Contents . . . . . . . . . . . . . . 44 114 8.7. ACE Profile Registry . . . . . . . . . . . . . . . . . . 44 115 8.8. OAuth Parameter Registration . . . . . . . . . . . . . . 45 116 8.9. Token Endpoint CBOR Mappings Registry . . . . . . . . . . 45 117 8.10. OAuth Introspection Response Parameter Registration . . . 46 118 8.11. Introspection Endpoint CBOR Mappings Registry . . . . . . 46 119 8.12. JSON Web Token Claims . . . . . . . . . . . . . . . . . . 47 120 8.13. CBOR Web Token Claims . . . . . . . . . . . . . . . . . . 47 121 8.14. Media Type Registrations . . . . . . . . . . . . . . . . 48 122 8.15. CoAP Content-Format Registry . . . . . . . . . . . . . . 49 123 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 49 124 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 50 125 10.1. Normative References . . . . . . . . . . . . . . . . . . 50 126 10.2. Informative References . . . . . . . . . . . . . . . . . 52 127 Appendix A. Design Justification . . . . . . . . . . . . . . . . 54 128 Appendix B. Roles and Responsibilities . . . . . . . . . . . . . 58 129 Appendix C. Requirements on Profiles . . . . . . . . . . . . . . 60 130 Appendix D. Assumptions on AS knowledge about C and RS . . . . . 60 131 Appendix E. Deployment Examples . . . . . . . . . . . . . . . . 61 132 E.1. Local Token Validation . . . . . . . . . . . . . . . . . 61 133 E.2. Introspection Aided Token Validation . . . . . . . . . . 65 134 Appendix F. Document Updates . . . . . . . . . . . . . . . . . . 69 135 F.1. Version -17 to -18 . . . . . . . . . . . . . . . . . . . 69 136 F.2. Version -16 to -17 . . . . . . . . . . . . . . . . . . . 69 137 F.3. Version -15 to -16 . . . . . . . . . . . . . . . . . . . 70 138 F.4. Version -14 to -15 . . . . . . . . . . . . . . . . . . . 70 139 F.5. Version -13 to -14 . . . . . . . . . . . . . . . . . . . 70 140 F.6. Version -12 to -13 . . . . . . . . . . . . . . . . . . . 70 141 F.7. Version -11 to -12 . . . . . . . . . . . . . . . . . . . 70 142 F.8. Version -10 to -11 . . . . . . . . . . . . . . . . . . . 71 143 F.9. Version -09 to -10 . . . . . . . . . . . . . . . . . . . 71 144 F.10. Version -08 to -09 . . . . . . . . . . . . . . . . . . . 71 145 F.11. Version -07 to -08 . . . . . . . . . . . . . . . . . . . 71 146 F.12. Version -06 to -07 . . . . . . . . . . . . . . . . . . . 72 147 F.13. Version -05 to -06 . . . . . . . . . . . . . . . . . . . 72 148 F.14. Version -04 to -05 . . . . . . . . . . . . . . . . . . . 72 149 F.15. Version -03 to -04 . . . . . . . . . . . . . . . . . . . 72 150 F.16. Version -02 to -03 . . . . . . . . . . . . . . . . . . . 73 151 F.17. Version -01 to -02 . . . . . . . . . . . . . . . . . . . 73 152 F.18. Version -00 to -01 . . . . . . . . . . . . . . . . . . . 73 153 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 74 155 1. Introduction 157 Authorization is the process for granting approval to an entity to 158 access a resource [RFC4949]. The authorization task itself can best 159 be described as granting access to a requesting client, for a 160 resource hosted on a device, the resource server (RS). This exchange 161 is mediated by one or multiple authorization servers (AS). Managing 162 authorization for a large number of devices and users can be a 163 complex task. 165 While prior work on authorization solutions for the Web and for the 166 mobile environment also applies to the Internet of Things (IoT) 167 environment, many IoT devices are constrained, for example, in terms 168 of processing capabilities, available memory, etc. For web 169 applications on constrained nodes, this specification RECOMMENDS the 170 use of CoAP [RFC7252] as replacement for HTTP. 172 A detailed treatment of constraints can be found in [RFC7228], and 173 the different IoT deployments present a continuous range of device 174 and network capabilities. Taking energy consumption as an example: 175 At one end there are energy-harvesting or battery powered devices 176 which have a tight power budget, on the other end there are mains- 177 powered devices, and all levels in between. 179 Hence, IoT devices may be very different in terms of available 180 processing and message exchange capabilities and there is a need to 181 support many different authorization use cases [RFC7744]. 183 This specification describes a framework for authentication and 184 authorization in constrained environments (ACE) built on re-use of 185 OAuth 2.0 [RFC6749], thereby extending authorization to Internet of 186 Things devices. This specification contains the necessary building 187 blocks for adjusting OAuth 2.0 to IoT environments. 189 More detailed, interoperable specifications can be found in profiles. 190 Implementations may claim conformance with a specific profile, 191 whereby implementations utilizing the same profile interoperate while 192 implementations of different profiles are not expected to be 193 interoperable. Some devices, such as mobile phones and tablets, may 194 implement multiple profiles and will therefore be able to interact 195 with a wider range of low end devices. Requirements on profiles are 196 described at contextually appropriate places throughout this 197 specification, and also summarized in Appendix C. 199 2. Terminology 201 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 202 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 203 "OPTIONAL" in this document are to be interpreted as described in BCP 204 14 [RFC2119] [RFC8174] when, and only when, they appear in all 205 capitals, as shown here. 207 Certain security-related terms such as "authentication", 208 "authorization", "confidentiality", "(data) integrity", "message 209 authentication code", and "verify" are taken from [RFC4949]. 211 Since exchanges in this specification are described as RESTful 212 protocol interactions, HTTP [RFC7231] offers useful terminology. 214 Terminology for entities in the architecture is defined in OAuth 2.0 215 [RFC6749] such as client (C), resource server (RS), and authorization 216 server (AS). 218 Note that the term "endpoint" is used here following its OAuth 219 definition, which is to denote resources such as token and 220 introspection at the AS and authz-info at the RS (see Section 5.8.1 221 for a definition of the authz-info endpoint). The CoAP [RFC7252] 222 definition, which is "An entity participating in the CoAP protocol" 223 is not used in this specification. 225 The specifications in this document is called the "framework" or "ACE 226 framework". When referring to "profiles of this framework" it refers 227 to additional specifications that define the use of this 228 specification with concrete transport, and communication security 229 protocols (e.g., CoAP over DTLS). 231 We use the term "Access Information" for parameters other than the 232 access token provided to the client by the AS to enable it to access 233 the RS (e.g. public key of the RS, profile supported by RS). 235 3. Overview 237 This specification defines the ACE framework for authorization in the 238 Internet of Things environment. It consists of a set of building 239 blocks. 241 The basic block is the OAuth 2.0 [RFC6749] framework, which enjoys 242 widespread deployment. Many IoT devices can support OAuth 2.0 243 without any additional extensions, but for certain constrained 244 settings additional profiling is needed. 246 Another building block is the lightweight web transfer protocol CoAP 247 [RFC7252], for those communication environments where HTTP is not 248 appropriate. CoAP typically runs on top of UDP, which further 249 reduces overhead and message exchanges. While this specification 250 defines extensions for the use of OAuth over CoAP, other underlying 251 protocols are not prohibited from being supported in the future, such 252 as HTTP/2, MQTT, BLE and QUIC. 254 A third building block is CBOR [RFC7049], for encodings where JSON 255 [RFC8259] is not sufficiently compact. CBOR is a binary encoding 256 designed for small code and message size, which may be used for 257 encoding of self contained tokens, and also for encoding payload 258 transferred in protocol messages. 260 A fourth building block is the compact CBOR-based secure message 261 format COSE [RFC8152], which enables application layer security as an 262 alternative or complement to transport layer security (DTLS [RFC6347] 263 or TLS [RFC5246]). COSE is used to secure self-contained tokens such 264 as proof-of-possession (PoP) tokens, which is an extension to the 265 OAuth tokens. The default token format is defined in CBOR web token 266 (CWT) [RFC8392]. Application layer security for CoAP using COSE can 267 be provided with OSCORE [I-D.ietf-core-object-security]. 269 With the building blocks listed above, solutions satisfying various 270 IoT device and network constraints are possible. A list of 271 constraints is described in detail in RFC 7228 [RFC7228] and a 272 description of how the building blocks mentioned above relate to the 273 various constraints can be found in Appendix A. 275 Luckily, not every IoT device suffers from all constraints. The ACE 276 framework nevertheless takes all these aspects into account and 277 allows several different deployment variants to co-exist, rather than 278 mandating a one-size-fits-all solution. It is important to cover the 279 wide range of possible interworking use cases and the different 280 requirements from a security point of view. Once IoT deployments 281 mature, popular deployment variants will be documented in the form of 282 ACE profiles. 284 3.1. OAuth 2.0 286 The OAuth 2.0 authorization framework enables a client to obtain 287 scoped access to a resource with the permission of a resource owner. 288 Authorization information, or references to it, is passed between the 289 nodes using access tokens. These access tokens are issued to clients 290 by an authorization server with the approval of the resource owner. 291 The client uses the access token to access the protected resources 292 hosted by the resource server. 294 A number of OAuth 2.0 terms are used within this specification: 296 The token and introspection Endpoints: 297 The AS hosts the token endpoint that allows a client to request 298 access tokens. The client makes a POST request to the token 299 endpoint on the AS and receives the access token in the response 300 (if the request was successful). 301 In some deployments, a token introspection endpoint is provided by 302 the AS, which can be used by the RS if it needs to request 303 additional information regarding a received access token. The RS 304 makes a POST request to the introspection endpoint on the AS and 305 receives information about the access token in the response. (See 306 "Introspection" below.) 308 Access Tokens: 309 Access tokens are credentials needed to access protected 310 resources. An access token is a data structure representing 311 authorization permissions issued by the AS to the client. Access 312 tokens are generated by the AS and consumed by the RS. The access 313 token content is opaque to the client. 315 Access tokens can have different formats, and various methods of 316 utilization (e.g., cryptographic properties) based on the security 317 requirements of the given deployment. 319 Refresh Tokens: 320 Refresh tokens are credentials used to obtain access tokens. 321 Refresh tokens are issued to the client by the authorization 322 server and are used to obtain a new access token when the current 323 access token becomes invalid or expires, or to obtain additional 324 access tokens with identical or narrower scope (access tokens may 325 have a shorter lifetime and fewer permissions than authorized by 326 the resource owner). Issuing a refresh token is optional at the 327 discretion of the authorization server. If the authorization 328 server issues a refresh token, it is included when issuing an 329 access token (i.e., step (B) in Figure 1). 331 A refresh token in OAuth 2.0 is a string representing the 332 authorization granted to the client by the resource owner. The 333 string is usually opaque to the client. The token denotes an 334 identifier used to retrieve the authorization information. Unlike 335 access tokens, refresh tokens are intended for use only with 336 authorization servers and are never sent to resource servers. 337 Proof of Possession Tokens: 338 An access token may be bound to a cryptographic key, which is then 339 used by an RS to authenticate requests from a client. Such tokens 340 are called proof-of-possession access tokens (or PoP access 341 tokens). 343 The proof-of-possession (PoP) security concept assumes that the AS 344 acts as a trusted third party that binds keys to access tokens. 345 These so called PoP keys are then used by the client to 346 demonstrate the possession of the secret to the RS when accessing 347 the resource. The RS, when receiving an access token, needs to 348 verify that the key used by the client matches the one bound to 349 the access token. When this specification uses the term "access 350 token" it is assumed to be a PoP access token token unless 351 specifically stated otherwise. 353 The key bound to the access token (the PoP key) may use either 354 symmetric or asymmetric cryptography. The appropriate choice of 355 the kind of cryptography depends on the constraints of the IoT 356 devices as well as on the security requirements of the use case. 358 Symmetric PoP key: 359 The AS generates a random symmetric PoP key. The key is either 360 stored to be returned on introspection calls or encrypted and 361 included in the access token. The PoP key is also encrypted 362 for the client and sent together with the access token to the 363 client. 365 Asymmetric PoP key: 366 An asymmetric key pair is generated on the client and the 367 public key is sent to the AS (if it does not already have 368 knowledge of the client's public key). Information about the 369 public key, which is the PoP key in this case, is either stored 370 to be returned on introspection calls or included inside the 371 access token and sent back to the requesting client. The RS 372 can identify the client's public key from the information in 373 the token, which allows the client to use the corresponding 374 private key for the proof of possession. 376 The access token is either a simple reference, or a structured 377 information object (e.g., CWT [RFC8392]) protected by a 378 cryptographic wrapper (e.g., COSE [RFC8152]). The choice of PoP 379 key does not necessarily imply a specific credential type for the 380 integrity protection of the token. 382 Scopes and Permissions: 383 In OAuth 2.0, the client specifies the type of permissions it is 384 seeking to obtain (via the scope parameter) in the access token 385 request. In turn, the AS may use the scope response parameter to 386 inform the client of the scope of the access token issued. As the 387 client could be a constrained device as well, this specification 388 defines the use of CBOR encoding as data format, see Section 5, to 389 request scopes and to be informed what scopes the access token 390 actually authorizes. 392 The values of the scope parameter in OAuth 2.0 are expressed as a 393 list of space-delimited, case-sensitive strings, with a semantic 394 that is well-known to the AS and the RS. More details about the 395 concept of scopes is found under Section 3.3 in [RFC6749]. 397 Claims: 398 Information carried in the access token or returned from 399 introspection, called claims, is in the form of name-value pairs. 400 An access token may, for example, include a claim identifying the 401 AS that issued the token (via the "iss" claim) and what audience 402 the access token is intended for (via the "aud" claim). The 403 audience of an access token can be a specific resource or one or 404 many resource servers. The resource owner policies influence what 405 claims are put into the access token by the authorization server. 407 While the structure and encoding of the access token varies 408 throughout deployments, a standardized format has been defined 409 with the JSON Web Token (JWT) [RFC7519] where claims are encoded 410 as a JSON object. In [RFC8392], an equivalent format using CBOR 411 encoding (CWT) has been defined. 413 Introspection: 414 Introspection is a method for a resource server to query the 415 authorization server for the active state and content of a 416 received access token. This is particularly useful in those cases 417 where the authorization decisions are very dynamic and/or where 418 the received access token itself is an opaque reference rather 419 than a self-contained token. More information about introspection 420 in OAuth 2.0 can be found in [RFC7662]. 422 3.2. CoAP 424 CoAP is an application layer protocol similar to HTTP, but 425 specifically designed for constrained environments. CoAP typically 426 uses datagram-oriented transport, such as UDP, where reordering and 427 loss of packets can occur. A security solution needs to take the 428 latter aspects into account. 430 While HTTP uses headers and query strings to convey additional 431 information about a request, CoAP encodes such information into 432 header parameters called 'options'. 434 CoAP supports application-layer fragmentation of the CoAP payloads 435 through blockwise transfers [RFC7959]. However, blockwise transfer 436 does not increase the size limits of CoAP options, therefore data 437 encoded in options has to be kept small. 439 Transport layer security for CoAP can be provided by DTLS or TLS 440 [RFC6347][RFC5246][RFC8446] [I-D.ietf-tls-dtls13]. CoAP defines a 441 number of proxy operations that require transport layer security to 442 be terminated at the proxy. One approach for protecting CoAP 443 communication end-to-end through proxies, and also to support 444 security for CoAP over a different transport in a uniform way, is to 445 provide security at the application layer using an object-based 446 security mechanism such as COSE [RFC8152]. 448 One application of COSE is OSCORE [I-D.ietf-core-object-security], 449 which provides end-to-end confidentiality, integrity and replay 450 protection, and a secure binding between CoAP request and response 451 messages. In OSCORE, the CoAP messages are wrapped in COSE objects 452 and sent using CoAP. 454 This framework RECOMMENDS the use of CoAP as replacement for HTTP for 455 use in constrained environments. 457 4. Protocol Interactions 459 The ACE framework is based on the OAuth 2.0 protocol interactions 460 using the token endpoint and optionally the introspection endpoint. 461 A client obtains an access token, and optionally a refresh token, 462 from an AS using the token endpoint and subsequently presents the 463 access token to a RS to gain access to a protected resource. In most 464 deployments the RS can process the access token locally, however in 465 some cases the RS may present it to the AS via the introspection 466 endpoint to get fresh information. These interactions are shown in 467 Figure 1. An overview of various OAuth concepts is provided in 468 Section 3.1. 470 The OAuth 2.0 framework defines a number of "protocol flows" via 471 grant types, which have been extended further with extensions to 472 OAuth 2.0 (such as RFC 7521 [RFC7521] and 473 [I-D.ietf-oauth-device-flow]). What grant types works best depends 474 on the usage scenario and RFC 7744 [RFC7744] describes many different 475 IoT use cases but there are two preferred grant types, namely the 476 Authorization Code Grant (described in Section 4.1 of [RFC7521]) and 477 the Client Credentials Grant (described in Section 4.4 of [RFC7521]). 478 The Authorization Code Grant is a good fit for use with apps running 479 on smart phones and tablets that request access to IoT devices, a 480 common scenario in the smart home environment, where users need to go 481 through an authentication and authorization phase (at least during 482 the initial setup phase). The native apps guidelines described in 483 [RFC8252] are applicable to this use case. The Client Credential 484 Grant is a good fit for use with IoT devices where the OAuth client 485 itself is constrained. In such a case, the resource owner has pre- 486 arranged access rights for the client with the authorization server, 487 which is often accomplished using a commissioning tool. 489 The consent of the resource owner, for giving a client access to a 490 protected resource, can be provided dynamically as in the traditional 491 OAuth flows, or it could be pre-configured by the resource owner as 492 authorization policies at the AS, which the AS evaluates when a token 493 request arrives. The resource owner and the requesting party (i.e., 494 client owner) are not shown in Figure 1. 496 This framework supports a wide variety of communication security 497 mechanisms between the ACE entities, such as client, AS, and RS. It 498 is assumed that the client has been registered (also called enrolled 499 or onboarded) to an AS using a mechanism defined outside the scope of 500 this document. In practice, various techniques for onboarding have 501 been used, such as factory-based provisioning or the use of 502 commissioning tools. Regardless of the onboarding technique, this 503 provisioning procedure implies that the client and the AS exchange 504 credentials and configuration parameters. These credentials are used 505 to mutually authenticate each other and to protect messages exchanged 506 between the client and the AS. 508 It is also assumed that the RS has been registered with the AS, 509 potentially in a similar way as the client has been registered with 510 the AS. Established keying material between the AS and the RS allows 511 the AS to apply cryptographic protection to the access token to 512 ensure that its content cannot be modified, and if needed, that the 513 content is confidentiality protected. 515 The keying material necessary for establishing communication security 516 between C and RS is dynamically established as part of the protocol 517 described in this document. 519 At the start of the protocol, there is an optional discovery step 520 where the client discovers the resource server and the resources this 521 server hosts. In this step, the client might also determine what 522 permissions are needed to access the protected resource. A generic 523 procedure is described in Section 5.1, profiles MAY define other 524 procedures for discovery. 526 In Bluetooth Low Energy, for example, advertisements are broadcasted 527 by a peripheral, including information about the primary services. 528 In CoAP, as a second example, a client can make a request to "/.well- 529 known/core" to obtain information about available resources, which 530 are returned in a standardized format as described in [RFC6690]. 532 +--------+ +---------------+ 533 | |---(A)-- Token Request ------->| | 534 | | | Authorization | 535 | |<--(B)-- Access Token ---------| Server | 536 | | + Access Information | | 537 | | + Refresh Token (optional) +---------------+ 538 | | ^ | 539 | | Introspection Request (D)| | 540 | Client | (optional) | | 541 | | Response | |(E) 542 | | (optional) | v 543 | | +--------------+ 544 | |---(C)-- Token + Request ----->| | 545 | | | Resource | 546 | |<--(F)-- Protected Resource ---| Server | 547 | | | | 548 +--------+ +--------------+ 550 Figure 1: Basic Protocol Flow. 552 Requesting an Access Token (A): 553 The client makes an access token request to the token endpoint at 554 the AS. This framework assumes the use of PoP access tokens (see 555 Section 3.1 for a short description) wherein the AS binds a key to 556 an access token. The client may include permissions it seeks to 557 obtain, and information about the credentials it wants to use 558 (e.g., symmetric/asymmetric cryptography or a reference to a 559 specific credential). 561 Access Token Response (B): 562 If the AS successfully processes the request from the client, it 563 returns an access token and optionally a refresh token (note that 564 only certain grant types support refresh tokens). It can also 565 return additional parameters, referred to as "Access Information". 567 In addition to the response parameters defined by OAuth 2.0 and 568 the PoP access token extension, this framework defines parameters 569 that can be used to inform the client about capabilities of the 570 RS. More information about these parameters can be found in 571 Section 5.6.4. 573 Resource Request (C): 574 The client interacts with the RS to request access to the 575 protected resource and provides the access token. The protocol to 576 use between the client and the RS is not restricted to CoAP. 577 HTTP, HTTP/2, QUIC, MQTT, Bluetooth Low Energy, etc., are also 578 viable candidates. 580 Depending on the device limitations and the selected protocol, 581 this exchange may be split up into two parts: 583 (1) the client sends the access token containing, or 584 referencing, the authorization information to the RS, that may 585 be used for subsequent resource requests by the client, and 586 (2) the client makes the resource access request, using the 587 communication security protocol and other Access Information 588 obtained from the AS. 590 The Client and the RS mutually authenticate using the security 591 protocol specified in the profile (see step B) and the keys 592 obtained in the access token or the Access Information. The RS 593 verifies that the token is integrity protected by the AS and 594 compares the claims contained in the access token with the 595 resource request. If the RS is online, validation can be handed 596 over to the AS using token introspection (see messages D and E) 597 over HTTP or CoAP. 599 Token Introspection Request (D): 600 A resource server may be configured to introspect the access token 601 by including it in a request to the introspection endpoint at that 602 AS. Token introspection over CoAP is defined in Section 5.7 and 603 for HTTP in [RFC7662]. 605 Note that token introspection is an optional step and can be 606 omitted if the token is self-contained and the resource server is 607 prepared to perform the token validation on its own. 609 Token Introspection Response (E): 610 The AS validates the token and returns the most recent parameters, 611 such as scope, audience, validity etc. associated with it back to 612 the RS. The RS then uses the received parameters to process the 613 request to either accept or to deny it. 615 Protected Resource (F): 616 If the request from the client is authorized, the RS fulfills the 617 request and returns a response with the appropriate response code. 618 The RS uses the dynamically established keys to protect the 619 response, according to used communication security protocol. 621 5. Framework 623 The following sections detail the profiling and extensions of OAuth 624 2.0 for constrained environments, which constitutes the ACE 625 framework. 627 Credential Provisioning 628 For IoT, it cannot be assumed that the client and RS are part of a 629 common key infrastructure, so the AS provisions credentials or 630 associated information to allow mutual authentication. These 631 credentials need to be provided to the parties before or during 632 the authentication protocol is executed, and may be re-used for 633 subsequent token requests. 635 Proof-of-Possession 636 The ACE framework, by default, implements proof-of-possession for 637 access tokens, i.e., that the token holder can prove being a 638 holder of the key bound to the token. The binding is provided by 639 the "cnf" claim [I-D.ietf-ace-cwt-proof-of-possession] indicating 640 what key is used for proof-of-possession. If a client needs to 641 submit a new access token, e.g., to obtain additional access 642 rights, they can request that the AS binds this token to the same 643 key as the previous one. 645 ACE Profiles 646 The client or RS may be limited in the encodings or protocols it 647 supports. To support a variety of different deployment settings, 648 specific interactions between client and RS are defined in an ACE 649 profile. In ACE framework the AS is expected to manage the 650 matching of compatible profile choices between a client and an RS. 651 The AS informs the client of the selected profile using the 652 "profile" parameter in the token response. 654 OAuth 2.0 requires the use of TLS both to protect the communication 655 between AS and client when requesting an access token; between client 656 and RS when accessing a resource and between AS and RS if 657 introspection is used. In constrained settings TLS is not always 658 feasible, or desirable. Nevertheless it is REQUIRED that the data 659 exchanged with the AS is encrypted, integrity protected and protected 660 against message replay. It is also REQUIRED that the AS and the 661 endpoint communicating with it (client or RS) perform mutual 662 authentication. Furthermore it MUST be assured that responses are 663 bound to the requests in the sense that the receiver of a response 664 can be certain that the response actually belongs to a certain 665 request. 667 Profiles MUST specify a communication security protocol that provides 668 the features required above. 670 In OAuth 2.0 the communication with the Token and the Introspection 671 endpoints at the AS is assumed to be via HTTP and may use Uri-query 672 parameters. When profiles of this framework use CoAP instead, this 673 framework REQUIRES the use of the following alternative instead of 674 Uri-query parameters: The sender (client or RS) encodes the 675 parameters of its request as a CBOR map and submits that map as the 676 payload of the POST request. Profiles that use CBOR encoding of 677 protocol message parameters MUST use the media format 'application/ 678 ace+cbor', unless the protocol message is wrapped in another Content- 679 Format (e.g. object security). If CoAP is used for communication, 680 the Content-Format MUST be abbreviated with the ID: 19 (see 681 Section 8.15. 683 The OAuth 2.0 AS uses a JSON structure in the payload of its 684 responses both to client and RS. If CoAP is used, this framework 685 REQUIRES the use of CBOR [RFC7049] instead of JSON. Depending on the 686 profile, the CBOR payload MAY be enclosed in a non-CBOR cryptographic 687 wrapper. 689 5.1. Discovering Authorization Servers 691 In order to determine the AS in charge of a resource hosted at the 692 RS, C MAY send an initial Unauthorized Resource Request message to 693 RS. RS then denies the request and sends the address of its AS back 694 to C. 696 Instead of the initial Unauthorized Resource Request message, other 697 discovery methods may be used, or the client may be pre-provisioned 698 with the address of the AS. 700 5.1.1. Unauthorized Resource Request Message 702 The optional Unauthorized Resource Request message is a request for a 703 resource hosted by RS for which no proper authorization is granted. 705 RS MUST treat any request for a protected resource as Unauthorized 706 Resource Request message when any of the following holds: 708 o The request has been received on an unprotected channel. 709 o RS has no valid access token for the sender of the request 710 regarding the requested action on that resource. 711 o RS has a valid access token for the sender of the request, but 712 this does not allow the requested action on the requested 713 resource. 715 Note: These conditions ensure that RS can handle requests 716 autonomously once access was granted and a secure channel has been 717 established between C and RS. The authz-info endpoint MUST NOT be 718 protected as specified above, in order to allow clients to upload 719 access tokens to RS (cf. Section 5.8.1). 721 Unauthorized Resource Request messages MUST be denied with a client 722 error response. In this response, the Resource Server SHOULD provide 723 proper AS Information to enable the Client to request an access token 724 from RS's AS as described in Section 5.1.2. 726 The handling of all client requests (including unauthorized ones) by 727 the RS is described in Section 5.8.2. 729 5.1.2. AS Information 731 The AS Information is sent by RS as a response to an Unauthorized 732 Resource Request message (see Section 5.1.1) to point the sender of 733 the Unauthorized Resource Request message to RS's AS. The AS 734 information is a set of attributes containing an absolute URI (see 735 Section 4.3 of [RFC3986]) that specifies the AS in charge of RS. 737 The message MAY also contain a nonce generated by RS to ensure 738 freshness in case that the RS and AS do not have synchronized clocks. 740 Figure 2 summarizes the parameters that may be part of the AS 741 Information. 743 /-------+----------+-------------\ 744 | Name | CBOR Key | Value Type | 745 |-------+----------+-------------| 746 | AS | 0 | text string | 747 | nonce | 5 | byte string | 748 \-------+----------+-------------/ 750 Figure 2: AS Information parameters 752 Note that the schema part of the AS parameter may need to be adapted 753 to the security protocol that is used between the client and the AS. 754 Thus the example AS value "coap://as.example.com/token" might need to 755 be transformed to "coaps://as.example.com/token". It is assumed that 756 the client can determine the correct schema part on its own depending 757 on the way it communicates with the AS. 759 Figure 3 shows an example for an AS Information message payload using 760 CBOR [RFC7049] diagnostic notation, using the parameter names instead 761 of the CBOR keys for better human readability. 763 4.01 Unauthorized 764 Content-Format: application/ace+cbor 765 {AS: "coaps://as.example.com/token", 766 nonce: h'e0a156bb3f'} 768 Figure 3: AS Information payload example 770 In this example, the attribute AS points the receiver of this message 771 to the URI "coaps://as.example.com/token" to request access 772 permissions. The originator of the AS Information payload (i.e., RS) 773 uses a local clock that is loosely synchronized with a time scale 774 common between RS and AS (e.g., wall clock time). Therefore, it has 775 included a parameter "nonce" for replay attack prevention. 777 Figure 4 illustrates the mandatory to use binary encoding of the 778 message payload shown in Figure 3. 780 a2 # map(2) 781 00 # unsigned(0) (=AS) 782 78 1c # text(28) 783 636f6170733a2f2f61732e657861 784 6d706c652e636f6d2f746f6b656e # "coaps://as.example.com/token" 785 05 # unsigned(5) (=nonce) 786 45 # bytes(5) 787 e0a156bb3f 789 Figure 4: AS Information example encoded in CBOR 791 5.2. Authorization Grants 793 To request an access token, the client obtains authorization from the 794 resource owner or uses its client credentials as grant. The 795 authorization is expressed in the form of an authorization grant. 797 The OAuth framework [RFC6749] defines four grant types. The grant 798 types can be split up into two groups, those granted on behalf of the 799 resource owner (password, authorization code, implicit) and those for 800 the client (client credentials). Further grant types have been added 801 later, such as [RFC7521] defining an assertion-based authorization 802 grant. 804 The grant type is selected depending on the use case. In cases where 805 the client acts on behalf of the resource owner, authorization code 806 grant is recommended. If the client acts on behalf of the resource 807 owner, but does not have any display or very limited interaction 808 possibilities it is recommended to use the device code grant defined 809 in [I-D.ietf-oauth-device-flow]. In cases where the client does not 810 act on behalf of the resource owner, client credentials grant is 811 recommended. 813 For details on the different grant types, see the OAuth 2.0 framework 814 [RFC6749]. The OAuth 2.0 framework provides an extension mechanism 815 for defining additional grant types so profiles of this framework MAY 816 define additional grant types, if needed. 818 5.3. Client Credentials 820 Authentication of the client is mandatory independent of the grant 821 type when requesting the access token from the token endpoint. In 822 the case of client credentials grant type, the authentication and 823 grant coincide. 825 Client registration and provisioning of client credentials to the 826 client is out of scope for this specification. 828 The OAuth framework [RFC6749] defines one client credential type, 829 client id and client secret. [I-D.erdtman-ace-rpcc] adds raw-public- 830 key and pre-shared-key to the client credentials types. Profiles of 831 this framework MAY extend with additional client credentials client 832 certificates. 834 5.4. AS Authentication 836 Client credential does not, by default, authenticate the AS that the 837 client connects to. In classic OAuth, the AS is authenticated with a 838 TLS server certificate. 840 Profiles of this framework MUST specify how clients authenticate the 841 AS and how communication security is implemented, otherwise server 842 side TLS certificates, as defined by OAuth 2.0, are required. 844 5.5. The Authorization Endpoint 846 The authorization endpoint is used to interact with the resource 847 owner and obtain an authorization grant in certain grant flows. 848 Since it requires the use of a user agent (i.e., browser), it is not 849 expected that these types of grant flow will be used by constrained 850 clients. This endpoint is therefore out of scope for this 851 specification. Implementations should use the definition and 852 recommendations of [RFC6749] and [RFC6819]. 854 If clients involved cannot support HTTP and TLS, profiles MAY define 855 mappings for the authorization endpoint. 857 5.6. The Token Endpoint 859 In standard OAuth 2.0, the AS provides the token endpoint for 860 submitting access token requests. This framework extends the 861 functionality of the token endpoint, giving the AS the possibility to 862 help the client and RS to establish shared keys or to exchange their 863 public keys. Furthermore, this framework defines encodings using 864 CBOR, as a substitute for JSON. 866 The endpoint may, however, be exposed over HTTPS as in classical 867 OAuth or even other transports. A profile MUST define the details of 868 the mapping between the fields described below, and these transports. 869 If HTTPS is used, JSON or CBOR payloads may be supported. If JSON 870 payloads are used, the semantics of Section 4 of the OAuth 2.0 871 specification MUST be followed (with additions as described below). 872 If CBOR payload is supported, the semantics described below MUST be 873 followed. 875 For the AS to be able to issue a token, the client MUST be 876 authenticated and present a valid grant for the scopes requested. 877 Profiles of this framework MUST specify how the AS authenticates the 878 client and how the communication between client and AS is protected. 880 The default name of this endpoint in an url-path is '/token', however 881 implementations are not required to use this name and can define 882 their own instead. 884 The figures of this section use CBOR diagnostic notation without the 885 integer abbreviations for the parameters or their values for 886 illustrative purposes. Note that implementations MUST use the 887 integer abbreviations and the binary CBOR encoding, if the CBOR 888 encoding is used. 890 5.6.1. Client-to-AS Request 892 The client sends a POST request to the token endpoint at the AS. The 893 profile MUST specify how the communication is protected. The content 894 of the request consists of the parameters specified in Section 4 of 895 the OAuth 2.0 specification [RFC6749] with the exception of the 896 "grant_type" parameter, which is OPTIONAL in the context of this 897 framework (as opposed to REQUIRED in RFC6749). If that parameter is 898 missing, the default value "client_credentials" is implied. 900 In addition to these parameters, a client MUST be able to use the 901 parameters from [I-D.ietf-ace-oauth-params] in an access token 902 request to the token endpoint and the AS MUST be able to process 903 these additional parameters. 905 If CBOR is used then this parameter MUST be encoded as a CBOR map. 906 The "scope" parameter can be formatted as specified in [RFC6749] and 907 additionally as a byte string, in order to allow compact encoding of 908 complex scopes. 910 When HTTP is used as a transport then the client makes a request to 911 the token endpoint by sending the parameters using the "application/ 912 x-www-form-urlencoded" format with a character encoding of UTF-8 in 913 the HTTP request entity-body, as defined in RFC 6749. 915 The following examples illustrate different types of requests for 916 proof-of-possession tokens. 918 Figure 5 shows a request for a token with a symmetric proof-of- 919 possession key. The content is displayed in CBOR diagnostic 920 notation, without abbreviations for better readability. Note that 921 this example uses the "req_aud" parameter from 922 [I-D.ietf-ace-oauth-params]. 924 Header: POST (Code=0.02) 925 Uri-Host: "as.example.com" 926 Uri-Path: "token" 927 Content-Format: "application/ace+cbor" 928 Payload: 929 { 930 "grant_type" : "client_credentials", 931 "client_id" : "myclient", 932 "req_aud" : "tempSensor4711" 933 } 935 Figure 5: Example request for an access token bound to a symmetric 936 key. 938 Figure 6 shows a request for a token with an asymmetric proof-of- 939 possession key. Note that in this example OSCORE 940 [I-D.ietf-core-object-security] is used to provide object-security, 941 therefore the Content-Format is "application/oscore" wrapping the 942 "application/ace+cbor" type content. Also note that in this example 943 the audience is implicitly known by both client and AS. Furthermore 944 note that this example uses the "req_cnf" parameter from 945 [I-D.ietf-ace-oauth-params]. 947 Header: POST (Code=0.02) 948 Uri-Host: "as.example.com" 949 Uri-Path: "token" 950 OSCORE: 0x19, 0x05, 0x05, 0x44, 0x61, 0x6c, 0x65, 0x6b 951 Content-Format: "application/oscore" 952 Payload: 953 0x44025d1 ... (full payload ommitted for brevity) ... 68b3825e 954 ) 956 Decrypted payload: 957 { 958 "grant_type" : "client_credentials", 959 "client_id" : "myclient", 960 "req_cnf" : { 961 "COSE_Key" : { 962 "kty" : "EC", 963 "kid" : h'11', 964 "crv" : "P-256", 965 "x" : b64'usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8', 966 "y" : b64'IBOL+C3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4' 967 } 968 } 969 } 971 Figure 6: Example token request bound to an asymmetric key. 973 Figure 7 shows a request for a token where a previously communicated 974 proof-of-possession key is only referenced. Note that the client 975 performs a password based authentication in this example by 976 submitting its client_secret (see Section 2.3.1 of [RFC6749]). Note 977 that this example uses the "req_aud" and "req_cnf" parameters from 978 [I-D.ietf-ace-oauth-params]. 980 Header: POST (Code=0.02) 981 Uri-Host: "as.example.com" 982 Uri-Path: "token" 983 Content-Format: "application/ace+cbor" 984 Payload: 985 { 986 "grant_type" : "client_credentials", 987 "client_id" : "myclient", 988 "client_secret" : "mysecret234", 989 "req_aud" : "valve424", 990 "scope" : "read", 991 "req_cnf" : { 992 "kid" : b64'6kg0dXJM13U' 993 } 994 } 996 Figure 7: Example request for an access token bound to a key 997 reference. 999 Refresh tokens are typically not stored as securely as proof-of- 1000 possession keys in requesting clients. Proof-of-possession based 1001 refresh token requests MUST NOT request different proof-of-possession 1002 keys or different audiences in token requests. Refresh token 1003 requests can only use to request access tokens bound to the same 1004 proof-of-possession key and the same audience as access tokens issued 1005 in the initial token request. 1007 5.6.2. AS-to-Client Response 1009 If the access token request has been successfully verified by the AS 1010 and the client is authorized to obtain an access token corresponding 1011 to its access token request, the AS sends a response with the 1012 response code equivalent to the CoAP response code 2.01 (Created). 1013 If client request was invalid, or not authorized, the AS returns an 1014 error response as described in Section 5.6.3. 1016 Note that the AS decides which token type and profile to use when 1017 issuing a successful response. It is assumed that the AS has prior 1018 knowledge of the capabilities of the client and the RS (see 1019 Appendix D. This prior knowledge may, for example, be set by the use 1020 of a dynamic client registration protocol exchange [RFC7591]. 1022 The content of the successful reply is the Access Information. When 1023 using CBOR payloads, the content MUST be encoded as CBOR map, 1024 containing parameters as specified in Section 5.1 of [RFC6749], with 1025 the following additions and changes: 1027 profile: 1029 OPTIONAL. This indicates the profile that the client MUST use 1030 towards the RS. See Section 5.6.4.3 for the formatting of this 1031 parameter. If this parameter is absent, the AS assumes that the 1032 client implicitly knows which profile to use towards the RS. 1033 token_type: 1034 This parameter is OPTIONAL, as opposed to 'required' in [RFC6749]. 1035 By default implementations of this framework SHOULD assume that 1036 the token_type is "pop". If a specific use case requires another 1037 token_type (e.g., "Bearer") to be used then this parameter is 1038 REQUIRED. 1040 Furthermore [I-D.ietf-ace-oauth-params] defines additional parameters 1041 that the AS MUST be able to use when responding to a request to the 1042 token endpoint. 1044 Figure 8 summarizes the parameters that may be part of the Access 1045 Information. This does not include the additional parameters 1046 specified in [I-D.ietf-ace-oauth-params]. 1048 /-------------------+-------------------------------\ 1049 | Parameter name | Specified in | 1050 |-------------------+-------------------------------| 1051 | access_token | RFC 6749 | 1052 | token_type | RFC 6749 | 1053 | expires_in | RFC 6749 | 1054 | refresh_token | RFC 6749 | 1055 | scope | RFC 6749 | 1056 | state | RFC 6749 | 1057 | error | RFC 6749 | 1058 | error_description | RFC 6749 | 1059 | error_uri | RFC 6749 | 1060 | profile | [this document] | 1061 \-------------------+-------------------------------/ 1063 Figure 8: Access Information parameters 1065 Figure 9 shows a response containing a token and a "cnf" parameter 1066 with a symmetric proof-of-possession key, which is defined in 1067 [I-D.ietf-ace-oauth-params]. 1069 Header: Created (Code=2.01) 1070 Content-Format: "application/ace+cbor" 1071 Payload: 1072 { 1073 "access_token" : b64'SlAV32hkKG ... 1074 (remainder of CWT omitted for brevity; 1075 CWT contains COSE_Key in the "cnf" claim)', 1076 "profile" : "coap_dtls", 1077 "expires_in" : "3600", 1078 "cnf" : { 1079 "COSE_Key" : { 1080 "kty" : "Symmetric", 1081 "kid" : b64'39Gqlw', 1082 "k" : b64'hJtXhkV8FJG+Onbc6mxCcQh' 1083 } 1084 } 1085 } 1087 Figure 9: Example AS response with an access token bound to a 1088 symmetric key. 1090 5.6.3. Error Response 1092 The error responses for CoAP-based interactions with the AS are 1093 equivalent to the ones for HTTP-based interactions as defined in 1094 Section 5.2 of [RFC6749], with the following differences: 1096 o When using CBOR the raw payload before being processed by the 1097 communication security protocol MUST be encoded as a CBOR map. 1098 o A response code equivalent to the CoAP code 4.00 (Bad Request) 1099 MUST be used for all error responses, except for invalid_client 1100 where a response code equivalent to the CoAP code 4.01 1101 (Unauthorized) MAY be used under the same conditions as specified 1102 in Section 5.2 of [RFC6749]. 1103 o The content type (for CoAP-based interactions) or media type (for 1104 HTTP-based interactions) "application/ace+cbor" MUST be used for 1105 the error response. 1106 o The parameters "error", "error_description" and "error_uri" MUST 1107 be abbreviated using the codes specified in Figure 12, when a CBOR 1108 encoding is used. 1109 o The error code (i.e., value of the "error" parameter) MUST be 1110 abbreviated as specified in Figure 10, when a CBOR encoding is 1111 used. 1113 /------------------------+-------------\ 1114 | Name | CBOR Values | 1115 |------------------------+-------------| 1116 | invalid_request | 1 | 1117 | invalid_client | 2 | 1118 | invalid_grant | 3 | 1119 | unauthorized_client | 4 | 1120 | unsupported_grant_type | 5 | 1121 | invalid_scope | 6 | 1122 | unsupported_pop_key | 7 | 1123 | incompatible_profiles | 8 | 1124 \------------------------+-------------/ 1126 Figure 10: CBOR abbreviations for common error codes 1128 In addition to the error responses defined in OAuth 2.0, the 1129 following behavior MUST be implemented by the AS: 1131 o If the client submits an asymmetric key in the token request that 1132 the RS cannot process, the AS MUST reject that request with a 1133 response code equivalent to the CoAP code 4.00 (Bad Request) 1134 including the error code "unsupported_pop_key" defined in 1135 Figure 10. 1136 o If the client and the RS it has requested an access token for do 1137 not share a common profile, the AS MUST reject that request with a 1138 response code equivalent to the CoAP code 4.00 (Bad Request) 1139 including the error code "incompatible_profiles" defined in 1140 Figure 10. 1142 5.6.4. Request and Response Parameters 1144 This section provides more detail about the new parameters that can 1145 be used in access token requests and responses, as well as 1146 abbreviations for more compact encoding of existing parameters and 1147 common parameter values. 1149 5.6.4.1. Grant Type 1151 The abbreviations in Figure 11 MUST be used in CBOR encodings instead 1152 of the string values defined in [RFC6749], if CBOR payloads are used. 1154 /--------------------+------------+------------------------\ 1155 | Name | CBOR Value | Original Specification | 1156 |--------------------+------------+------------------------| 1157 | password | 0 | RFC6749 | 1158 | authorization_code | 1 | RFC6749 | 1159 | client_credentials | 2 | RFC6749 | 1160 | refresh_token | 3 | RFC6749 | 1161 \--------------------+------------+------------------------/ 1163 Figure 11: CBOR abbreviations for common grant types 1165 5.6.4.2. Token Type 1167 The "token_type" parameter, defined in [RFC6749], allows the AS to 1168 indicate to the client which type of access token it is receiving 1169 (e.g., a bearer token). 1171 This document registers the new value "pop" for the OAuth Access 1172 Token Types registry, specifying a proof-of-possession token. How 1173 the proof-of-possession by the client to the RS is performed MUST be 1174 specified by the profiles. 1176 The values in the "token_type" parameter MUST be CBOR text strings, 1177 if a CBOR encoding is used. 1179 In this framework the "pop" value for the "token_type" parameter is 1180 the default. The AS may, however, provide a different value. 1182 5.6.4.3. Profile 1184 Profiles of this framework MUST define the communication protocol and 1185 the communication security protocol between the client and the RS. 1186 The security protocol MUST provide encryption, integrity and replay 1187 protection. It MUST also provide a binding between requests and 1188 responses. Furthermore profiles MUST define proof-of-possession 1189 methods, if they support proof-of-possession tokens. 1191 A profile MUST specify an identifier that MUST be used to uniquely 1192 identify itself in the "profile" parameter. The textual 1193 representation of the profile identifier is just intended for human 1194 readability and MUST NOT be used in parameters and claims. 1196 Profiles MAY define additional parameters for both the token request 1197 and the Access Information in the access token response in order to 1198 support negotiation or signaling of profile specific parameters. 1200 5.6.5. Mapping Parameters to CBOR 1202 If CBOR encoding is used, all OAuth parameters in access token 1203 requests and responses MUST be mapped to CBOR types as specified in 1204 Figure 12, using the given integer abbreviation for the map keys. 1206 Note that we have aligned the abbreviations corresponding to claims 1207 with the abbreviations defined in [RFC8392]. 1209 Note also that abbreviations from -24 to 23 have a 1 byte encoding 1210 size in CBOR. We have thus chosen to assign abbreviations in that 1211 range to parameters we expect to be used most frequently in 1212 constrained scenarios. 1214 /-------------------+----------+---------------------\ 1215 | Name | CBOR Key | Value Type | 1216 |-------------------+----------+---------------------| 1217 | access_token | 1 | byte string | 1218 | scope | 9 | text or byte string | 1219 | client_id | 24 | text string | 1220 | client_secret | 25 | byte string | 1221 | response_type | 26 | text string | 1222 | redirect_uri | 27 | text string | 1223 | state | 28 | text string | 1224 | code | 29 | byte string | 1225 | error | 30 | unsigned integer | 1226 | error_description | 31 | text string | 1227 | error_uri | 32 | text string | 1228 | grant_type | 33 | unsigned integer | 1229 | token_type | 34 | unsigned integer | 1230 | expires_in | 35 | unsigned integer | 1231 | username | 36 | text string | 1232 | password | 37 | text string | 1233 | refresh_token | 38 | byte string | 1234 | profile | 39 | unsigned integer | 1235 \-------------------+----------+---------------------/ 1237 Figure 12: CBOR mappings used in token requests 1239 5.7. The Introspection Endpoint 1241 Token introspection [RFC7662] can be OPTIONALLY provided by the AS, 1242 and is then used by the RS and potentially the client to query the AS 1243 for metadata about a given token, e.g., validity or scope. Analogous 1244 to the protocol defined in RFC 7662 [RFC7662] for HTTP and JSON, this 1245 section defines adaptations to more constrained environments using 1246 CBOR and leaving the choice of the application protocol to the 1247 profile. 1249 Communication between the requesting entity and the introspection 1250 endpoint at the AS MUST be integrity protected and encrypted. The 1251 communication security protocol MUST also provide a binding between 1252 requests and responses. Furthermore the two interacting parties MUST 1253 perform mutual authentication. Finally the AS SHOULD verify that the 1254 requesting entity has the right to access introspection information 1255 about the provided token. Profiles of this framework that support 1256 introspection MUST specify how authentication and communication 1257 security between the requesting entity and the AS is implemented. 1259 The default name of this endpoint in an url-path is '/introspect', 1260 however implementations are not required to use this name and can 1261 define their own instead. 1263 The figures of this section uses CBOR diagnostic notation without the 1264 integer abbreviations for the parameters or their values for better 1265 readability. 1267 Note that supporting introspection is OPTIONAL for implementations of 1268 this framework. 1270 5.7.1. Introspection Request 1272 The requesting entity sends a POST request to the introspection 1273 endpoint at the AS, the profile MUST specify how the communication is 1274 protected. If CBOR is used, the payload MUST be encoded as a CBOR 1275 map with a "token" entry containing either the access token or a 1276 reference to the token (e.g., the cti). Further optional parameters 1277 representing additional context that is known by the requesting 1278 entity to aid the AS in its response MAY be included. 1280 For CoAP-based interaction, all messages MUST use the content type 1281 "application/ace+cbor", while for HTTP-based interactions the 1282 equivalent media type "application/ace+cbor" MUST be used. 1284 The same parameters are required and optional as in Section 2.1 of 1285 RFC 7662 [RFC7662]. 1287 For example, Figure 13 shows a RS calling the token introspection 1288 endpoint at the AS to query about an OAuth 2.0 proof-of-possession 1289 token. Note that object security based on OSCORE 1290 [I-D.ietf-core-object-security] is assumed in this example, therefore 1291 the Content-Format is "application/oscore". Figure 14 shows the 1292 decoded payload. 1294 Header: POST (Code=0.02) 1295 Uri-Host: "as.example.com" 1296 Uri-Path: "introspect" 1297 OSCORE: 0x09, 0x05, 0x25 1298 Content-Format: "application/oscore" 1299 Payload: 1300 ... COSE content ... 1302 Figure 13: Example introspection request. 1304 { 1305 "token" : b64'7gj0dXJQ43U', 1306 "token_type_hint" : "pop" 1307 } 1309 Figure 14: Decoded token. 1311 5.7.2. Introspection Response 1313 If the introspection request is authorized and successfully 1314 processed, the AS sends a response with the response code equivalent 1315 to the CoAP code 2.01 (Created). If the introspection request was 1316 invalid, not authorized or couldn't be processed the AS returns an 1317 error response as described in Section 5.7.3. 1319 In a successful response, the AS encodes the response parameters in a 1320 map including with the same required and optional parameters as in 1321 Section 2.2 of RFC 7662 [RFC7662] with the following addition: 1323 profile OPTIONAL. This indicates the profile that the RS MUST use 1324 with the client. See Section 5.6.4.3 for more details on the 1325 formatting of this parameter. 1327 Furthermore [I-D.ietf-ace-oauth-params] defines more parameters that 1328 the AS MUST be able to use when responding to a request to the 1329 introspection endpoint. 1331 For example, Figure 15 shows an AS response to the introspection 1332 request in Figure 13. Note that this example contains the "cnf" 1333 parameter defined in [I-D.ietf-ace-oauth-params]. 1335 Header: Created Code=2.01) 1336 Content-Format: "application/ace+cbor" 1337 Payload: 1338 { 1339 "active" : true, 1340 "scope" : "read", 1341 "profile" : "coap_dtls", 1342 "cnf" : { 1343 "COSE_Key" : { 1344 "kty" : "Symmetric", 1345 "kid" : b64'39Gqlw', 1346 "k" : b64'hJtXhkV8FJG+Onbc6mxCcQh' 1347 } 1348 } 1349 } 1351 Figure 15: Example introspection response. 1353 5.7.3. Error Response 1355 The error responses for CoAP-based interactions with the AS are 1356 equivalent to the ones for HTTP-based interactions as defined in 1357 Section 2.3 of [RFC7662], with the following differences: 1359 o If content is sent and CBOR is used the payload MUST be encoded as 1360 a CBOR map and the Content-Format "application/ace+cbor" MUST be 1361 used. 1362 o If the credentials used by the requesting entity (usually the RS) 1363 are invalid the AS MUST respond with the response code equivalent 1364 to the CoAP code 4.01 (Unauthorized) and use the required and 1365 optional parameters from Section 5.2 in RFC 6749 [RFC6749]. 1366 o If the requesting entity does not have the right to perform this 1367 introspection request, the AS MUST respond with a response code 1368 equivalent to the CoAP code 4.03 (Forbidden). In this case no 1369 payload is returned. 1370 o The parameters "error", "error_description" and "error_uri" MUST 1371 be abbreviated using the codes specified in Figure 12. 1372 o The error codes MUST be abbreviated using the codes specified in 1373 Figure 10. 1375 Note that a properly formed and authorized query for an inactive or 1376 otherwise invalid token does not warrant an error response by this 1377 specification. In these cases, the authorization server MUST instead 1378 respond with an introspection response with the "active" field set to 1379 "false". 1381 5.7.4. Mapping Introspection parameters to CBOR 1383 If CBOR is used, the introspection request and response parameters 1384 MUST be mapped to CBOR types as specified in Figure 16, using the 1385 given integer abbreviation for the map key. 1387 Note that we have aligned abbreviations that correspond to a claim 1388 with the abbreviations defined in [RFC8392] and the abbreviations of 1389 parameters with the same name from Section 5.6.5. 1391 /-------------------+----------+-------------------------\ 1392 | Parameter name | CBOR Key | Value Type | 1393 |-------------------+----------+-------------------------| 1394 | iss | 1 | text string | 1395 | sub | 2 | text string | 1396 | aud | 3 | text string | 1397 | exp | 4 | integer or | 1398 | | | floating-point number | 1399 | nbf | 5 | integer or | 1400 | | | floating-point number | 1401 | iat | 6 | integer or | 1402 | | | floating-point number | 1403 | cti | 7 | byte string | 1404 | scope | 9 | text or byte string | 1405 | active | 10 | True or False | 1406 | token | 12 | byte string | 1407 | client_id | 24 | text string | 1408 | error | 30 | unsigned integer | 1409 | error_description | 31 | text string | 1410 | error_uri | 32 | text string | 1411 | token_type_hint | 33 | text string | 1412 | token_type | 34 | text string | 1413 | username | 36 | text string | 1414 | profile | 39 | unsigned integer | 1415 \-------------------+----------+-------------------------/ 1417 Figure 16: CBOR Mappings to Token Introspection Parameters. 1419 5.8. The Access Token 1421 This framework RECOMMENDS the use of CBOR web token (CWT) as 1422 specified in [RFC8392]. 1424 In order to facilitate offline processing of access tokens, this 1425 document uses the "cnf" claim from 1426 [I-D.ietf-ace-cwt-proof-of-possession] and specifies the "scope" 1427 claim for JWT- and CWT-encoded tokens. 1429 The "scope" claim explicitly encodes the scope of a given access 1430 token. This claim follows the same encoding rules as defined in 1431 Section 3.3 of [RFC6749], but in addition implementers MAY use byte 1432 strings as scope values, to achieve compact encoding of large scope 1433 elements. The meaning of a specific scope value is application 1434 specific and expected to be known to the RS running that application. 1436 If the AS needs to convey a hint to the RS about which profile it 1437 should use to communicate with the client, the AS MAY include a 1438 "profile" claim in the access token, with the same syntax and 1439 semantics as defined in Section 5.6.4.3. 1441 5.8.1. The Authorization Information Endpoint 1443 The access token, containing authorization information and 1444 information about the key used by the client, needs to be transported 1445 to the RS so that the RS can authenticate and authorize the client 1446 request. 1448 This section defines a method for transporting the access token to 1449 the RS using a RESTful protocol such as CoAP. Profiles of this 1450 framework MAY define other methods for token transport. 1452 The method consists of an authz-info endpoint, implemented by the RS. 1453 A client using this method MUST make a POST request to the authz-info 1454 endpoint at the RS with the access token in the payload. The RS 1455 receiving the token MUST verify the validity of the token. If the 1456 token is valid, the RS MUST respond to the POST request with 2.01 1457 (Created). Section Section 5.8.1.1 outlines how an RS MUST proceed 1458 to verify the validity of an access token. 1460 The RS MUST be prepared to store at least one access token for future 1461 use. This is a difference to how access tokens are handled in OAuth 1462 2.0, where the access token is typically sent along with each 1463 request, and therefore not stored at the RS. 1465 This specification RECOMMENDS that an RS stores only one token per 1466 proof-of-possession key, meaning that an additional token linked to 1467 the same key will overwrite any existing token at the RS. 1469 If the payload sent to the authz-info endpoint does not parse to a 1470 token, the RS MUST respond with a response code equivalent to the 1471 CoAP code 4.00 (Bad Request). 1473 The RS MAY make an introspection request to validate the token before 1474 responding to the POST request to the authz-info endpoint. 1476 Profiles MUST specify whether the authz-info endpoint is protected, 1477 including whether error responses from this endpoint are protected. 1478 Note that since the token contains information that allow the client 1479 and the RS to establish a security context in the first place, mutual 1480 authentication may not be possible at this point. 1482 The default name of this endpoint in an url-path is '/authz-info', 1483 however implementations are not required to use this name and can 1484 define their own instead. 1486 A RS MAY use introspection on a token received through the authz-info 1487 endpoint, e.g. if the token is an opaque reference. Some transport 1488 protocols may provide a way to indicate that the RS is busy and the 1489 client should retry after an interval; this type of status update 1490 would be appropriate while the RS is waiting for an introspection 1491 response. 1493 5.8.1.1. Verifying an Access Token 1495 When an RS receives an access token, it MUST verify it before storing 1496 it. The details of token verification depends on various aspects, 1497 including the token encoding, the type of token, the security 1498 protection applied to the token, and the claims. The token encoding 1499 matters since the security wrapper differs between the token 1500 encodings. For example, a CWT token uses COSE while a JWT token uses 1501 JOSE. The type of token also has an influence on the verification 1502 procedure since tokens may be self-contained whereby token 1503 verification may happen locally at the RS while a token-by-reference 1504 requires further interaction with the authorization server, for 1505 example using token introspection, to obtain the claims associated 1506 with the token reference. Self-contained token MUST, at a minimum, 1507 be integrity protected but they MAY also be encrypted. 1509 For self-contained tokens the RS MUST process the security protection 1510 of the token first, as specified by the respective token format. For 1511 CWT the description can be found in [RFC8392] and for JWT the 1512 relevant specification is [RFC7519]. This MUST include a 1513 verification that security protection (and thus the token) was 1514 generated by an AS that has the right to issue access tokens for this 1515 RS. 1517 In case the token is communicated by reference the RS needs to obtain 1518 the claims first. When the RS uses token introspection the relevant 1519 specification is [RFC7662] with CoAP transport specified in 1520 Section 5.7. 1522 Errors may happen during this initial processing stage: 1524 o If token or claim verification fails, the RS MUST discard the 1525 token and, if this was an interaction with authz-info, return an 1526 error message with a response code equivalent to the CoAP code 1527 4.01 (Unauthorized). 1528 o If the claims cannot be obtained the RS MUST discard the token 1529 and, in case of an interaction via the authz-info endpoint, return 1530 an error message with a response code equivalent to the CoAP code 1531 4.00 (Bad Request). 1533 Next, the RS MUST verify claims, if present, contained in the access 1534 token. Errors are returned when claim checks fail, in the order of 1535 priority of this list: 1537 iss The issuer claim must identify an AS that has the authority to 1538 issue access tokens for the receiving RS. If that is not the case 1539 the RS MUST respond with a response code equivalent to the CoAP 1540 code 4.01 (Unauthorized). 1541 exp The expiration date must be in the future. If that is not the 1542 case the RS MUST respond with a response code equivalent to the 1543 CoAP code 4.01 (Unauthorized). Note that the RS has to terminate 1544 access rights to the protected resources at the time when the 1545 tokens expire. 1546 aud The audience claim must refer to an audience that the RS 1547 identifies with. If that is not the case the RS MUST respond with 1548 a response code equivalent to the CoAP code 4.03 (Forbidden). 1549 scope The RS must recognize value of the scope claim. If that is 1550 not the case the RS MUST respond with a response code equivalent 1551 to the CoAP code 4.00 (Bad Request). The RS MAY provide 1552 additional information in the error response, to clarify what went 1553 wrong. 1555 If the access token contains any other claims that the RS cannot 1556 process the RS MUST respond with a response code equivalent to the 1557 CoAP code 4.00 (Bad Request). The RS MAY provide additional detail 1558 in the error response to clarify which claim couldn't be processed. 1560 Note that the Subject (sub) claim cannot always be verified when the 1561 token is submitted to the RS since the client may not have 1562 authenticated yet. Also note that a counter for the expires_in (exi) 1563 claim MUST be initialized when the RS first verifies this token. 1565 When sending error responses, the RS MAY use the error codes from 1566 Section 3.1 of [RFC6750], to provide additional details to the 1567 client. 1569 5.8.1.2. Protecting the Authzorization Information Endpoint 1571 As this framework can be used in RESTful environments, it is 1572 important to make sure that attackers cannot perform unauthorized 1573 requests on the auth-info endpoints, other than submitting access 1574 tokens. 1576 Specifically it SHOULD NOT be possible to perform GET, DELETE or PUT 1577 on the authz-info endpoint and on it's children (if any). 1579 The POST method SHOULD NOT be allowed on children of the authz-info 1580 endpoint. 1582 The RS SHOULD implement rate limiting measures to mitigate attacks 1583 aiming to overload the processing capacity of the RS by repeatedly 1584 submitting tokens. For CoAP-based communication the RS could use the 1585 mechanisms from [I-D.ietf-core-too-many-reqs] to indicate that it is 1586 overloaded. 1588 5.8.2. Client Requests to the RS 1590 If an RS receives a request from a client, and the target resource 1591 requires authorization, the RS MUST first verify that it has an 1592 access token that authorizes this request, and that the client has 1593 performed the proof-of-possession for that token. 1595 The response code MUST be 4.01 (Unauthorized) in case the client has 1596 not performed the proof-of-possession, or if RS has no valid access 1597 token for the client. If RS has an access token for the client but 1598 not for the resource that was requested, RS MUST reject the request 1599 with a 4.03 (Forbidden). If RS has an access token for the client 1600 but it does not cover the action that was requested on the resource, 1601 RS MUST reject the request with a 4.05 (Method Not Allowed). 1603 Note: The use of the response codes 4.03 and 4.05 is intended to 1604 prevent infinite loops where a dumb Client optimistically tries to 1605 access a requested resource with any access token received from AS. 1606 As malicious clients could pretend to be C to determine C's 1607 privileges, these detailed response codes must be used only when a 1608 certain level of security is already available which can be achieved 1609 only when the Client is authenticated. 1611 Note: The RS MAY use introspection for timely validation of an access 1612 token, at the time when a request is presented. 1614 Note: Matching the claims of the access token (e.g., scope) to a 1615 specific request is application specific. 1617 If the request matches a valid token and the client has performed the 1618 proof-of-possession for that token, the RS continues to process the 1619 request as specified by the underlying application. 1621 5.8.3. Token Expiration 1623 Depending on the capabilities of the RS, there are various ways in 1624 which it can verify the expiration of a received access token. Here 1625 follows a list of the possibilities including what functionality they 1626 require of the RS. 1628 o The token is a CWT and includes an "exp" claim and possibly the 1629 "nbf" claim. The RS verifies these by comparing them to values 1630 from its internal clock as defined in [RFC7519]. In this case the 1631 RS's internal clock must reflect the current date and time, or at 1632 least be synchronized with the AS's clock. How this clock 1633 synchronization would be performed is out of scope for this 1634 specification. 1635 o The RS verifies the validity of the token by performing an 1636 introspection request as specified in Section 5.7. This requires 1637 the RS to have a reliable network connection to the AS and to be 1638 able to handle two secure sessions in parallel (C to RS and AS to 1639 RS). 1640 o In order to support token expiration for devices that have no 1641 reliable way of synchronizing their internal clocks, this 1642 specification defines the following approach: The claim "exi" 1643 ("expires in") can be used, to provide the RS with the lifetime of 1644 the token in seconds from the time the RS first receives the 1645 token. This approach is of course vulnerable to malicious clients 1646 holding back tokens they do not want to expire. Such an attack 1647 can only be prevented if the RS is able to communicate with the AS 1648 in some regular intervals, so that the can AS provide the RS with 1649 a list of expired tokens. The drawback of this mitigation is that 1650 the RS might as well use the communication with the AS to 1651 synchronize its internal clock. 1653 If a token that authorizes a long running request such as a CoAP 1654 Observe [RFC7641] expires, the RS MUST send an error response with 1655 the response code equivalent to the CoAP code 4.01 (Unauthorized) to 1656 the client and then terminate processing the long running request. 1658 6. Security Considerations 1660 Security considerations applicable to authentication and 1661 authorization in RESTful environments provided in OAuth 2.0 [RFC6749] 1662 apply to this work. Furthermore [RFC6819] provides additional 1663 security considerations for OAuth which apply to IoT deployments as 1664 well. If the introspection endpoint is used, the security 1665 considerations from [RFC7662] also apply. 1667 A large range of threats can be mitigated by protecting the contents 1668 of the access token by using a digital signature or a keyed message 1669 digest (MAC) or an Authenticated Encryption with Associated Data 1670 (AEAD) algorithm. Consequently, the token integrity protection MUST 1671 be applied to prevent the token from being modified, particularly 1672 since it contains a reference to the symmetric key or the asymmetric 1673 key. If the access token contains the symmetric key, this symmetric 1674 key MUST be encrypted by the authorization server so that only the 1675 resource server can decrypt it. Note that using an AEAD algorithm is 1676 preferable over using a MAC unless the message needs to be publicly 1677 readable. 1679 It is important for the authorization server to include the identity 1680 of the intended recipient (the audience), typically a single resource 1681 server (or a list of resource servers), in the token. Using a single 1682 shared secret with multiple resource servers to simplify key 1683 management is NOT RECOMMENDED since the benefit from using the proof- 1684 of-possession concept is significantly reduced. 1686 The authorization server MUST offer confidentiality protection for 1687 any interactions with the client. This step is extremely important 1688 since the client may obtain the proof-of-possession key from the 1689 authorization server for use with a specific access token. Not using 1690 confidentiality protection exposes this secret (and the access token) 1691 to an eavesdropper thereby completely negating proof-of-possession 1692 security. Profiles MUST specify how confidentiality protection is 1693 provided, and additional protection can be applied by encrypting the 1694 token, for example encryption of CWTs is specified in Section 5.1 of 1695 [RFC8392]. 1697 Developers MUST ensure that the ephemeral credentials (i.e., the 1698 private key or the session key) are not leaked to third parties. An 1699 adversary in possession of the ephemeral credentials bound to the 1700 access token will be able to impersonate the client. Be aware that 1701 this is a real risk with many constrained environments, since 1702 adversaries can often easily get physical access to the devices. 1703 This risk can also be mitigated to some extent by making sure that 1704 keys are refreshed more frequently. 1706 If clients are capable of doing so, they should frequently request 1707 fresh access tokens, as this allows the AS to keep the lifetime of 1708 the tokens short. This allows the AS to use shorter proof-of- 1709 possession key sizes, which translate to a performance benefit for 1710 the client and for the resource server. Shorter keys also lead to 1711 shorter messages (particularly with asymmetric keying material). 1713 When authorization servers bind symmetric keys to access tokens, they 1714 SHOULD scope these access tokens to a specific permission. 1716 6.1. Unprotected AS Information 1718 Initially, no secure channel exists to protect the communication 1719 between C and RS. Thus, C cannot determine if the AS information 1720 contained in an unprotected response from RS to an unauthorized 1721 request (see Section 5.1.2) is authentic. It is therefore advisable 1722 to provide C with a (possibly hard-coded) list of trustworthy 1723 authorization servers. AS information responses referring to a URI 1724 not listed there would be ignored. 1726 6.2. Minimal security requirements for communication 1728 This section summarizes the minimal requirements for the 1729 communication security of the different protocol interactions. 1731 C-AS All communication between the client and the Authorization 1732 Server MUST be encrypted, integrity and replay protected. 1733 Furthermore responses from the AS to the client MUST be bound to 1734 the client's request to avoid attacks where the attacker swaps the 1735 intended response for an older one valid for a previous request. 1736 This requires that the client and the Authorization Server have 1737 previously exchanged either a shared secret, or their public keys 1738 in order to negotiate a secure communication. Furthermore the 1739 client MUST be able to determine whether an AS has the authority 1740 to issue access tokens for a certain RS. This can be done through 1741 pre-configured lists, or through an online lookup mechanism that 1742 in turn also must be secured. 1743 RS-AS The communication between the Resource Server and the 1744 Authorization Server via the introspection endpoint MUST be 1745 encrypted, integrity and replay protected. Furthermore responses 1746 from the AS to the RS MUST be bound to the RS's request. This 1747 requires that the client and the Authorization Server have 1748 previously exchanged either a shared secret, or their public keys 1749 in order to negotiate a secure communication. Furthermore the RS 1750 MUST be able to determine whether an AS has the authority to issue 1751 access tokens itself. This is usually configured out of band, but 1752 could also be performed through an online lookup mechanism 1753 provided that it is also secured in the same way. 1754 C-RS The initial communication between the client and the Resource 1755 Server can not be secured in general, since the RS is not in 1756 possession of on access token for that client, which would carry 1757 the necessary parameters. Certain security mechanisms (e.g. DTLS 1758 with server-side authentication via a certificate or a raw public 1759 key) can be possible and are RECOMMEND if supported by both 1760 parties. After the client has successfully transmitted the access 1761 token to the RS, a secure communication protocol MUST be 1762 established between client and RS for the actual resource request. 1763 This protocol MUST provide encryption, integrity and replay 1764 protection as well as a binding between requests and responses. 1765 This requires that the client learned either the RS's public key 1766 or received a symmetric proof-of-possession key bound to the 1767 access token from the AS. The RS must have learned either the 1768 client's public key or a shared symmetric key from the claims in 1769 the token or an introspection request. Since ACE does not provide 1770 profile negotiation between C and RS, the client MUST have learned 1771 what profile the RS supports (e.g. from the AS or pre-configured) 1772 and initiate the communication accordingly. 1774 6.3. Use of Nonces for Replay Protection 1776 The RS may add a nonce to the AS Information message sent as a 1777 response to an unauthorized request to ensure freshness of an Access 1778 Token subsequently presented to RS. While a time-stamp of some 1779 granularity would be sufficient to protect against replay attacks, 1780 using randomized nonce is preferred to prevent disclosure of 1781 information about RS's internal clock characteristics. 1783 6.4. Combining profiles 1785 There may be use cases were different profiles of this framework are 1786 combined. For example, an MQTT-TLS profile is used between the 1787 client and the RS in combination with a CoAP-DTLS profile for 1788 interactions between the client and the AS. Ideally, profiles should 1789 be designed in a way that the security of system should not depend on 1790 the specific security mechanisms used in individual protocol 1791 interactions. 1793 6.5. Unprotected Information 1795 Communication with the authz-info endpoint, as well as the various 1796 error responses defined in this framework all potentially include 1797 sending information over an unprotected channel. These messages may 1798 leak information to an adversary. For example errors responses for 1799 requests to the Authorization Information endpoint can reveal 1800 information about an otherwise opaque access token to an adversary 1801 who has intercepted this token. 1803 As far as error messages are concerned, this framework is written 1804 under the assumption that, in general, the benefits of detailed error 1805 messages outweigh the risk due to information leakage. For 1806 particular use cases, where this assessment does not apply, detailed 1807 error messages can be replaced by more generic ones. 1809 In some scenarios it may be possible to protect the communication 1810 with the authz-info endpoint (e.g. through DTLS with only server-side 1811 authentication). In cases where this is not possible this framework 1812 RECOMMENDS to use encrypted CWTs or opaque references and need to be 1813 subjected to introspection by the RS. 1815 If the initial unauthorized resource request message (see 1816 Section 5.1.1) is used, the client MUST make sure that it is not 1817 sending sensitive content in this request. While GET and DELETE 1818 requests only reveal the target URI of the resource, while POST and 1819 PUT requests would reveal the whole payload of the intended 1820 operation. 1822 6.6. Denial of service against or with Introspection 1824 The optional introspection mechanism provided by OAuth and supported 1825 in the ACE framework allows for two types of attacks that need to be 1826 considered by implementers. 1828 First an attacker could perform a denial of service attack against 1829 the introspection endpoint at the AS in order to prevent validation 1830 of access tokens. To mitigate this attack, an RS that is configured 1831 to use introspection MUST NOT allow access based on a token for which 1832 it couln't reach the introspection endpoint. 1834 Second an attacker could use the fact that an RS performs 1835 introspection to perform a denial of service attack against that RS 1836 by repeatedly sending tokens to its authz-info endpoint that require 1837 an introspection call. RS can mitigate such attacks by implementing 1838 a rate limit on how many introspection requests they perform in a 1839 given time intervall and rejecting incoming requests to authz-info 1840 for a certain amount of time, when that rate limit has been reached. 1842 7. Privacy Considerations 1844 Implementers and users should be aware of the privacy implications of 1845 the different possible deployments of this framework. 1847 The AS is in a very central position and can potentially learn 1848 sensitive information about the clients requesting access tokens. If 1849 the client credentials grant is used, the AS can track what kind of 1850 access the client intends to perform. With other grants this can be 1851 prevented by the Resource Owner. To do so, the resource owner needs 1852 to bind the grants it issues to anonymous, ephemeral credentials that 1853 do not allow the AS to link different grants and thus different 1854 access token requests by the same client. 1856 If access tokens are only integrity protected and not encrypted, they 1857 may reveal information to attackers listening on the wire, or able to 1858 acquire the access tokens in some other way. In the case of CWTs the 1859 token may, e.g., reveal the audience, the scope and the confirmation 1860 method used by the client. The latter may reveal the identity of the 1861 device or application running the client. This may be linkable to 1862 the identity of the person using the client (if there is a person and 1863 not a machine-to-machine interaction). 1865 Clients using asymmetric keys for proof-of-possession should be aware 1866 of the consequences of using the same key pair for proof-of- 1867 possession towards different RSs. A set of colluding RSs or an 1868 attacker able to obtain the access tokens will be able to link the 1869 requests, or even to determine the client's identity. 1871 An unprotected response to an unauthorized request (see 1872 Section 5.1.2) may disclose information about RS and/or its existing 1873 relationship with C. It is advisable to include as little 1874 information as possible in an unencrypted response. Means of 1875 encrypting communication between C and RS already exist, more 1876 detailed information may be included with an error response to 1877 provide C with sufficient information to react on that particular 1878 error. 1880 8. IANA Considerations 1882 8.1. Authorization Server Information 1884 This specification establishes the IANA "ACE Authorization Server 1885 Information" registry. The registry has been created to use the 1886 "Expert Review Required" registration procedure [RFC8126]. It should 1887 be noted that, in addition to the expert review, some portions of the 1888 registry require a specification, potentially a Standards Track RFC, 1889 be supplied as well. 1891 The columns of the registry are: 1893 Name The name of the parameter 1894 CBOR Key CBOR map key for the parameter. Different ranges of values 1895 use different registration policies [RFC8126]. Integer values 1896 from -256 to 255 are designated as Standards Action. Integer 1897 values from -65536 to -257 and from 256 to 65535 are designated as 1898 Specification Required. Integer values greater than 65535 are 1899 designated as Expert Review. Integer values less than -65536 are 1900 marked as Private Use. 1901 Value Type The CBOR data types allowable for the values of this 1902 parameter. 1904 Reference This contains a pointer to the public specification of the 1905 grant type abbreviation, if one exists. 1907 This registry will be initially populated by the values in Figure 2. 1908 The Reference column for all of these entries will be this document. 1910 8.2. OAuth Extensions Error Registration 1912 This specification registers the following error values in the OAuth 1913 Extensions Error registry defined in [RFC6749]. 1915 o Error name: "unsupported_pop_key" 1916 o Error usage location: AS token endpoint error response 1917 o Related protocol extension: The ACE framework [this document] 1918 o Change Controller: IESG 1919 o Specification document(s): Section 5.6.3 of [this document] 1921 o Error name: "incompatible_profiles" 1922 o Error usage location: AS token endpoint error response 1923 o Related protocol extension: The ACE framework [this document] 1924 o Change Controller: IESG 1925 o Specification document(s): Section 5.6.3 of [this document] 1927 8.3. OAuth Error Code CBOR Mappings Registry 1929 This specification establishes the IANA "OAuth Error Code CBOR 1930 Mappings" registry. The registry has been created to use the "Expert 1931 Review Required" registration procedure [RFC8126]. It should be 1932 noted that, in addition to the expert review, some portions of the 1933 registry require a specification, potentially a Standards Track RFC, 1934 be supplied as well. 1936 The columns of the registry are: 1938 Name The OAuth Error Code name, refers to the name in Section 5.2. 1939 of [RFC6749], e.g., "invalid_request". 1940 CBOR Value CBOR abbreviation for this error code. Different ranges 1941 of values use different registration policies [RFC8126]. Integer 1942 values from -256 to 255 are designated as Standards Action. 1943 Integer values from -65536 to -257 and from 256 to 65535 are 1944 designated as Specification Required. Integer values greater than 1945 65535 are designated as Expert Review. Integer values less than 1946 -65536 are marked as Private Use. 1947 Reference This contains a pointer to the public specification of the 1948 grant type abbreviation, if one exists. 1950 This registry will be initially populated by the values in Figure 10. 1951 The Reference column for all of these entries will be this document. 1953 8.4. OAuth Grant Type CBOR Mappings 1955 This specification establishes the IANA "OAuth Grant Type CBOR 1956 Mappings" registry. The registry has been created to use the "Expert 1957 Review Required" registration procedure [RFC8126]. It should be 1958 noted that, in addition to the expert review, some portions of the 1959 registry require a specification, potentially a Standards Track RFC, 1960 be supplied as well. 1962 The columns of this registry are: 1964 Name The name of the grant type as specified in Section 1.3 of 1965 [RFC6749]. 1966 CBOR Value CBOR abbreviation for this grant type. Different ranges 1967 of values use different registration policies [RFC8126]. Integer 1968 values from -256 to 255 are designated as Standards Action. 1969 Integer values from -65536 to -257 and from 256 to 65535 are 1970 designated as Specification Required. Integer values greater than 1971 65535 are designated as Expert Review. Integer values less than 1972 -65536 are marked as Private Use. 1973 Reference This contains a pointer to the public specification of the 1974 grant type abbreviation, if one exists. 1975 Original Specification This contains a pointer to the public 1976 specification of the grant type, if one exists. 1978 This registry will be initially populated by the values in Figure 11. 1979 The Reference column for all of these entries will be this document. 1981 8.5. OAuth Access Token Types 1983 This section registers the following new token type in the "OAuth 1984 Access Token Types" registry [IANA.OAuthAccessTokenTypes]. 1986 o Name: "PoP" 1987 o Change Controller: IETF 1988 o Reference: [this document] 1990 8.6. OAuth Token Type CBOR Mappings 1992 This specification established the IANA "Token Type CBOR Mappings" 1993 registry. The registry has been created to use the "Expert Review 1994 Required" registration procedure [RFC8126]. It should be noted that, 1995 in addition to the expert review, some portions of the registry 1996 require a specification, potentially a Standards Track RFC, be 1997 supplied as well. 1999 The columns of this registry are: 2001 Name The name of token type as registered in the OAuth Access Token 2002 Types registry, e.g., "Bearer". 2003 CBOR Value CBOR abbreviation for this token type. Different ranges 2004 of values use different registration policies [RFC8126]. Integer 2005 values from -256 to 255 are designated as Standards Action. 2006 Integer values from -65536 to -257 and from 256 to 65535 are 2007 designated as Specification Required. Integer values greater than 2008 65535 are designated as Expert Review. Integer values less than 2009 -65536 are marked as Private Use. 2010 Reference This contains a pointer to the public specification of the 2011 OAuth token type abbreviation, if one exists. 2012 Original Specification This contains a pointer to the public 2013 specification of the grant type, if one exists. 2015 8.6.1. Initial Registry Contents 2017 o Name: "Bearer" 2018 o Value: 1 2019 o Reference: [this document] 2020 o Original Specification: [RFC6749] 2022 o Name: "pop" 2023 o Value: 2 2024 o Reference: [this document] 2025 o Original Specification: [this document] 2027 8.7. ACE Profile Registry 2029 This specification establishes the IANA "ACE Profile" registry. The 2030 registry has been created to use the "Expert Review Required" 2031 registration procedure [RFC8126]. It should be noted that, in 2032 addition to the expert review, some portions of the registry require 2033 a specification, potentially a Standards Track RFC, be supplied as 2034 well. 2036 The columns of this registry are: 2038 Name The name of the profile, to be used as value of the profile 2039 attribute. 2040 Description Text giving an overview of the profile and the context 2041 it is developed for. 2042 CBOR Value CBOR abbreviation for this profile name. Different 2043 ranges of values use different registration policies [RFC8126]. 2044 Integer values from -256 to 255 are designated as Standards 2045 Action. Integer values from -65536 to -257 and from 256 to 65535 2046 are designated as Specification Required. Integer values greater 2047 than 65535 are designated as Expert Review. Integer values less 2048 than -65536 are marked as Private Use. 2050 Reference This contains a pointer to the public specification of the 2051 profile abbreviation, if one exists. 2053 8.8. OAuth Parameter Registration 2055 This specification registers the following parameter in the "OAuth 2056 Parameters" registry [IANA.OAuthParameters]: 2058 o Name: "profile" 2059 o Parameter Usage Location: token response 2060 o Change Controller: IESG 2061 o Reference: Section 5.6.4.3 of [this document] 2063 8.9. Token Endpoint CBOR Mappings Registry 2065 This specification establishes the IANA "Token Endpoint CBOR 2066 Mappings" registry. The registry has been created to use the "Expert 2067 Review Required" registration procedure [RFC8126]. It should be 2068 noted that, in addition to the expert review, some portions of the 2069 registry require a specification, potentially a Standards Track RFC, 2070 be supplied as well. 2072 The columns of this registry are: 2074 Name The OAuth Parameter name, refers to the name in the OAuth 2075 parameter registry, e.g., "client_id". 2076 CBOR Key CBOR map key for this parameter. Different ranges of 2077 values use different registration policies [RFC8126]. Integer 2078 values from -256 to 255 are designated as Standards Action. 2079 Integer values from -65536 to -257 and from 256 to 65535 are 2080 designated as Specification Required. Integer values greater than 2081 65535 are designated as Expert Review. Integer values less than 2082 -65536 are marked as Private Use. 2083 Value Type The allowable CBOR data types for values of this 2084 parameter. 2085 Reference This contains a pointer to the public specification of the 2086 parameter abbreviation, if one exists. 2088 This registry will be initially populated by the values in Figure 12. 2089 The Reference column for all of these entries will be this document. 2091 Note that the mappings of parameters corresponding to claim names 2092 intentionally coincide with the CWT claim name mappings from 2093 [RFC8392]. 2095 8.10. OAuth Introspection Response Parameter Registration 2097 This specification registers the following parameter in the OAuth 2098 Token Introspection Response registry 2099 [IANA.TokenIntrospectionResponse]. 2101 o Name: "profile" 2102 o Description: The communication and communication security profile 2103 used between client and RS, as defined in ACE profiles. 2104 o Change Controller: IESG 2105 o Reference: Section 5.7.2 of [this document] 2107 8.11. Introspection Endpoint CBOR Mappings Registry 2109 This specification establishes the IANA "Introspection Endpoint CBOR 2110 Mappings" registry. The registry has been created to use the "Expert 2111 Review Required" registration procedure [RFC8126]. It should be 2112 noted that, in addition to the expert review, some portions of the 2113 registry require a specification, potentially a Standards Track RFC, 2114 be supplied as well. 2116 The columns of this registry are: 2118 Name The OAuth Parameter name, refers to the name in the OAuth 2119 parameter registry, e.g., "client_id". 2120 CBOR Key CBOR map key for this parameter. Different ranges of 2121 values use different registration policies [RFC8126]. Integer 2122 values from -256 to 255 are designated as Standards Action. 2123 Integer values from -65536 to -257 and from 256 to 65535 are 2124 designated as Specification Required. Integer values greater than 2125 65535 are designated as Expert Review. Integer values less than 2126 -65536 are marked as Private Use. 2127 Value Type The allowable CBOR data types for values of this 2128 parameter. 2129 Reference This contains a pointer to the public specification of the 2130 grant type abbreviation, if one exists. 2132 This registry will be initially populated by the values in Figure 16. 2133 The Reference column for all of these entries will be this document. 2135 Note that the mappings of parameters corresponding to claim names 2136 intentionally coincide with the CWT claim name mappings from 2137 [RFC8392]. 2139 8.12. JSON Web Token Claims 2141 This specification registers the following new claims in the JSON Web 2142 Token (JWT) registry of JSON Web Token Claims 2143 [IANA.JsonWebTokenClaims]: 2145 o Claim Name: "scope" 2146 o Claim Description: The scope of an access token as defined in 2147 [RFC6749]. 2148 o Change Controller: IESG 2149 o Reference: Section 5.8 of [this document] 2151 o Claim Name: "profile" 2152 o Claim Description: The profile a token is supposed to be used 2153 with. 2154 o Change Controller: IESG 2155 o Reference: Section 5.8 of [this document] 2157 o Claim Name: "exi" 2158 o Claim Description: "Expires in". Lifetime of the token in seconds 2159 from the time the RS first sees it. Used to implement a weaker 2160 from of token expiration for devices that cannot synchronize their 2161 internal clocks. 2162 o Change Controller: IESG 2163 o Reference: Section 5.8.3 of [this document] 2165 8.13. CBOR Web Token Claims 2167 This specification registers the following new claims in the "CBOR 2168 Web Token (CWT) Claims" registry [IANA.CborWebTokenClaims]. 2170 o Claim Name: "scope" 2171 o Claim Description: The scope of an access token as defined in 2172 [RFC6749]. 2173 o JWT Claim Name: N/A 2174 o Claim Key: TBD (suggested: 9) 2175 o Claim Value Type(s): byte string or text string 2176 o Change Controller: IESG 2177 o Specification Document(s): Section 5.8 of [this document] 2179 o Claim Name: "profile" 2180 o Claim Description: The profile a token is supposed to be used 2181 with. 2182 o JWT Claim Name: N/A 2183 o Claim Key: TBD (suggested: 39) 2184 o Claim Value Type(s): integer 2185 o Change Controller: IESG 2186 o Specification Document(s): Section 5.8 of [this document] 2187 o Claim Name: "exi" 2188 o Claim Description: The expiration time of a token measured from 2189 when it was received at the RS in seconds. 2190 o JWT Claim Name: N/A 2191 o Claim Key: TBD (suggested: 41) 2192 o Claim Value Type(s): integer 2193 o Change Controller: IESG 2194 o Specification Document(s): Section 5.8 of [this document] 2196 8.14. Media Type Registrations 2198 This specification registers the 'application/ace+cbor' media type 2199 for messages of the protocols defined in this document carrying 2200 parameters encoded in CBOR. This registration follows the procedures 2201 specified in [RFC6838]. 2203 Type name: application 2205 Subtype name: ace+cbor 2207 Required parameters: none 2209 Optional parameters: none 2211 Encoding considerations: Must be encoded as CBOR map containing the 2212 protocol parameters defined in [this document]. 2214 Security considerations: See Section 6 of this document. 2216 Interoperability considerations: n/a 2218 Published specification: [this document] 2220 Applications that use this media type: The type is used by 2221 authorization servers, clients and resource servers that support the 2222 ACE framework as specified in [this document]. 2224 Additional information: 2226 Magic number(s): n/a 2228 File extension(s): .ace 2230 Macintosh file type code(s): n/a 2232 Person & email address to contact for further information: Ludwig 2233 Seitz 2234 Intended usage: COMMON 2236 Restrictions on usage: None 2238 Author: Ludwig Seitz 2240 Change controller: IESG 2242 8.15. CoAP Content-Format Registry 2244 This specification registers the following entry to the "CoAP 2245 Content-Formats" registry: 2247 Media Type: application/ace+cbor 2249 Encoding 2251 ID: 19 2253 Reference: [this document] 2255 9. Acknowledgments 2257 This document is a product of the ACE working group of the IETF. 2259 Thanks to Eve Maler for her contributions to the use of OAuth 2.0 and 2260 UMA in IoT scenarios, Robert Taylor for his discussion input, and 2261 Malisa Vucinic for his input on the predecessors of this proposal. 2263 Thanks to the authors of draft-ietf-oauth-pop-key-distribution, from 2264 where large parts of the security considerations where copied. 2266 Thanks to Stefanie Gerdes, Olaf Bergmann, and Carsten Bormann for 2267 contributing their work on AS discovery from draft-gerdes-ace-dcaf- 2268 authorize (see Section 5.1). 2270 Thanks to Jim Schaad and Mike Jones for their comprehensive reviews. 2272 Thanks to Benjamin Kaduk for his input on various questions related 2273 to this work. 2275 Ludwig Seitz and Goeran Selander worked on this document as part of 2276 the CelticPlus project CyberWI, with funding from Vinnova. 2278 10. References 2280 10.1. Normative References 2282 [I-D.ietf-ace-cwt-proof-of-possession] 2283 Jones, M., Seitz, L., Selander, G., Erdtman, S., and H. 2284 Tschofenig, "Proof-of-Possession Key Semantics for CBOR 2285 Web Tokens (CWTs)", draft-ietf-ace-cwt-proof-of- 2286 possession-05 (work in progress), November 2018. 2288 [I-D.ietf-ace-oauth-params] 2289 Seitz, L., "Additional OAuth Parameters for Authorization 2290 in Constrained Environments (ACE)", draft-ietf-ace-oauth- 2291 params-01 (work in progress), November 2018. 2293 [IANA.CborWebTokenClaims] 2294 IANA, "CBOR Web Token (CWT) Claims", 2295 . 2298 [IANA.JsonWebTokenClaims] 2299 IANA, "JSON Web Token Claims", 2300 . 2302 [IANA.OAuthAccessTokenTypes] 2303 IANA, "OAuth Access Token Types", 2304 . 2307 [IANA.OAuthParameters] 2308 IANA, "OAuth Parameters", 2309 . 2312 [IANA.TokenIntrospectionResponse] 2313 IANA, "OAuth Token Introspection Response", 2314 . 2317 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2318 Requirement Levels", BCP 14, RFC 2119, 2319 DOI 10.17487/RFC2119, March 1997, . 2322 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2323 Resource Identifier (URI): Generic Syntax", STD 66, 2324 RFC 3986, DOI 10.17487/RFC3986, January 2005, 2325 . 2327 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 2328 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 2329 January 2012, . 2331 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 2332 RFC 6749, DOI 10.17487/RFC6749, October 2012, 2333 . 2335 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 2336 Framework: Bearer Token Usage", RFC 6750, 2337 DOI 10.17487/RFC6750, October 2012, . 2340 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 2341 Specifications and Registration Procedures", BCP 13, 2342 RFC 6838, DOI 10.17487/RFC6838, January 2013, 2343 . 2345 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2346 Application Protocol (CoAP)", RFC 7252, 2347 DOI 10.17487/RFC7252, June 2014, . 2350 [RFC7662] Richer, J., Ed., "OAuth 2.0 Token Introspection", 2351 RFC 7662, DOI 10.17487/RFC7662, October 2015, 2352 . 2354 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2355 Writing an IANA Considerations Section in RFCs", BCP 26, 2356 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2357 . 2359 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 2360 RFC 8152, DOI 10.17487/RFC8152, July 2017, 2361 . 2363 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2364 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2365 May 2017, . 2367 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 2368 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 2369 May 2018, . 2371 10.2. Informative References 2373 [I-D.erdtman-ace-rpcc] 2374 Seitz, L. and S. Erdtman, "Raw-Public-Key and Pre-Shared- 2375 Key as OAuth client credentials", draft-erdtman-ace- 2376 rpcc-02 (work in progress), October 2017. 2378 [I-D.ietf-core-object-security] 2379 Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 2380 "Object Security for Constrained RESTful Environments 2381 (OSCORE)", draft-ietf-core-object-security-15 (work in 2382 progress), August 2018. 2384 [I-D.ietf-core-too-many-reqs] 2385 Keranen, A., "Too Many Requests Response Code for the 2386 Constrained Application Protocol", draft-ietf-core-too- 2387 many-reqs-06 (work in progress), November 2018. 2389 [I-D.ietf-oauth-device-flow] 2390 Denniss, W., Bradley, J., Jones, M., and H. Tschofenig, 2391 "OAuth 2.0 Device Flow for Browserless and Input 2392 Constrained Devices", draft-ietf-oauth-device-flow-13 2393 (work in progress), October 2018. 2395 [I-D.ietf-tls-dtls13] 2396 Rescorla, E., Tschofenig, H., and N. Modadugu, "The 2397 Datagram Transport Layer Security (DTLS) Protocol Version 2398 1.3", draft-ietf-tls-dtls13-30 (work in progress), 2399 November 2018. 2401 [Margi10impact] 2402 Margi, C., de Oliveira, B., de Sousa, G., Simplicio Jr, 2403 M., Barreto, P., Carvalho, T., Naeslund, M., and R. Gold, 2404 "Impact of Operating Systems on Wireless Sensor Networks 2405 (Security) Applications and Testbeds", Proceedings of 2406 the 19th International Conference on Computer 2407 Communications and Networks (ICCCN), 2010 August. 2409 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 2410 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 2411 . 2413 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2414 (TLS) Protocol Version 1.2", RFC 5246, 2415 DOI 10.17487/RFC5246, August 2008, . 2418 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2419 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2420 . 2422 [RFC6819] Lodderstedt, T., Ed., McGloin, M., and P. Hunt, "OAuth 2.0 2423 Threat Model and Security Considerations", RFC 6819, 2424 DOI 10.17487/RFC6819, January 2013, . 2427 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 2428 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 2429 October 2013, . 2431 [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for 2432 Constrained-Node Networks", RFC 7228, 2433 DOI 10.17487/RFC7228, May 2014, . 2436 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2437 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 2438 DOI 10.17487/RFC7231, June 2014, . 2441 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 2442 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 2443 . 2445 [RFC7521] Campbell, B., Mortimore, C., Jones, M., and Y. Goland, 2446 "Assertion Framework for OAuth 2.0 Client Authentication 2447 and Authorization Grants", RFC 7521, DOI 10.17487/RFC7521, 2448 May 2015, . 2450 [RFC7591] Richer, J., Ed., Jones, M., Bradley, J., Machulak, M., and 2451 P. Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", 2452 RFC 7591, DOI 10.17487/RFC7591, July 2015, 2453 . 2455 [RFC7641] Hartke, K., "Observing Resources in the Constrained 2456 Application Protocol (CoAP)", RFC 7641, 2457 DOI 10.17487/RFC7641, September 2015, . 2460 [RFC7744] Seitz, L., Ed., Gerdes, S., Ed., Selander, G., Mani, M., 2461 and S. Kumar, "Use Cases for Authentication and 2462 Authorization in Constrained Environments", RFC 7744, 2463 DOI 10.17487/RFC7744, January 2016, . 2466 [RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in 2467 the Constrained Application Protocol (CoAP)", RFC 7959, 2468 DOI 10.17487/RFC7959, August 2016, . 2471 [RFC8252] Denniss, W. and J. Bradley, "OAuth 2.0 for Native Apps", 2472 BCP 212, RFC 8252, DOI 10.17487/RFC8252, October 2017, 2473 . 2475 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 2476 Interchange Format", STD 90, RFC 8259, 2477 DOI 10.17487/RFC8259, December 2017, . 2480 [RFC8414] Jones, M., Sakimura, N., and J. Bradley, "OAuth 2.0 2481 Authorization Server Metadata", RFC 8414, 2482 DOI 10.17487/RFC8414, June 2018, . 2485 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 2486 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 2487 . 2489 Appendix A. Design Justification 2491 This section provides further insight into the design decisions of 2492 the solution documented in this document. Section 3 lists several 2493 building blocks and briefly summarizes their importance. The 2494 justification for offering some of those building blocks, as opposed 2495 to using OAuth 2.0 as is, is given below. 2497 Common IoT constraints are: 2499 Low Power Radio: 2501 Many IoT devices are equipped with a small battery which needs to 2502 last for a long time. For many constrained wireless devices, the 2503 highest energy cost is associated to transmitting or receiving 2504 messages (roughly by a factor of 10 compared to AES) 2505 [Margi10impact]. It is therefore important to keep the total 2506 communication overhead low, including minimizing the number and 2507 size of messages sent and received, which has an impact of choice 2508 on the message format and protocol. By using CoAP over UDP and 2509 CBOR encoded messages, some of these aspects are addressed. 2510 Security protocols contribute to the communication overhead and 2511 can, in some cases, be optimized. For example, authentication and 2512 key establishment may, in certain cases where security 2513 requirements allow, be replaced by provisioning of security 2514 context by a trusted third party, using transport or application 2515 layer security. 2517 Low CPU Speed: 2519 Some IoT devices are equipped with processors that are 2520 significantly slower than those found in most current devices on 2521 the Internet. This typically has implications on what timely 2522 cryptographic operations a device is capable of performing, which 2523 in turn impacts, e.g., protocol latency. Symmetric key 2524 cryptography may be used instead of the computationally more 2525 expensive public key cryptography where the security requirements 2526 so allows, but this may also require support for trusted third 2527 party assisted secret key establishment using transport or 2528 application layer security. 2529 Small Amount of Memory: 2531 Microcontrollers embedded in IoT devices are often equipped with 2532 small amount of RAM and flash memory, which places limitations 2533 what kind of processing can be performed and how much code can be 2534 put on those devices. To reduce code size fewer and smaller 2535 protocol implementations can be put on the firmware of such a 2536 device. In this case, CoAP may be used instead of HTTP, symmetric 2537 key cryptography instead of public key cryptography, and CBOR 2538 instead of JSON. Authentication and key establishment protocol, 2539 e.g., the DTLS handshake, in comparison with assisted key 2540 establishment also has an impact on memory and code. 2542 User Interface Limitations: 2544 Protecting access to resources is both an important security as 2545 well as privacy feature. End users and enterprise customers may 2546 not want to give access to the data collected by their IoT device 2547 or to functions it may offer to third parties. Since the 2548 classical approach of requesting permissions from end users via a 2549 rich user interface does not work in many IoT deployment 2550 scenarios, these functions need to be delegated to user-controlled 2551 devices that are better suitable for such tasks, such as smart 2552 phones and tablets. 2554 Communication Constraints: 2556 In certain constrained settings an IoT device may not be able to 2557 communicate with a given device at all times. Devices may be 2558 sleeping, or just disconnected from the Internet because of 2559 general lack of connectivity in the area, for cost reasons, or for 2560 security reasons, e.g., to avoid an entry point for Denial-of- 2561 Service attacks. 2563 The communication interactions this framework builds upon (as 2564 shown graphically in Figure 1) may be accomplished using a variety 2565 of different protocols, and not all parts of the message flow are 2566 used in all applications due to the communication constraints. 2567 Deployments making use of CoAP are expected, but not limited to, 2568 other protocols such as HTTP, HTTP/2 or other specific protocols, 2569 such as Bluetooth Smart communication, that do not necessarily use 2570 IP could also be used. The latter raises the need for application 2571 layer security over the various interfaces. 2573 In the light of these constraints we have made the following design 2574 decisions: 2576 CBOR, COSE, CWT: 2578 This framework RECOMMENDS the use of CBOR [RFC7049] as data 2579 format. Where CBOR data needs to be protected, the use of COSE 2580 [RFC8152] is RECOMMENDED. Furthermore where self-contained tokens 2581 are needed, this framework RECOMMENDS the use of CWT [RFC8392]. 2582 These measures aim at reducing the size of messages sent over the 2583 wire, the RAM size of data objects that need to be kept in memory 2584 and the size of libraries that devices need to support. 2586 CoAP: 2588 This framework RECOMMENDS the use of CoAP [RFC7252] instead of 2589 HTTP. This does not preclude the use of other protocols 2590 specifically aimed at constrained devices, like, e.g., Bluetooth 2591 Low Energy (see Section 3.2). This aims again at reducing the 2592 size of messages sent over the wire, the RAM size of data objects 2593 that need to be kept in memory and the size of libraries that 2594 devices need to support. 2596 Access Information: 2598 This framework defines the name "Access Information" for data 2599 concerning the RS that the AS returns to the client in an access 2600 token response (see Section 5.6.2). This aims at enabling 2601 scenarios, where a powerful client, supporting multiple profiles, 2602 needs to interact with a RS for which it does not know the 2603 supported profiles and the raw public key. 2605 Proof-of-Possession: 2607 This framework makes use of proof-of-possession tokens, using the 2608 "cnf" claim [I-D.ietf-ace-cwt-proof-of-possession]. A 2609 semantically and syntactically identical request and response 2610 parameter is defined for the token endpoint, to allow requesting 2611 and stating confirmation keys. This aims at making token theft 2612 harder. Token theft is specifically relevant in constrained use 2613 cases, as communication often passes through middle-boxes, which 2614 could be able to steal bearer tokens and use them to gain 2615 unauthorized access. 2617 Auth-Info endpoint: 2619 This framework introduces a new way of providing access tokens to 2620 a RS by exposing a authz-info endpoint, to which access tokens can 2621 be POSTed. This aims at reducing the size of the request message 2622 and the code complexity at the RS. The size of the request 2623 message is problematic, since many constrained protocols have 2624 severe message size limitations at the physical layer (e.g., in 2625 the order of 100 bytes). This means that larger packets get 2626 fragmented, which in turn combines badly with the high rate of 2627 packet loss, and the need to retransmit the whole message if one 2628 packet gets lost. Thus separating sending of the request and 2629 sending of the access tokens helps to reduce fragmentation. 2631 Client Credentials Grant: 2633 This framework RECOMMENDS the use of the client credentials grant 2634 for machine-to-machine communication use cases, where manual 2635 intervention of the resource owner to produce a grant token is not 2636 feasible. The intention is that the resource owner would instead 2637 pre-arrange authorization with the AS, based on the client's own 2638 credentials. The client can then (without manual intervention) 2639 obtain access tokens from the AS. 2641 Introspection: 2643 This framework RECOMMENDS the use of access token introspection in 2644 cases where the client is constrained in a way that it can not 2645 easily obtain new access tokens (i.e. it has connectivity issues 2646 that prevent it from communicating with the AS). In that case 2647 this framework RECOMMENDS the use of a long-term token, that could 2648 be a simple reference. The RS is assumed to be able to 2649 communicate with the AS, and can therefore perform introspection, 2650 in order to learn the claims associated with the token reference. 2651 The advantage of such an approach is that the resource owner can 2652 change the claims associated to the token reference without having 2653 to be in contact with the client, thus granting or revoking access 2654 rights. 2656 Appendix B. Roles and Responsibilities 2658 Resource Owner 2660 * Make sure that the RS is registered at the AS. This includes 2661 making known to the AS which profiles, token_types, scopes, and 2662 key types (symmetric/asymmetric) the RS supports. Also making 2663 it known to the AS which audience(s) the RS identifies itself 2664 with. 2665 * Make sure that clients can discover the AS that is in charge of 2666 the RS. 2667 * If the client-credentials grant is used, make sure that the AS 2668 has the necessary, up-to-date, access control policies for the 2669 RS. 2671 Requesting Party 2673 * Make sure that the client is provisioned the necessary 2674 credentials to authenticate to the AS. 2675 * Make sure that the client is configured to follow the security 2676 requirements of the Requesting Party when issuing requests 2677 (e.g., minimum communication security requirements, trust 2678 anchors). 2679 * Register the client at the AS. This includes making known to 2680 the AS which profiles, token_types, and key types (symmetric/ 2681 asymmetric) the client. 2683 Authorization Server 2685 * Register the RS and manage corresponding security contexts. 2686 * Register clients and authentication credentials. 2687 * Allow Resource Owners to configure and update access control 2688 policies related to their registered RSs. 2689 * Expose the token endpoint to allow clients to request tokens. 2690 * Authenticate clients that wish to request a token. 2691 * Process a token request using the authorization policies 2692 configured for the RS. 2693 * Optionally: Expose the introspection endpoint that allows RS's 2694 to submit token introspection requests. 2695 * If providing an introspection endpoint: Authenticate RSs that 2696 wish to get an introspection response. 2697 * If providing an introspection endpoint: Process token 2698 introspection requests. 2699 * Optionally: Handle token revocation. 2700 * Optionally: Provide discovery metadata. See [RFC8414] 2701 * Optionally: Handle refresh tokens. 2703 Client 2704 * Discover the AS in charge of the RS that is to be targeted with 2705 a request. 2706 * Submit the token request (see step (A) of Figure 1). 2708 + Authenticate to the AS. 2709 + Optionally (if not pre-configured): Specify which RS, which 2710 resource(s), and which action(s) the request(s) will target. 2711 + If raw public keys (rpk) or certificates are used, make sure 2712 the AS has the right rpk or certificate for this client. 2713 * Process the access token and Access Information (see step (B) 2714 of Figure 1). 2716 + Check that the Access Information provides the necessary 2717 security parameters (e.g., PoP key, information on 2718 communication security protocols supported by the RS). 2719 + Safely store the proof-of-possession key. 2720 + If provided by the AS: Safely store the refresh token. 2721 * Send the token and request to the RS (see step (C) of 2722 Figure 1). 2724 + Authenticate towards the RS (this could coincide with the 2725 proof of possession process). 2726 + Transmit the token as specified by the AS (default is to the 2727 authz-info endpoint, alternative options are specified by 2728 profiles). 2729 + Perform the proof-of-possession procedure as specified by 2730 the profile in use (this may already have been taken care of 2731 through the authentication procedure). 2732 * Process the RS response (see step (F) of Figure 1) of the RS. 2734 Resource Server 2736 * Expose a way to submit access tokens. By default this is the 2737 authz-info endpoint. 2738 * Process an access token. 2740 + Verify the token is from a recognized AS. 2741 + Verify that the token applies to this RS. 2742 + Check that the token has not expired (if the token provides 2743 expiration information). 2744 + Check the token's integrity. 2745 + Store the token so that it can be retrieved in the context 2746 of a matching request. 2747 * Process a request. 2749 + Set up communication security with the client. 2750 + Authenticate the client. 2751 + Match the client against existing tokens. 2753 + Check that tokens belonging to the client actually authorize 2754 the requested action. 2755 + Optionally: Check that the matching tokens are still valid, 2756 using introspection (if this is possible.) 2757 * Send a response following the agreed upon communication 2758 security. 2759 * Safely store credentials such as raw public keys for 2760 authentication or proof-of-possession keys linked to access 2761 tokens. 2763 Appendix C. Requirements on Profiles 2765 This section lists the requirements on profiles of this framework, 2766 for the convenience of profile designers. 2768 o Specify the communication protocol the client and RS the must use 2769 (e.g., CoAP). Section 5 and Section 5.6.4.3 2770 o Specify the security protocol the client and RS must use to 2771 protect their communication (e.g., OSCORE or DTLS over CoAP). 2772 This must provide encryption, integrity and replay protection. 2773 Section 5.6.4.3 2774 o Specify how the client and the RS mutually authenticate. 2775 Section 4 2776 o Specify the proof-of-possession protocol(s) and how to select one, 2777 if several are available. Also specify which key types (e.g., 2778 symmetric/asymmetric) are supported by a specific proof-of- 2779 possession protocol. Section 5.6.4.2 2780 o Specify a unique profile identifier. Section 5.6.4.3 2781 o If introspection is supported: Specify the communication and 2782 security protocol for introspection. Section 5.7 2783 o Specify the communication and security protocol for interactions 2784 between client and AS. This must provide encryption, integrity 2785 protection, replay protection and a binding between requests and 2786 responses. Section 5 and Section 5.6 2787 o Specify how/if the authz-info endpoint is protected, including how 2788 error responses are protected. Section 5.8.1 2789 o Optionally define other methods of token transport than the authz- 2790 info endpoint. Section 5.8.1 2792 Appendix D. Assumptions on AS knowledge about C and RS 2794 This section lists the assumptions on what an AS should know about a 2795 client and a RS in order to be able to respond to requests to the 2796 token and introspection endpoints. How this information is 2797 established is out of scope for this document. 2799 o The identifier of the client or RS. 2800 o The profiles that the client or RS supports. 2802 o The scopes that the RS supports. 2803 o The audiences that the RS identifies with. 2804 o The key types (e.g., pre-shared symmetric key, raw public key, key 2805 length, other key parameters) that the client or RS supports. 2806 o The types of access tokens the RS supports (e.g., CWT). 2807 o If the RS supports CWTs, the COSE parameters for the crypto 2808 wrapper (e.g., algorithm, key-wrap algorithm, key-length). 2809 o The expiration time for access tokens issued to this RS (unless 2810 the RS accepts a default time chosen by the AS). 2811 o The symmetric key shared between client or RS and AS (if any). 2812 o The raw public key of the client or RS (if any). 2813 o Whether the RS has synchronized time (and thus is able to use the 2814 'exp' claim) or not. 2816 Appendix E. Deployment Examples 2818 There is a large variety of IoT deployments, as is indicated in 2819 Appendix A, and this section highlights a few common variants. This 2820 section is not normative but illustrates how the framework can be 2821 applied. 2823 For each of the deployment variants, there are a number of possible 2824 security setups between clients, resource servers and authorization 2825 servers. The main focus in the following subsections is on how 2826 authorization of a client request for a resource hosted by a RS is 2827 performed. This requires the security of the requests and responses 2828 between the clients and the RS to consider. 2830 Note: CBOR diagnostic notation is used for examples of requests and 2831 responses. 2833 E.1. Local Token Validation 2835 In this scenario, the case where the resource server is offline is 2836 considered, i.e., it is not connected to the AS at the time of the 2837 access request. This access procedure involves steps A, B, C, and F 2838 of Figure 1. 2840 Since the resource server must be able to verify the access token 2841 locally, self-contained access tokens must be used. 2843 This example shows the interactions between a client, the 2844 authorization server and a temperature sensor acting as a resource 2845 server. Message exchanges A and B are shown in Figure 17. 2847 A: The client first generates a public-private key pair used for 2848 communication security with the RS. 2850 The client sends the POST request to the token endpoint at the AS. 2851 The security of this request can be transport or application 2852 layer. It is up the the communication security profile to define. 2853 In the example transport layer identification of the AS is done 2854 and the client identifies with client_id and client_secret as in 2855 classic OAuth. The request contains the public key of the client 2856 and the Audience parameter set to "tempSensorInLivingRoom", a 2857 value that the temperature sensor identifies itself with. The AS 2858 evaluates the request and authorizes the client to access the 2859 resource. 2860 B: The AS responds with a PoP access token and Access Information. 2861 The PoP access token contains the public key of the client, and 2862 the Access Information contains the public key of the RS. For 2863 communication security this example uses DTLS RawPublicKey between 2864 the client and the RS. The issued token will have a short 2865 validity time, i.e., "exp" close to "iat", to protect the RS from 2866 replay attacks. The token includes the claim such as "scope" with 2867 the authorized access that an owner of the temperature device can 2868 enjoy. In this example, the "scope" claim, issued by the AS, 2869 informs the RS that the owner of the token, that can prove the 2870 possession of a key is authorized to make a GET request against 2871 the /temperature resource and a POST request on the /firmware 2872 resource. Note that the syntax and semantics of the scope claim 2873 are application specific. 2874 Note: In this example it is assumed that the client knows what 2875 resource it wants to access, and is therefore able to request 2876 specific audience and scope claims for the access token. 2878 Authorization 2879 Client Server 2880 | | 2881 |<=======>| DTLS Connection Establishment 2882 | | to identify the AS 2883 | | 2884 A: +-------->| Header: POST (Code=0.02) 2885 | POST | Uri-Path:"token" 2886 | | Content-Format: application/ace+cbor 2887 | | Payload: 2888 | | 2889 B: |<--------+ Header: 2.05 Content 2890 | 2.05 | Content-Format: application/ace+cbor 2891 | | Payload: 2892 | | 2894 Figure 17: Token Request and Response Using Client Credentials. 2896 The information contained in the Request-Payload and the Response- 2897 Payload is shown in Figure 18 Note that the parameter "rs_cnf" from 2899 [I-D.ietf-ace-oauth-params] is used to inform the client about the 2900 resource server's public key. 2902 Request-Payload : 2903 { 2904 "grant_type" : "client_credentials", 2905 "req_aud" : "tempSensorInLivingRoom", 2906 "client_id" : "myclient", 2907 "client_secret" : "qwerty" 2908 "req_cnf" : { 2909 "COSE_Key" : { 2910 "kid" : b64'1Bg8vub9tLe1gHMzV76e8', 2911 "kty" : "EC", 2912 "crv" : "P-256", 2913 "x" : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU', 2914 "y" : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0' 2915 } 2916 } 2917 } 2919 Response-Payload : 2920 { 2921 "access_token" : b64'SlAV32hkKG ...', 2922 "token_type" : "pop", 2923 "rs_cnf" : { 2924 "COSE_Key" : { 2925 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk', 2926 "kty" : "EC", 2927 "crv" : "P-256", 2928 "x" : b64'MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4', 2929 "y" : b64'4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM' 2930 } 2931 } 2932 } 2934 Figure 18: Request and Response Payload Details. 2936 The content of the access token is shown in Figure 19. 2938 { 2939 "aud" : "tempSensorInLivingRoom", 2940 "iat" : "1360189224", 2941 "exp" : "1360289224", 2942 "scope" : "temperature_g firmware_p", 2943 "cnf" : { 2944 "COSE_Key" : { 2945 "kid" : b64'1Bg8vub9tLe1gHMzV76e8', 2946 "kty" : "EC", 2947 "crv" : "P-256", 2948 "x" : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU', 2949 "y" : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0' 2950 } 2951 } 2952 } 2954 Figure 19: Access Token including Public Key of the Client. 2956 Messages C and F are shown in Figure 20 - Figure 21. 2958 C: The client then sends the PoP access token to the authz-info 2959 endpoint at the RS. This is a plain CoAP request, i.e., no 2960 transport or application layer security is used between client and 2961 RS since the token is integrity protected between the AS and RS. 2962 The RS verifies that the PoP access token was created by a known 2963 and trusted AS, is valid, and has been issued to the client. The 2964 RS caches the security context together with authorization 2965 information about this client contained in the PoP access token. 2967 Resource 2968 Client Server 2969 | | 2970 C: +-------->| Header: POST (Code=0.02) 2971 | POST | Uri-Path:"authz-info" 2972 | | Payload: SlAV32hkKG ... 2973 | | 2974 |<--------+ Header: 2.04 Changed 2975 | 2.04 | 2976 | | 2978 Figure 20: Access Token provisioning to RS 2979 The client and the RS runs the DTLS handshake using the raw public 2980 keys established in step B and C. 2981 The client sends the CoAP request GET to /temperature on RS over 2982 DTLS. The RS verifies that the request is authorized, based on 2983 previously established security context. 2984 F: The RS responds with a resource representation over DTLS. 2986 Resource 2987 Client Server 2988 | | 2989 |<=======>| DTLS Connection Establishment 2990 | | using Raw Public Keys 2991 | | 2992 +-------->| Header: GET (Code=0.01) 2993 | GET | Uri-Path: "temperature" 2994 | | 2995 | | 2996 | | 2997 F: |<--------+ Header: 2.05 Content 2998 | 2.05 | Payload: 2999 | | 3001 Figure 21: Resource Request and Response protected by DTLS. 3003 E.2. Introspection Aided Token Validation 3005 In this deployment scenario it is assumed that a client is not able 3006 to access the AS at the time of the access request, whereas the RS is 3007 assumed to be connected to the back-end infrastructure. Thus the RS 3008 can make use of token introspection. This access procedure involves 3009 steps A-F of Figure 1, but assumes steps A and B have been carried 3010 out during a phase when the client had connectivity to AS. 3012 Since the client is assumed to be offline, at least for a certain 3013 period of time, a pre-provisioned access token has to be long-lived. 3014 Since the client is constrained, the token will not be self contained 3015 (i.e. not a CWT) but instead just a reference. The resource server 3016 uses its connectivity to learn about the claims associated to the 3017 access token by using introspection, which is shown in the example 3018 below. 3020 In the example interactions between an offline client (key fob), a RS 3021 (online lock), and an AS is shown. It is assumed that there is a 3022 provisioning step where the client has access to the AS. This 3023 corresponds to message exchanges A and B which are shown in 3024 Figure 22. 3026 Authorization consent from the resource owner can be pre-configured, 3027 but it can also be provided via an interactive flow with the resource 3028 owner. An example of this for the key fob case could be that the 3029 resource owner has a connected car, he buys a generic key that he 3030 wants to use with the car. To authorize the key fob he connects it 3031 to his computer that then provides the UI for the device. After that 3032 OAuth 2.0 implicit flow can used to authorize the key for his car at 3033 the the car manufacturers AS. 3035 Note: In this example the client does not know the exact door it will 3036 be used to access since the token request is not send at the time of 3037 access. So the scope and audience parameters are set quite wide to 3038 start with and new values different form the original once can be 3039 returned from introspection later on. 3041 A: The client sends the request using POST to the token endpoint 3042 at AS. The request contains the Audience parameter set to 3043 "PACS1337" (PACS, Physical Access System), a value the that the 3044 online door in question identifies itself with. The AS generates 3045 an access token as an opaque string, which it can match to the 3046 specific client, a targeted audience and a symmetric key. The 3047 security is provided by identifying the AS on transport layer 3048 using a pre shared security context (psk, rpk or certificate) and 3049 then the client is identified using client_id and client_secret as 3050 in classic OAuth. 3051 B: The AS responds with the an access token and Access 3052 Information, the latter containing a symmetric key. Communication 3053 security between C and RS will be DTLS and PreSharedKey. The PoP 3054 key is used as the PreSharedKey. 3056 Authorization 3057 Client Server 3058 | | 3059 | | 3060 A: +-------->| Header: POST (Code=0.02) 3061 | POST | Uri-Path:"token" 3062 | | Content-Format: application/ace+cbor 3063 | | Payload: 3064 | | 3065 B: |<--------+ Header: 2.05 Content 3066 | | Content-Format: application/ace+cbor 3067 | 2.05 | Payload: 3068 | | 3070 Figure 22: Token Request and Response using Client Credentials. 3072 The information contained in the Request-Payload and the Response- 3073 Payload is shown in Figure 23. 3075 Request-Payload: 3076 { 3077 "grant_type" : "client_credentials", 3078 "client_id" : "keyfob", 3079 "client_secret" : "qwerty" 3080 } 3082 Response-Payload: 3083 { 3084 "access_token" : b64'VGVzdCB0b2tlbg==', 3085 "token_type" : "pop", 3086 "cnf" : { 3087 "COSE_Key" : { 3088 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk', 3089 "kty" : "oct", 3090 "alg" : "HS256", 3091 "k": b64'ZoRSOrFzN_FzUA5XKMYoVHyzff5oRJxl-IXRtztJ6uE' 3092 } 3093 } 3094 } 3096 Figure 23: Request and Response Payload for C offline 3098 The access token in this case is just an opaque byte string 3099 referencing the authorization information at the AS. 3101 C: Next, the client POSTs the access token to the authz-info 3102 endpoint in the RS. This is a plain CoAP request, i.e., no DTLS 3103 between client and RS. Since the token is an opaque string, the 3104 RS cannot verify it on its own, and thus defers to respond the 3105 client with a status code until after step E. 3106 D: The RS forwards the token to the introspection endpoint on the 3107 AS. Introspection assumes a secure connection between the AS and 3108 the RS, e.g., using transport of application layer security. In 3109 the example AS is identified using pre shared security context 3110 (psk, rpk or certificate) while RS is acting as client and is 3111 identified with client_id and client_secret. 3112 E: The AS provides the introspection response containing 3113 parameters about the token. This includes the confirmation key 3114 (cnf) parameter that allows the RS to verify the client's proof of 3115 possession in step F. 3116 After receiving message E, the RS responds to the client's POST in 3117 step C with the CoAP response code 2.01 (Created). 3119 Resource 3120 Client Server 3121 | | 3122 C: +-------->| Header: POST (T=CON, Code=0.02) 3123 | POST | Uri-Path:"authz-info" 3124 | | Payload: b64'VGVzdCB0b2tlbg==' 3125 | | 3126 | | Authorization 3127 | | Server 3128 | | | 3129 | D: +--------->| Header: POST (Code=0.02) 3130 | | POST | Uri-Path: "introspect" 3131 | | | Content-Format: "application/ace+cbor" 3132 | | | Payload: 3133 | | | 3134 | E: |<---------+ Header: 2.05 Content 3135 | | 2.05 | Content-Format: "application/ace+cbor" 3136 | | | Payload: 3137 | | | 3138 | | 3139 |<--------+ Header: 2.01 Created 3140 | 2.01 | 3141 | | 3143 Figure 24: Token Introspection for C offline 3144 The information contained in the Request-Payload and the Response- 3145 Payload is shown in Figure 25. 3147 Request-Payload: 3148 { 3149 "token" : b64'VGVzdCB0b2tlbg==', 3150 "client_id" : "FrontDoor", 3151 "client_secret" : "ytrewq" 3152 } 3154 Response-Payload: 3155 { 3156 "active" : true, 3157 "aud" : "lockOfDoor4711", 3158 "scope" : "open, close", 3159 "iat" : 1311280970, 3160 "cnf" : { 3161 "kid" : b64'c29tZSBwdWJsaWMga2V5IGlk' 3162 } 3163 } 3165 Figure 25: Request and Response Payload for Introspection 3167 The client uses the symmetric PoP key to establish a DTLS 3168 PreSharedKey secure connection to the RS. The CoAP request PUT is 3169 sent to the uri-path /state on the RS, changing the state of the 3170 door to locked. 3171 F: The RS responds with a appropriate over the secure DTLS 3172 channel. 3174 Resource 3175 Client Server 3176 | | 3177 |<=======>| DTLS Connection Establishment 3178 | | using Pre Shared Key 3179 | | 3180 +-------->| Header: PUT (Code=0.03) 3181 | PUT | Uri-Path: "state" 3182 | | Payload: 3183 | | 3184 F: |<--------+ Header: 2.04 Changed 3185 | 2.04 | Payload: 3186 | | 3188 Figure 26: Resource request and response protected by OSCORE 3190 Appendix F. Document Updates 3192 RFC EDITOR: PLEASE REMOVE THIS SECTION. 3194 F.1. Version -17 to -18 3196 o Added OSCORE options in examples involving OSCORE. 3197 o Removed requirement for the client to send application/cwt, since 3198 the client has no way to know. 3199 o Clarified verification of tokens by the RS. 3200 o Added exi claim CWT registration. 3202 F.2. Version -16 to -17 3204 o Added references to (D)TLS 1.3. 3205 o Added requirement that responses are bound to requests. 3206 o Specify that grant_type is OPTIONAL in C2AS requests (as opposed 3207 to REQUIRED in OAuth). 3208 o Replaced examples with hypothetical COSE profile with OSCORE. 3209 o Added requirement for content type application/ace+cbor in error 3210 responses for token and introspection requests and responses. 3211 o Reworked abbreviation space for claims, request and response 3212 parameters. 3213 o Added text that the RS may indicate that it is busy at the authz- 3214 info resource. 3216 o Added section that specifies how the RS verifies an access token. 3217 o Added section on the protection of the authz-info endpoint. 3218 o Removed the expiration mechanism based on sequence numbers. 3219 o Added reference to RFC7662 security considerations. 3220 o Added considerations on minimal security requirements for 3221 communication. 3222 o Added security considerations on unprotected information sent to 3223 authz-info and in the error responses. 3225 F.3. Version -15 to -16 3227 o Added text the RS using RFC6750 error codes. 3228 o Defined an error code for incompatible token request parameters. 3229 o Removed references to the actors draft. 3230 o Fixed errors in examples. 3232 F.4. Version -14 to -15 3234 o Added text about refresh tokens. 3235 o Added text about protection of credentials. 3236 o Rephrased introspection so that other entities than RS can do it. 3237 o Editorial improvements. 3239 F.5. Version -13 to -14 3241 o Split out the 'aud', 'cnf' and 'rs_cnf' parameters to 3242 [I-D.ietf-ace-oauth-params] 3243 o Introduced the "application/ace+cbor" Content-Type. 3244 o Added claim registrations from 'profile' and 'rs_cnf'. 3245 o Added note on schema part of AS Information Section 5.1.2 3246 o Realigned the parameter abbreviations to push rarely used ones to 3247 the 2-byte encoding size of CBOR integers. 3249 F.6. Version -12 to -13 3251 o Changed "Resource Information" to "Access Information" to avoid 3252 confusion. 3253 o Clarified section about AS discovery. 3254 o Editorial changes 3256 F.7. Version -11 to -12 3258 o Moved the Request error handling to a section of its own. 3259 o Require the use of the abbreviation for profile identifiers. 3260 o Added rs_cnf parameter in the introspection response, to inform 3261 RS' with several RPKs on which key to use. 3262 o Allowed use of rs_cnf as claim in the access token in order to 3263 inform an RS with several RPKs on which key to use. 3265 o Clarified that profiles must specify if/how error responses are 3266 protected. 3267 o Fixed label number range to align with COSE/CWT. 3268 o Clarified the requirements language in order to allow profiles to 3269 specify other payload formats than CBOR if they do not use CoAP. 3271 F.8. Version -10 to -11 3273 o Fixed some CBOR data type errors. 3274 o Updated boilerplate text 3276 F.9. Version -09 to -10 3278 o Removed CBOR major type numbers. 3279 o Removed the client token design. 3280 o Rephrased to clarify that other protocols than CoAP can be used. 3281 o Clarifications regarding the use of HTTP 3283 F.10. Version -08 to -09 3285 o Allowed scope to be byte strings. 3286 o Defined default names for endpoints. 3287 o Refactored the IANA section for briefness and consistency. 3288 o Refactored tables that define IANA registry contents for 3289 consistency. 3290 o Created IANA registry for CBOR mappings of error codes, grant 3291 types and Authorization Server Information. 3292 o Added references to other document sections defining IANA entries 3293 in the IANA section. 3295 F.11. Version -07 to -08 3297 o Moved AS discovery from the DTLS profile to the framework, see 3298 Section 5.1. 3299 o Made the use of CBOR mandatory. If you use JSON you can use 3300 vanilla OAuth. 3301 o Made it mandatory for profiles to specify C-AS security and RS-AS 3302 security (the latter only if introspection is supported). 3303 o Made the use of CBOR abbreviations mandatory. 3304 o Added text to clarify the use of token references as an 3305 alternative to CWTs. 3306 o Added text to clarify that introspection must not be delayed, in 3307 case the RS has to return a client token. 3308 o Added security considerations about leakage through unprotected AS 3309 discovery information, combining profiles and leakage through 3310 error responses. 3311 o Added privacy considerations about leakage through unprotected AS 3312 discovery. 3314 o Added text that clarifies that introspection is optional. 3315 o Made profile parameter optional since it can be implicit. 3316 o Clarified that CoAP is not mandatory and other protocols can be 3317 used. 3318 o Clarified the design justification for specific features of the 3319 framework in appendix A. 3320 o Clarified appendix E.2. 3321 o Removed specification of the "cnf" claim for CBOR/COSE, and 3322 replaced with references to [I-D.ietf-ace-cwt-proof-of-possession] 3324 F.12. Version -06 to -07 3326 o Various clarifications added. 3327 o Fixed erroneous author email. 3329 F.13. Version -05 to -06 3331 o Moved sections that define the ACE framework into a subsection of 3332 the framework Section 5. 3333 o Split section on client credentials and grant into two separate 3334 sections, Section 5.2, and Section 5.3. 3335 o Added Section 5.4 on AS authentication. 3336 o Added Section 5.5 on the Authorization endpoint. 3338 F.14. Version -04 to -05 3340 o Added RFC 2119 language to the specification of the required 3341 behavior of profile specifications. 3342 o Added Section 5.3 on the relation to the OAuth2 grant types. 3343 o Added CBOR abbreviations for error and the error codes defined in 3344 OAuth2. 3345 o Added clarification about token expiration and long-running 3346 requests in Section 5.8.3 3347 o Added security considerations about tokens with symmetric pop keys 3348 valid for more than one RS. 3349 o Added privacy considerations section. 3350 o Added IANA registry mapping the confirmation types from RFC 7800 3351 to equivalent COSE types. 3352 o Added appendix D, describing assumptions about what the AS knows 3353 about the client and the RS. 3355 F.15. Version -03 to -04 3357 o Added a description of the terms "framework" and "profiles" as 3358 used in this document. 3359 o Clarified protection of access tokens in section 3.1. 3360 o Clarified uses of the "cnf" parameter in section 6.4.5. 3361 o Clarified intended use of Client Token in section 7.4. 3363 F.16. Version -02 to -03 3365 o Removed references to draft-ietf-oauth-pop-key-distribution since 3366 the status of this draft is unclear. 3367 o Copied and adapted security considerations from draft-ietf-oauth- 3368 pop-key-distribution. 3369 o Renamed "client information" to "RS information" since it is 3370 information about the RS. 3371 o Clarified the requirements on profiles of this framework. 3372 o Clarified the token endpoint protocol and removed negotiation of 3373 "profile" and "alg" (section 6). 3374 o Renumbered the abbreviations for claims and parameters to get a 3375 consistent numbering across different endpoints. 3376 o Clarified the introspection endpoint. 3377 o Renamed token, introspection and authz-info to "endpoint" instead 3378 of "resource" to mirror the OAuth 2.0 terminology. 3379 o Updated the examples in the appendices. 3381 F.17. Version -01 to -02 3383 o Restructured to remove communication security parts. These shall 3384 now be defined in profiles. 3385 o Restructured section 5 to create new sections on the OAuth 3386 endpoints token, introspection and authz-info. 3387 o Pulled in material from draft-ietf-oauth-pop-key-distribution in 3388 order to define proof-of-possession key distribution. 3389 o Introduced the "cnf" parameter as defined in RFC7800 to reference 3390 or transport keys used for proof of possession. 3391 o Introduced the "client-token" to transport client information from 3392 the AS to the client via the RS in conjunction with introspection. 3393 o Expanded the IANA section to define parameters for token request, 3394 introspection and CWT claims. 3395 o Moved deployment scenarios to the appendix as examples. 3397 F.18. Version -00 to -01 3399 o Changed 5.1. from "Communication Security Protocol" to "Client 3400 Information". 3401 o Major rewrite of 5.1 to clarify the information exchanged between 3402 C and AS in the PoP access token request profile for IoT. 3404 * Allow the client to indicate preferences for the communication 3405 security protocol. 3406 * Defined the term "Client Information" for the additional 3407 information returned to the client in addition to the access 3408 token. 3409 * Require that the messages between AS and client are secured, 3410 either with (D)TLS or with COSE_Encrypted wrappers. 3412 * Removed dependency on OSCOAP and added generic text about 3413 object security instead. 3414 * Defined the "rpk" parameter in the client information to 3415 transmit the raw public key of the RS from AS to client. 3416 * (D)TLS MUST use the PoP key in the handshake (either as PSK or 3417 as client RPK with client authentication). 3418 * Defined the use of x5c, x5t and x5tS256 parameters when a 3419 client certificate is used for proof of possession. 3420 * Defined "tktn" parameter for signaling for how to transfer the 3421 access token. 3422 o Added 5.2. the CoAP Access-Token option for transferring access 3423 tokens in messages that do not have payload. 3424 o 5.3.2. Defined success and error responses from the RS when 3425 receiving an access token. 3426 o 5.6.:Added section giving guidance on how to handle token 3427 expiration in the absence of reliable time. 3428 o Appendix B Added list of roles and responsibilities for C, AS and 3429 RS. 3431 Authors' Addresses 3433 Ludwig Seitz 3434 RISE 3435 Scheelevaegen 17 3436 Lund 223 70 3437 Sweden 3439 Email: ludwig.seitz@ri.se 3441 Goeran Selander 3442 Ericsson 3443 Faroegatan 6 3444 Kista 164 80 3445 Sweden 3447 Email: goran.selander@ericsson.com 3449 Erik Wahlstroem 3450 Sweden 3452 Email: erik@wahlstromstekniska.se 3453 Samuel Erdtman 3454 Spotify AB 3455 Birger Jarlsgatan 61, 4tr 3456 Stockholm 113 56 3457 Sweden 3459 Email: erdtman@spotify.com 3461 Hannes Tschofenig 3462 Arm Ltd. 3463 Absam 6067 3464 Austria 3466 Email: Hannes.Tschofenig@arm.com