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