RFC 9200
Authentication and Authorization for Constrained Environments Using the OAuth 2.0 Framework (ACE-OAuth)
RFC 9200: Authentication and Authorization for Constrained Environments Using the OAuth 2.0 Framework (ACE-OAuth) โจ
Part 1 of 18, bestie! ๐ This is the title block and the opening sections. More parts are coming, so stay tuned. ๐
This one is an IETF Standards Track doc (category: Standards Track, ISSN 2070-1721), dated August 2022 ๐ . It was written by L. Seitz (Combitech), G. Selander (Ericsson), E. Wahlstroem (Ericsson), S. Erdtman (Spotify AB), and H. Tschofenig (Arm Ltd.) ๐. The title block doesn't list anything it obsoletes or updates, so there's no drama there. ๐
Abstract ๐ฆ
Okay so this spec defines a framework for authentication and authorization in Internet of Things (IoT) environments, and it's called ACE-OAuth. ๐ธ It's built from a bunch of building blocks, including OAuth 2.0 and the Constrained Application Protocol (CoAP). The result is that a well-known, widely used authorization solution gets transformed into something that actually fits on tiny IoT devices. โจ Existing specs get reused wherever possible, but extensions are added and profiles are defined to better serve IoT use cases. It's giving practical reuse. ๐
Status of This Memo ๐
This is an Internet Standards Track document. ๐ฅ
It's a product of the Internet Engineering Task Force (IETF), and it represents the consensus of the IETF community. ๐ซถ It got public review and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more info on Internet Standards, check Section 2 of RFC 7841. ๐ง
Info about the current status of this document, any errata, and how to send feedback lives at https://www.rfc-editor.org/info/rfc9200. ๐
Copyright Notice ๐
Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved. ๐
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication. Please read these carefully, because they describe your rights and restrictions. ๐ Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions, and they're provided without warranty as described in the Revised BSD License. ๐
Table of Contents ๐๏ธ
1. Introduction
2. Terminology
3. Overview
3.1. OAuth 2.0
3.2. CoAP
4. Protocol Interactions
5. Framework
5.1. Discovering Authorization Servers
5.2. Unauthorized Resource Request Message
5.3. AS Request Creation Hints
5.3.1. The Client-Nonce Parameter
5.4. Authorization Grants
5.5. Client Credentials
5.6. AS Authentication
5.7. The Authorization Endpoint
5.8. The Token Endpoint
5.8.1. Client-to-AS Request
5.8.2. AS-to-Client Response
5.8.3. Error Response
5.8.4. Request and Response Parameters
5.8.4.1. Grant Type
5.8.4.2. Token Type
5.8.4.3. Profile
5.8.4.4. Client-Nonce
5.8.5. Mapping Parameters to CBOR
5.9. The Introspection Endpoint
5.9.1. Introspection Request
5.9.2. Introspection Response
5.9.3. Error Response
5.9.4. Mapping Introspection Parameters to CBOR
5.10. The Access Token
5.10.1. The Authorization Information Endpoint
5.10.1.1. Verifying an Access Token
5.10.1.2. Protecting the Authorization Information Endpoint
5.10.2. Client Requests to the RS
5.10.3. Token Expiration
5.10.4. Key Expiration
6. Security Considerations
6.1. Protecting Tokens
6.2. Communication Security
6.3. Long-Term Credentials
6.4. Unprotected AS Request Creation Hints
6.5. Minimal Security Requirements for Communication
6.6. Token Freshness and Expiration
6.7. Combining Profiles
6.8. Unprotected Information
6.9. Identifying Audiences
6.10. Denial of Service Against or with Introspection
7. Privacy Considerations
8. IANA Considerations
8.1. ACE Authorization Server Request Creation Hints
8.2. CoRE Resource Types
8.3. OAuth Extensions Errors
8.4. OAuth Error Code CBOR Mappings
8.5. OAuth Grant Type CBOR Mappings
8.6. OAuth Access Token Types
8.7. OAuth Access Token Type CBOR Mappings
8.7.1. Initial Registry Contents
8.8. ACE Profiles
8.9. OAuth Parameters
8.10. OAuth Parameters CBOR Mappings
8.11. OAuth Introspection Response Parameters
8.12. OAuth Token Introspection Response CBOR Mappings
8.13. JSON Web Token Claims
8.14. CBOR Web Token Claims
8.15. Media Type Registration
8.16. CoAP Content-Formats
8.17. Expert Review Instructions
9. References
9.1. Normative References
9.2. Informative References
Appendix A. Design Justification
Appendix B. Roles and Responsibilities
Appendix C. Requirements on Profiles
Appendix D. Assumptions on AS Knowledge about the C and RS
Appendix E. Differences to OAuth 2.0
Appendix F. Deployment Examples
F.1. Local Token Validation
F.2. Introspection Aided Token Validation
Acknowledgments
Authors' Addresses
1. Introduction ๐ท
Authorization is the process of approving an entity to access a generic resource [RFC4949]. ๐ The job itself is best described as granting a requesting client access to a resource hosted on a device, which is the resource server (RS). ๐ This exchange gets mediated by one or more authorization servers (ASes). Managing authorization for lots of devices and users can get messy, fr fr. ๐ญ
Web and mobile authorization work also applies to IoT, but a lot of IoT devices are constrained, for example in processing power and available memory. ๐ฆ That's where the Constrained Application Protocol (CoAP) [RFC7252] comes in, since it can ease some resource concerns when it's used instead of HTTP for the communication flows in this spec. โจ
Appendix A gives an overview of the constraints this design considers, and [RFC7228] goes deeper on constraints. ๐ง The design aims to cover different IoT deployments and a continuous range of device and network capabilities. Take energy consumption: at one end you've got energy-harvesting or battery-powered devices with a super tight power budget, at the other end you've got mains-powered devices, and every level exists in between. It's a whole spectrum, bestie. ๐
So IoT devices can be wildly different in processing and messaging capabilities, and there's a real need to support many different authorization use cases [RFC7744]. ๐
This specification describes a framework for Authentication and Authorization for Constrained Environments (ACE), built by reusing OAuth 2.0 [RFC6749], which extends authorization out to Internet of Things devices. ๐ It contains the building blocks needed to adjust OAuth 2.0 to IoT environments. ๐
Profiles of this framework live in separate specs, such as [RFC9202] or [RFC9203]. ๐ซถ A profile can specify how the framework is used with a specific security protocol and the underlying transports in a specific deployment environment, which helps interoperability. Implementations may claim conformance with a specific profile. Implementations using the same profile interoperate, while implementations of different profiles aren't expected to be interoperable. ๐ Beefier devices like mobile phones and tablets may implement several profiles, so they can talk to a wider range of constrained devices. ๐ฑ Requirements on profiles are described at the relevant places throughout this spec and also summarized in Appendix C. ๐ฅ
2. Terminology ๐
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. ๐ These are the official BCP 14 vibes, so they only count when they're written in all capitals like that. ๐
Certain security-related terms, such as "authentication", "authorization", "confidentiality", "(data) integrity", "message authentication code", and "verify", are taken from [RFC4949]. ๐
Since exchanges in this spec are described as RESTful protocol interactions, HTTP [RFC9110] offers useful terminology. (Quick note: "RESTful" refers to the Representational State Transfer (REST) architecture. ๐ธ)
Terminology for entities in the architecture comes from OAuth 2.0 [RFC6749], like client (C), resource server (RS), and authorization server (AS). ๐
Heads up on "endpoint": it's used here with its OAuth meaning, which is resources such as token and introspection at the AS, and authz-info at the RS (see Section 5.10.1 for the authz-info endpoint definition). ๐ง The CoAP definition, which is "[a]n entity participating in the CoAP protocol" [RFC7252], is not used in this specification. ๐ โโ๏ธ
This document's spec is called the "framework" or "ACE framework". When it talks about "profiles of this framework", it means additional specs that define how this spec is used with concrete transport and communication security protocols (e.g., CoAP over DTLS). ๐ฆ
The term "Access Information" covers parameters other than the access token that the AS gives the client so it can reach the RS, like the RS's public key or the profile the RS supports. ๐
The term "authorization information" covers all the information an RS uses to decide whether an access request should be granted, including the claims of relevant access tokens. ๐
Last one! Examples of CBOR data items are written in CBOR extended diagnostic notation, defined in Section 8 of [RFC8949] and Appendix G of [RFC8610] ("diagnostic notation"), unless noted otherwise. ๐ We often add diagnostic notation comments that give a textual version of the numeric parameter names and values, which makes everything way easier to read. ๐คโจ
3. Overview โจ
okay so bestie, this section is basically the big picture tour of the whole ACE framework ๐ฆ It's like the framework is a squad, and each member brings a different building block to the party ๐
This specification defines the ACE framework for authorization in the Internet of Things environment. It consists of a set of building blocks.
The basic block is the OAuth 2.0 [RFC6749] framework, which enjoys widespread deployment. Many IoT devices can support OAuth 2.0 without any additional extensions, but for certain constrained settings, additional profiling is needed. ๐ธ
Another building block is the lightweight web transfer protocol CoAP [RFC7252], for those communication environments where HTTP is not appropriate. CoAP typically runs on top of UDP, which further reduces overhead and message exchanges. While this specification defines extensions for the use of OAuth over CoAP, other underlying protocols are not prohibited from being supported in the future, such as HTTP/2 [RFC9113], Message Queuing Telemetry Transport (MQTT) [MQTT5.0], Bluetooth Low Energy (BLE) [BLE], and QUIC [RFC9000]. Note that this document specifies protocol exchanges in terms of RESTful verbs, such as GET and POST. Future profiles using protocols that do not support these verbs MUST specify how the corresponding protocol messages are transmitted instead. ๐
A third building block is the Concise Binary Object Representation (CBOR) [RFC8949], for encodings where JSON [RFC8259] is not sufficiently compact. CBOR is a binary encoding designed for small code and message size. Self-contained tokens and protocol message payloads are encoded in CBOR when CoAP is used. When CoAP is not used, the use of CBOR remains RECOMMENDED. ๐ง
A fourth building block is CBOR Object Signing and Encryption (COSE) [RFC8152], which enables object-level layer security as an alternative or complement to transport layer security (DTLS [RFC6347] [RFC9147] or TLS [RFC8446]). COSE is used to secure self-contained tokens, such as proof-of-possession (PoP) tokens, which are an extension to the OAuth bearer tokens. The default token format is defined in CBOR Web Token (CWT) [RFC8392]. Application-layer security for CoAP using COSE can be provided with Object Security for Constrained RESTful Environments (OSCORE) [RFC8613]. ๐ฅ
With the building blocks listed above, solutions satisfying various IoT device and network constraints are possible. A list of constraints is described in detail in [RFC7228], and a description of how the building blocks mentioned above relate to the various constraints can be found in Appendix A. ๐
Luckily, not every IoT device suffers from all constraints. Nevertheless, the ACE framework takes all these aspects into account and allows several different deployment variants to coexist, rather than mandating a one-size-fits-all solution. It is important to cover the wide range of possible interworking use cases and the different requirements from a security point of view. Once IoT deployments mature, popular deployment variants will be documented in the form of ACE profiles. ๐
3.1. OAuth 2.0 ๐
okay so OAuth 2.0 is giving scoped access vibes ๐ The OAuth 2.0 authorization framework lets a client get scoped access to a resource with the permission of a resource owner. Authorization information, or references to it, gets passed between the nodes using access tokens. These access tokens are issued to clients by an authorization server with the approval of the resource owner. The client uses the access token to reach the protected resources hosted by the resource server. ๐ฆ
A number of OAuth 2.0 terms are used within this specification:
Access Tokens: ๐
Access tokens are credentials needed to access protected resources. An access token is a data structure representing authorization permissions issued by the AS to the client. Access tokens are generated by the AS and consumed by the RS. The access token content is opaque to the client.
Access tokens can have different formats and various methods of utilization (e.g., cryptographic properties) based on the security requirements of the given deployment.
Introspection: ๐
Introspection is a method for a resource server, or potentially a client, to query the authorization server for the active state and content of a received access token. This is particularly useful in those cases where the authorization decisions are very dynamic and/or where the received access token itself is an opaque reference, rather than a self-contained token. More information about introspection in OAuth 2.0 can be found in [RFC7662]. ๐ธ
Refresh Tokens: ๐
Refresh tokens are credentials used to obtain access tokens. Refresh tokens are issued to the client by the authorization server and are used to obtain a new access token when the current access token expires or to obtain additional access tokens with identical or narrower scope (such access tokens may have a shorter lifetime and fewer permissions than authorized by the resource owner). Issuing a refresh token is optional at the discretion of the authorization server. If the authorization server issues a refresh token, it is included when issuing an access token (i.e., step (B) in Figure 1).
A refresh token in OAuth 2.0 is a string representing the authorization granted to the client by the resource owner. The string is usually opaque to the client. The token denotes an identifier used to retrieve the authorization information. Unlike access tokens, refresh tokens are intended for use only with authorization servers and are never sent to resource servers. In this framework, refresh tokens are encoded in binary instead of strings, if used. ๐ง
Proof-of-Possession Tokens: ๐
A token may be bound to a cryptographic key, which is then used to bind the token to a request authorized by the token. Such tokens are called proof-of-possession tokens (or PoP tokens). ๐
The proof-of-possession security concept used here assumes that the AS acts as a trusted third party that binds keys to tokens. In the case of access tokens, these so-called PoP keys are then used by the client to demonstrate the possession of the secret to the RS when accessing the resource. The RS, when receiving an access token, needs to verify that the key used by the client matches the one bound to the access token. When this specification uses the term "access token", it is assumed to be a PoP access token unless specifically stated otherwise. โจ
The key bound to the token (the PoP key) may use either symmetric or asymmetric cryptography. The appropriate choice of the kind of cryptography depends on the constraints of the IoT devices as well as on the security requirements of the use case. ๐
Symmetric PoP key: ๐๏ธ
The AS generates a random, symmetric PoP key. The key is either stored to be returned on introspection calls or included in the token. Either the whole token or only the key MUST be encrypted in the latter case. The PoP key is also returned to client together with the token, protected by the secure channel. ๐ซถ
Asymmetric PoP key: ๐๏ธ
An asymmetric key pair is generated by the client and the public key is sent to the AS (if it does not already have knowledge of the client's public key). Information about the public key, which is the PoP key in this case, is either stored to be returned on introspection calls or included inside the token and sent back to the client. The resource server consuming the token can identify the public key from the information in the token, which allows the client to use the corresponding private key for the proof of possession. ๐
The token is either a simple reference or a structured information object (e.g., CWT [RFC8392]) protected by a cryptographic wrapper (e.g., COSE [RFC8152]). The choice of PoP key does not necessarily imply a specific credential type for the integrity protection of the token. ๐
Scopes and Permissions: ๐ฏ
In OAuth 2.0, the client specifies the type of permissions it is seeking to obtain (via the scope parameter) in the access token request. In turn, the AS may use the scope response parameter to inform the client of the scope of the access token issued. As the client could be a constrained device as well, this specification defines the use of CBOR encoding (see Section 5) for such requests and responses. ๐ท
The values of the scope parameter in OAuth 2.0 are expressed as a list of space-delimited, case-sensitive strings with a semantic that is well known to the AS and the RS. More details about the concept of scopes are found under Section 3.3 of [RFC6749]. ๐
Claims: ๐ท๏ธ
Information carried in the access token or returned from introspection, called claims, is in the form of name-value pairs. An access token may, for example, include a claim identifying the AS that issued the token (via the iss claim) and what audience the access token is intended for (via the aud claim). The audience of an access token can be a specific resource, one resource, or many resource servers. The resource owner policies influence what claims are put into the access token by the authorization server. ๐
While the structure and encoding of the access token varies throughout deployments, a standardized format has been defined with the JSON Web Token (JWT) [RFC7519], where claims are encoded as a JSON object. In [RFC8392], the CBOR Web Token (CWT) has been defined as an equivalent format using CBOR encoding. ๐ฆ
Token and Introspection Endpoints: ๐ฎ
The AS hosts the token endpoint that allows a client to request access tokens. The client makes a POST request to the token endpoint on the AS and receives the access token in the response (if the request was successful). ๐
In some deployments, a token introspection endpoint is provided by the AS, which can be used by the RS and potentially the client, if they need to request additional information regarding a received access token. The requesting entity makes a POST request to the introspection endpoint on the AS and receives information about the access token in the response. (See "Introspection" above.) ๐
Okay so this is where we pick up with 3.2. CoAP and I'm literally obsessed with how this section sets things up ๐ฆ
CoAP is an application-layer protocol that's basically HTTP's chill little cousin, built specifically for constrained environments ๐ง It usually rides on datagram transport like UDP, which means packets can get reordered or lost along the way ๐ซ Any security solution has to take that into account, no cap ๐ฅ
While HTTP leans on headers and query strings to carry extra info about a request, CoAP tucks that info into header parameters called 'options' ๐
CoAP can fragment its payloads at the application layer using block-wise transfers [RFC7959] ๐ธ Here's the catch though: block-wise transfer does NOT make CoAP option size limits any bigger ๐ So anything you stuff into options has to stay small, periodt โจ
Transport layer security for CoAP can come from DTLS or TLS [RFC6347] [RFC8446] [RFC9147] ๐ CoAP also defines a bunch of proxy operations that need transport layer security to end at the proxy ๐ If you want end-to-end protection through proxies, and you also want a uniform way to secure CoAP over other transports, you can secure things at the application layer with an object-based mechanism like COSE [RFC8152] ๐
One application of COSE is OSCORE [RFC8613], which gives you end-to-end confidentiality, integrity and replay protection, plus a secure binding between CoAP request and response messages ๐ In OSCORE, the CoAP messages get wrapped in COSE objects and then sent over CoAP ๐
So in this framework, using CoAP as a replacement for HTTP is RECOMMENDED for constrained environments ๐ซถ For communication security, the framework doesn't make an explicit protocol recommendation, since the right choice depends on what the specific application needs ๐ฆ DTLS [RFC6347] [RFC9147] and OSCORE [RFC8613] are mentioned as examples, and other protocols that meet the requirements from Section 6.5 are also applicable ๐
4. Protocol Interactions โจ
Okay bestie, this section is the main event ๐ญ The ACE framework is built on OAuth 2.0 protocol interactions that use the token endpoint and, optionally, the introspection endpoint ๐ง A client gets an access token (and optionally a refresh token) from an AS through the token endpoint, then shows that access token to an RS to get into a protected resource ๐ Most of the time the RS can check the access token locally, but sometimes it sends the token to the AS via the introspection endpoint to get fresh info ๐ All these interactions are in Figure 1, and Section 3.1 has a quick rundown of OAuth concepts if you need a refresher ๐
+--------+ +---------------+
| |---(A)-- Token Request ------->| |
| | | Authorization |
| |<--(B)-- Access Token ---------| Server |
| | + Access Information | |
| | + Refresh Token (optional) +---------------+
| | ^ |
| | Introspection Request (D)| |
| Client | Response | |(E)
| | (optional exchange) | |
| | | v
| | +--------------+
| |---(C)-- Token + Request ----->| |
| | | Resource |
| |<--(F)-- Protected Resource ---| Server |
| | | |
+--------+ +--------------+
Figure 1: Basic Protocol Flow
Requesting an Access Token (A) ๐
Okay so the client sends an access token request to the token endpoint at the AS ๐ This framework assumes you're using PoP access tokens (check Section 3.1 for the quick version), where the AS binds a key to the access token ๐ The client can include the permissions it wants and details about the credentials it plans to use for proof of possession, like symmetric or asymmetric crypto, or a reference to a specific key ๐๏ธ
Access Token Response (B) ๐
If the client's request is successfully verified, authenticated, and authorized, the AS sends back an access token and, optionally, a refresh token โจ Heads up: only certain grant types support refresh tokens ๐ The AS can also return extra parameters called "Access Information" ๐ On top of the response parameters from OAuth 2.0 and the PoP access token extension, this framework defines parameters that tell the client about the RS's capabilities, like which profile the RS supports ๐ธ You can find more on these in Section 5.8.4 ๐ฆ
Resource Request (C) ๐
The client talks to the RS to request access to the protected resource and hands over the access token ๐ The protocol between client and RS isn't limited to CoAP, so HTTP, HTTP/2 [RFC9113], QUIC [RFC9000], MQTT [MQTT5.0], Bluetooth Low Energy [BLE], and others are all valid options ๐
Depending on the device's limitations and the protocol you pick, this exchange might get split into two parts ๐งฉ
- the client sends the access token (containing, or referencing, the authorization information) to the RS, which will be used for later resource requests by the client, and
- the client makes the resource access request using the communication security protocol and the other Access Information it got from the AS ๐
The client and the RS mutually authenticate using the security protocol from the profile (see step (B)) and the keys in the access token or the Access Information ๐ค The RS checks that the token is integrity protected and came from the AS ๐ Then it compares the claims in the access token with the resource request ๐ If the RS is online, validation can be handed off to the AS through token introspection (see messages (D) and (E)) over HTTP or CoAP ๐ฐ๏ธ
Token Introspection Request (D) ๐ต๏ธ
A resource server can be set up to introspect the access token by including it in a request to the introspection endpoint at that AS ๐ Token introspection over CoAP is defined in Section 5.9, and over HTTP it's in [RFC7662] ๐ซ
Heads up: token introspection is optional ๐ You can skip it if the token is self-contained and the RS is able to validate the token on its own ๐
Token Introspection Response (E) ๐ฌ
The AS validates the token and sends back the most recent parameters tied to it, like scope, audience, validity, etc. ๐ฆ The RS then uses those parameters to either accept or deny the request ๐
Protected Resource (F) ๐
If the client's request is authorized, the RS fulfills it and returns a response with the appropriate response code ๐ The RS uses the dynamically established keys to protect the response according to the communication security protocol in use ๐
The OAuth 2.0 framework defines a bunch of "protocol flows" through grant types, and those have been extended by other OAuth 2.0 extensions, like [RFC7521] and [RFC8628] ๐ง Which grant type works best depends on the use case ๐ญ [RFC7744] describes lots of different IoT use cases, but two grant types cover most of them: the authorization code grant (Section 4.1 of [RFC6749]) and the client credentials grant (Section 4.4 of [RFC6749]) ๐ซถ The authorization code grant fits apps on smartphones and tablets that request access to IoT devices, like in a smart home, where users need to go through authentication and authorization at least during initial setup ๐ฑ๐ The native apps guidelines in [RFC8252] apply to this use case ๐ The client credentials grant fits IoT devices where the OAuth client itself is constrained ๐ค In that case, the resource owner has set up access rights for the client with the AS beforehand, which is often done with a commissioning tool ๐ ๏ธ
The resource owner's consent for giving a client access to a protected resource can be given dynamically, like in classical OAuth flows, or it can be preconfigured as authorization policies at the AS, which the AS checks when a token request comes in ๐ง The resource owner and the requesting party (the client owner) aren't shown in Figure 1 ๐
This framework supports lots of communication security mechanisms between the ACE entities (client, AS, and RS) ๐ It's assumed the client has been registered (also called enrolled or onboarded) with an AS through a mechanism outside the scope of this document ๐ In practice, onboarding has used things like factory-based provisioning or commissioning tools ๐ญ No matter which onboarding technique is used, the client and AS exchange credentials and configuration parameters ๐ Those credentials are used to mutually authenticate each other and protect messages between the client and the AS ๐
The RS is assumed to be registered with the AS too, potentially in a similar way to the client ๐ Keying material established between the AS and RS lets the AS cryptographically protect the access token so its content can't be modified and, if needed, is confidentiality protected ๐ก๏ธ Confidentiality protection of the access token content is added on top of the confidentiality protection from the communication security protocol ๐
The keying material needed to set up communication security between the C and RS is dynamically established as part of the protocol in this document โจ
At the start of the protocol there's an optional discovery step where the client finds the resource server and the resources it hosts ๐ In this step, the client might also work out what permissions it needs to access the protected resource ๐๏ธ A generic procedure is in Section 5.1, and profiles MAY define other discovery procedures ๐
In Bluetooth Low Energy, for example, a peripheral broadcasts advertisements that include info about its primary services ๐ก In CoAP, a client can make a request to "/.well-known/core" to get info about the available resources, returned in a standardized format as described in [RFC6690] ๐ง
5. Framework โจ
okay so this is where the ACE framework really comes together ๐ง it's basically OAuth 2.0 but glammed up for tiny constrained devices, and these next sections are the profiling and extensions that make it work ๐
Credential Provisioning ๐
bestie, constrained devices can't just assume the client and the RS are in some shared key infrastructure, so that's a no-go ๐ โโ๏ธ instead, the AS hands out credentials and the info needed so the client and the RS can mutually authenticate each other. the security association they end up with can then also be used to bind those credentials to the access tokens the client uses. it's giving teamwork ๐ซถ
Proof of Possession ๐๏ธ
the ACE framework does proof of possession for access tokens by default ๐ that means the token holder has to prove they're the holder of the key bound to the token. the binding comes from the cnf (confirmation) claim [RFC8747], which says which key is used for proof of possession. and if a client needs a new access token, say to get extra access rights, it can ask the AS to bind this new token to the same key as the previous one ๐ฆ
ACE Profiles ๐ธ
clients and RSs can be limited in what encodings or protocols they support, and that's real ๐ญ so to cover a bunch of different deployment settings, the specific interactions between client and RS get defined in an ACE profile. the AS is expected to manage matching up compatible profile choices between a client and an RS ๐ once it's decided, the AS tells the client which profile was picked using the ace_profile parameter in the token response โจ
OAuth 2.0 needs TLS to protect the communication between the AS and the client when the client requests an access token, between the client and RS when the client accesses a resource, and between the AS and RS if introspection is used. but in constrained settings TLS isn't always feasible or desirable ๐ฅบ so, even without it, the communications named above are REQUIRED to be encrypted, integrity protected, and protected against message replay ๐ฅ the communicating endpoints are also REQUIRED to perform mutual authentication ๐ซถ and responses MUST be bound to their requests, meaning the receiver of a response can be certain that it actually belongs to a certain request ๐ heads up that setting up this kind of secure communication may need some unprotected messages to go back and forth first, like sending the token from the client to the RS ๐
Profiles MUST specify a communication security protocol between the client and RS that gives the features required above ๐ profiles MUST also specify a communication security protocol that is RECOMMENDED for use between the client and the AS, again giving the features required above โจ and for introspection, profiles MUST specify a communication security protocol RECOMMENDED for use between the RS and the AS, which also gives the features required above ๐ these recommendations are there so different implementations can interoperate without a whole new profile being defined, as long as the communication between the C and AS, or between the RS and AS, is protected by a different security protocol that still meets the security requirements above ๐ฆ
In OAuth 2.0, communication with the Token and Introspection endpoints at the AS is assumed to happen over HTTP and may use Uri-query parameters ๐ when profiles of this framework use CoAP instead, it is REQUIRED to use the following alternative instead of Uri-query parameters: the sender (client or RS) encodes the parameters of its request as a CBOR map and submits that map as the payload of the POST request ๐ง this document specifies the CBOR encoding for a number of OAuth 2.0 parameters, and if a profile needs other OAuth 2.0 parameters with CoAP, it MUST specify their CBOR encoding ๐
Profiles that use CBOR encoding of protocol message parameters at the outermost encoding layer MUST use the Content-Format application/ace+cbor ๐ and if CoAP is used for communication, the Content-Format MUST be abbreviated with the ID: 19 (see Section 8.16) โจ
The OAuth 2.0 AS uses a JSON structure in the payload of its responses to both the client and the RS ๐ if CoAP is used, it is REQUIRED to use CBOR [RFC8949] instead of JSON ๐ซถ and depending on the profile, the CBOR payload MAY be enclosed in a non-CBOR cryptographic wrapper ๐
5.1. Discovering Authorization Servers ๐
the C has to find the AS in charge of the RS so it knows where to request the access token ๐งญ to do that, the C 1) must find out the AS URI the token request message should go to, and 2) MUST validate that the AS at this URI is authorized to provide access tokens for this RS ๐ โโ๏ธ
to figure out the AS URI, the C MAY send an initial Unauthorized Resource Request message to the RS ๐ the RS then denies the request and sends back the address of its AS (see Section 5.2) ๐ฆ how the C validates AS authorization is not in scope for this document ๐ the C could, for example, ask its owner whether this AS is authorized for this RS ๐ the C could also use a mechanism that handles both problems at once, like querying a dedicated secure service run by the client owner ๐ซถ
5.2. Unauthorized Resource Request Message ๐ซ
an Unauthorized Resource Request message is a request for any resource hosted by the RS that the client doesn't have authorization for yet ๐ฅบ the RSs MUST treat any request for a protected resource as an Unauthorized Resource Request message when any of the following hold:
- The request has been received on an unsecured channel.
- The RS has no valid access token for the sender of the request regarding the requested action on that resource.
- The RS has a valid access token for the sender of the request, but that token does not authorize the requested action on the requested resource.
Note: these conditions make sure the RS can handle requests on its own once access was granted and a secure channel has been set up between the C and RS ๐ฅ the authz-info endpoint, which is part of the process for authorizing to protected resources, is not itself a protected resource, so it MUST NOT be protected as specified above (cf. Section 5.10.1) ๐
Unauthorized Resource Request messages MUST be denied with an "unauthorized_client" error response ๐ โโ๏ธ in that response, the resource server SHOULD provide proper AS Request Creation Hints so the client can request an access token from the RS's AS, as described in Section 5.3 ๐
the handling of all client requests (including the unauthorized ones) by the RS is described in Section 5.10.2 ๐ง
5.3. AS Request Creation Hints ๐ก
AS Request Creation Hints are sent by an RS as a response to an Unauthorized Resource Request message (see Section 5.2) to help the sender of that message get a valid access token ๐ซถ they're a CBOR or JSON map with an OPTIONAL element AS, which is an absolute URI (see Section 4.3 of [RFC3986]) that identifies the right AS for the RS ๐ธ
the message can also contain the following OPTIONAL parameters:
- An audience element holds an identifier the client should request at the AS, as suggested by the RS. When it's included in the access token request to the AS, the AS can restrict use of the access token to specific RSs ๐ see Section 6.9 for a discussion of this parameter.
- A kid (key identifier) element holds the key identifier of a key used in an existing security association between the client and the RS ๐๏ธ the RS expects the client to request an access token bound to this key so it doesn't have to reestablish the security association ๐
- A cnonce element holds a client-nonce. See Section 5.3.1 โจ
- A scope element holds the suggested scope the client should request from the AS ๐
Table 1 sums up the parameters that may be part of the AS Request Creation Hints ๐
+==========+==========+=====================+
| Name | CBOR Key | Value Type |
+==========+==========+=====================+
| AS | 1 | text string |
+----------+----------+---------------------+
| kid | 2 | byte string |
+----------+----------+---------------------+
| audience | 5 | text string |
+----------+----------+---------------------+
| scope | 9 | text or byte string |
+----------+----------+---------------------+
| cnonce | 39 | byte string |
+----------+----------+---------------------+
Table 1: AS Request Creation Hints
note that the schema part of the AS parameter may need to be adapted to the security protocol used between the client and the AS ๐ฆ so the example AS value "coap://as.example.com/token" might need to become "coaps://as.example.com/token" ๐ it's assumed the client can work out the correct schema part on its own, depending on how it communicates with the AS ๐
Figure 2 shows an example AS Request Creation Hints payload using diagnostic notation ๐
4.01 Unauthorized
Content-Format: application/ace+cbor
Payload :
{
/ AS / 1 : "coaps://as.example.com/token",
/ audience / 5 : "coaps://rs.example.com",
/ scope / 9 : "rTempC",
/ cnonce / 39 : h'e0a156bb3f'
}
Figure 2: AS Request Creation Hints Payload Example
in this example, the response parameter AS points the receiver of the message to "coaps://as.example.com/token" to request access tokens ๐งญ the RS sending this response uses an internal clock that isn't synchronized with the AS's clock ๐ญ so it can't reliably check the expiration time of access tokens it receives ๐ฅบ to still get a certain level of access token freshness, the RS included a cnonce parameter (see Section 5.3.1) in the response โจ (the hex sequence of the cnonce parameter is encoded in CBOR-based notation in this example ๐)
Figure 3 shows the mandatory use of binary encoding for the message payload from Figure 2 ๐
a4 # map(4)
01 # unsigned(1) (=AS)
78 1c # text(28)
636f6170733a2f2f61732e657861
6d706c652e636f6d2f746f6b656e # "coaps://as.example.com/token"
05 # unsigned(5) (=audience)
76 # text(22)
636f6170733a2f2f72732e657861
6d706c652e636f6d # "coaps://rs.example.com"
09 # unsigned(9) (=scope)
66 # text(6)
7254656d7043 # "rTempC"
18 27 # unsigned(39) (=cnonce)
45 # bytes(5)
e0a156bb3f #
Figure 3: AS Request Creation Hints Example Encoded in CBOR
5.3.1. The Client-Nonce Parameter ๐ธ
okay so this one is about the cnonce (client-nonce) parameter, and it's giving "keeping your tokens fresh" ๐
If the RS does not synchronize its clock with the AS, it could be tricked into accepting old access tokens that are either expired or have been compromised ๐ญ To get some level of token freshness in that case, the RS can use the cnonce (client-nonce) parameter. The processing requirements for this parameter are as follows:
- An RS sending a
cnonceparameter in an AS Request Creation Hints message MUST store information to validate that a givencnonceis fresh. How this is implemented internally is out of scope for this specification. Expiration of client-nonces should be based roughly on the time it would take a client to obtain an access token after receiving the AS Request Creation Hints, with some allowance for unexpected delays. โจ - A client receiving a
cnonceparameter in an AS Request Creation Hints message MUST include this in the parameters when requesting an access token at the AS, using thecnonceparameter from Section 5.8.4.4. ๐ - If an AS grants an access token request containing a
cnonceparameter, it MUST include this value in the access token, using thecnonceclaim specified in Section 5.10. ๐ฆ - An RS that is using the client-nonce mechanism and that receives an access token MUST verify that this token contains a
cnonceclaim, with a client-nonce value that is fresh according to the information stored at the first step above. If thecnonceclaim is not present or if thecnonceclaim value is not fresh, the RS MUST discard the access token. If this was an interaction with theauthz-infoendpoint, the RS MUST also respond with an error message using a response code equivalent to the CoAP code 4.01 (Unauthorized). ๐
5.4. Authorization Grants ๐ง
okay so to request an access token, the client gets authorization from the resource owner or uses its client credentials as a grant ๐ That authorization is expressed as an authorization grant.
The OAuth framework [RFC6749] defines four grant types ๐ They can be split into two groups: those granted on behalf of the resource owner (password, authorization code, implicit) and those for the client (client credentials). Further grant types have been added later, such as an assertion-based authorization grant defined in [RFC7521]. โจ
The grant type is selected depending on the use case. In cases where the client acts on behalf of the resource owner, the authorization code grant is RECOMMENDED ๐ If the client acts on behalf of the resource owner but does not have any display or has very limited interaction possibilities, it is recommended to use the device code grant defined in [RFC8628]. In cases where the client acts autonomously, the client credentials grant is recommended. ๐ซถ
For details on the different grant types, see Section 1.3 of [RFC6749]. The OAuth 2.0 framework provides an extension mechanism for defining additional grant types, so profiles of this framework MAY define additional grant types, if needed. ๐
5.5. Client Credentials ๐
Authentication of the client is mandatory independent of the grant type when requesting an access token from the token endpoint. In the case of the client credentials grant type, the authentication and grant coincide. ๐
Client registration and provisioning of client credentials to the client is out of scope for this specification. ๐
The OAuth framework defines one client credential type in Section 2.3.1 of [RFC6749] that comprises the client_id and client_secret values. [OAUTH-RPCC] adds raw public key and pre-shared key to the client credentials type. Profiles of this framework MAY extend it with an additional client credentials type using client certificates. โจ
5.6. AS Authentication ๐ก๏ธ
The client credentials grant does not, by default, authenticate the AS that the client connects to. In classic OAuth, the AS is authenticated with a TLS server certificate. ๐ธ
Profiles of this framework MUST specify how clients authenticate the AS and how communication security is implemented. By default, server side TLS certificates, as defined by OAuth 2.0, are required. ๐
5.7. The Authorization Endpoint ๐ฆ
The OAuth 2.0 authorization endpoint is used to interact with the resource owner and obtain an authorization grant in certain grant flows. The primary use case for the ACE-OAuth framework is for machine-to-machine interactions that do not involve the resource owner in the authorization flow; therefore, this endpoint is out of scope here. Future profiles may define constrained adaptation mechanisms for this endpoint as well. Nonconstrained clients interacting with constrained resource servers can use the specification in Section 3.1 of [RFC6749] and the attack countermeasures suggested in Section 4.2 of [RFC6819]. ๐
5.8. The Token Endpoint ๐
In standard OAuth 2.0, the AS provides the token endpoint for submitting access token requests. This framework extends the functionality of the token endpoint, giving the AS the possibility to help the client and RS establish shared keys or exchange their public keys. Furthermore, this framework defines encodings using CBOR as a substitute for JSON. โจ
The endpoint may also be exposed over HTTPS, as in classical OAuth or even other transports. A profile MUST define the details of the mapping between the fields described below and these transports. If HTTPS with JSON is used, the semantics of Sections 4.1.3 and 4.1.4 of the OAuth 2.0 specification [RFC6749] MUST be followed (with additions as described below). If CBOR is used as the payload format, the semantics described in this section MUST be followed. ๐ซถ
For the AS to be able to issue a token, the client MUST be authenticated and present a valid grant for the scopes requested. Profiles of this framework MUST specify how the AS authenticates the client and how the communication between the client and AS is protected, fulfilling the requirements specified in Section 5. ๐
The default name of this endpoint in a url-path SHOULD be /token. However, implementations are not required to use this name and can define their own instead. ๐
5.8.1. Client-to-AS Request ๐จ
The client sends a POST request to the token endpoint at the AS. The profile MUST specify how the communication is protected. The content of the request consists of the parameters specified in the relevant subsection of Section 4 of the OAuth 2.0 specification [RFC6749], depending on the grant type, with the following exceptions and additions:
- The
grant_typeparameter is OPTIONAL in the context of this framework (as opposed to REQUIRED in [RFC6749]). If that parameter is missing, the default value"client_credentials"is implied. ๐ - The audience parameter from [RFC8693] is OPTIONAL to request an access token bound to a specific audience. ๐ง
- The
cnonceparameter defined in Section 5.8.4.4 is REQUIRED if the RS provided a client-nonce in the AS Request Creation Hints message (Section 5.3). ๐ - The
scopeparameter MAY be encoded as a byte string instead of the string encoding specified in Section 3.3 of [RFC6749] or in order to allow compact encoding of complex scopes. The syntax of such a binary encoding is explicitly not specified here and left to profiles or applications. Note specifically that a binary encoded scope does not necessarily use the space character0x20to delimit scope-tokens. ๐ธ - The client can send an empty (null value)
ace_profileparameter to indicate that it wants the AS to include theace_profileparameter in the response. See Section 5.8.4.3. ๐ฆ - A client MUST be able to use the parameters from [RFC9201] in an access token request to the token endpoint, and the AS MUST be able to process these additional parameters. ๐
The default behavior is that the AS generates a symmetric proof-of-possession key for the client. In order to use an asymmetric key pair or to reuse a key previously established with the RS, the client is supposed to use the req_cnf parameter from [RFC9201]. ๐
If CoAP is used, then these parameters MUST be provided in a CBOR map (see Table 5). ๐
When HTTP is used as a transport, then the client makes a request to the token endpoint; the parameters MUST be encoded as defined in Appendix B of [RFC6749]. ๐
The following examples illustrate different types of requests for proof-of-possession tokens. ๐ง
Figure 4 shows a request for a token with a symmetric proof-of-possession key, using diagnostic notation. ๐
Header: POST (Code=0.02)
Uri-Host: "as.example.com"
Uri-Path: "token"
Content-Format: application/ace+cbor
Payload:
{
/ client_id / 24 : "myclient",
/ audience / 5 : "tempSensor4711"
}
Figure 4: Example Request for an Access Token Bound to a
Symmetric Key
Figure 5 shows a request for a token with an asymmetric proof-of-possession key. Note that, in this example, OSCORE [RFC8613] is used to provide object-security; therefore, the Content-Format is "application/oscore" wrapping the "application/ace+cbor" type content. The OSCORE option has a decoded interpretation appended in parentheses for the reader's convenience. Also note that, in this example, the audience is implicitly known by both the client and AS. Furthermore, note that this example uses the req_cnf parameter from [RFC9201]. ๐ฆ
Header: POST (Code=0.02)
Uri-Host: "as.example.com"
Uri-Path: "token"
OSCORE: 0x09, 0x05, 0x44, 0x6C
(h=0, k=1, n=001, partialIV= 0x05, kid=[0x44, 0x6C])
Content-Format: application/oscore
Payload:
0x44025d1/ ... (full payload omitted for brevity) ... /68b3825e
Decrypted payload:
{
/ client_id / 24 : "myclient",
/ req_cnf / 4 : {
/ COSE_Key / 1 : {
/ kty / 1 : 2 / EC2 /,
/ kid / 2 : h'11',
/ crv / -1 : 1 / P-256 /,
/ x / -2 : b64'usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8',
/ y / -3 : b64'IBOL+C3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4'
}
}
}
Figure 5: Example Token Request Bound to an Asymmetric Key
Figure 6 shows a request for a token where a previously communicated proof-of-possession key is only referenced using the req_cnf parameter from [RFC9201]. โจ
Header: POST (Code=0.02)
Uri-Host: "as.example.com"
Uri-Path: "token"
Content-Format: application/ace+cbor
Payload:
{
/ client_id / 24 : "myclient",
/ audience / 5 : "valve424",
/ scope / 9 : "read",
/ req_cnf / 4 : {
/ kid / 3 : b64'6kg0dXJM13U'
}
}
Figure 6: Example Request for an Access Token Bound to a Key Reference
Refresh tokens are typically not stored as securely as proof-of-possession keys in requesting clients. Proof-of-possession-based refresh token requests MUST NOT request different proof-of-possession keys or different audiences in token requests. Refresh token requests can only be used to request access tokens bound to the same proof-of-possession key and the same audience as access tokens issued in the initial token request. ๐ฅ
5.8.2. AS-to-Client Response โจ
okay so if the AS has verified the access token request and the client is allowed to get an access token for that request ๐ฅน, the AS sends back a response with the CoAP-equivalent code 2.01 (Created) ๐. If the client's request was invalid or the client isn't authorized, the AS sends an error response instead, which we cover in Section 5.8.3 ๐ .
Note that the AS gets to decide which token type and profile it uses when it issues a successful response ๐. It's assumed the AS already knows what the client and the RS can do, which is Appendix D ๐ง. That prior knowledge could be set up with a dynamic client registration protocol exchange [RFC7591] ๐ธ. And if the client asked for a specific proof-of-possession key using the req_cnf parameter from [RFC9201], that can also nudge which profile gets picked, since the AS needs to support the key type the client asked for ๐.
The content of the successful reply is the Access Information ๐ฆ. With CoAP, the payload MUST be encoded as a CBOR map. With HTTP, it's a JSON map, as specified in Section 5.1 of [RFC6749] ๐. In both cases the parameters from Section 5.1 of [RFC6749] get used, with these extra bits and changes:
- ace_profile ๐ : This parameter is OPTIONAL unless the request included an empty ace_profile parameter, in which case it is MANDATORY ๐ซถ. It tells the client the profile it MUST use towards the RS. Check Section 5.8.4.3 for how to format it. If this parameter is absent, the AS assumes the client implicitly knows which profile to use towards the RS ๐.
- token_type ๐: This parameter is OPTIONAL, as opposed to REQUIRED in [RFC6749] โจ. By default, implementations of this framework SHOULD assume the token_type is "PoP" ๐. If a specific use case needs another token_type (for example "Bearer"), then this parameter is REQUIRED ๐ฅ.
On top of that, [RFC9201] defines more parameters that the AS MUST be able to use when it responds to a request at the token endpoint ๐.
Table 2 sums up the parameters that can currently be part of the Access Information. Future extensions may define more parameters ๐ฆ.
+===================+==============+
| Parameter name | Specified in |
+===================+==============+
| access_token | [RFC6749] |
+-------------------+--------------+
| token_type | [RFC6749] |
+-------------------+--------------+
| expires_in | [RFC6749] |
+-------------------+--------------+
| refresh_token | [RFC6749] |
+-------------------+--------------+
| scope | [RFC6749] |
+-------------------+--------------+
| state | [RFC6749] |
+-------------------+--------------+
| error | [RFC6749] |
+-------------------+--------------+
| error_description | [RFC6749] |
+-------------------+--------------+
| error_uri | [RFC6749] |
+-------------------+--------------+
| ace_profile | RFC 9200 |
+-------------------+--------------+
| cnf | [RFC9201] |
+-------------------+--------------+
| rs_cnf | [RFC9201] |
+-------------------+--------------+
Table 2: Access Information
Parameters
Figure 7 shows a response with a token and a cnf parameter holding a symmetric proof-of-possession key, which is defined in [RFC9201] ๐. Heads up: the key identifier kid is only there to make indexing and retrieving the key easier, so don't assume it's unique in the domains of either the client or the RS ๐.
Header: Created (Code=2.01)
Content-Format: application/ace+cbor
Payload:
{
/ access_token / 1 : b64'SlAV32hk'/ ...
(remainder of CWT omitted for brevity;
CWT contains COSE_Key in the cnf claim)/,
/ ace_profile / 38 : "coap_dtls",
/ expires_in / 2 : 3600,
/ cnf / 8 : {
/ COSE_Key / 1 : {
/ kty / 1 : 4 / Symmetric /,
/ kid / 2 : b64'39Gqlw',
/ k / -1 : b64'hJtXhkV8FJG+Onbc6mxC'
}
}
}
Figure 7: Example AS Response with an Access Token Bound to a
Symmetric Key
5.8.3. Error Response โจ
The error responses for AS interactions are mostly the same as the ones in Section 5.2 of [RFC6749], with these exceptions ๐ :
- When using CoAP, the payload MUST be encoded as a CBOR map, with the Content-Format "application/ace+cbor". When using HTTP, the payload is encoded in JSON, as specified in Section 5.2 of [RFC6749] ๐.
- A response code equivalent to the CoAP code 4.00 (Bad Request) MUST be used for all error responses, except for invalid_client. For invalid_client, a response code equivalent to the CoAP code 4.01 (Unauthorized) MAY be used under the same conditions as specified in Section 5.2 of [RFC6749] ๐ซถ.
- The parameters error, error_description, and error_uri MUST be abbreviated using the codes specified in Table 5, when a CBOR encoding is used ๐ฅ.
- The error code (i.e., value of the error parameter) MUST be abbreviated, as specified in Table 3, when a CBOR encoding is used ๐.
+===========================+=============+========================+
| Name | CBOR Values | Original Specification |
+===========================+=============+========================+
| invalid_request | 1 | Section 5.2 of |
| | | [RFC6749] |
+---------------------------+-------------+------------------------+
| invalid_client | 2 | Section 5.2 of |
| | | [RFC6749] |
+---------------------------+-------------+------------------------+
| invalid_grant | 3 | Section 5.2 of |
| | | [RFC6749] |
+---------------------------+-------------+------------------------+
| unauthorized_client | 4 | Section 5.2 of |
| | | [RFC6749] |
+---------------------------+-------------+------------------------+
| unsupported_grant_type | 5 | Section 5.2 of |
| | | [RFC6749] |
+---------------------------+-------------+------------------------+
| invalid_scope | 6 | Section 5.2 of |
| | | [RFC6749] |
+---------------------------+-------------+------------------------+
| unsupported_pop_key | 7 | RFC 9200 |
+---------------------------+-------------+------------------------+
| incompatible_ace_profiles | 8 | RFC 9200 |
+---------------------------+-------------+------------------------+
Table 3: CBOR Abbreviations for Common Error Codes
Besides the error responses from OAuth 2.0, the AS MUST implement the following behavior ๐ธ:
- If the client submits an asymmetric key in the token request that the RS cannot process, the AS MUST reject that request with a response code equivalent to the CoAP code 4.00 (Bad Request), including the error code "unsupported_pop_key" specified in Table 3 ๐ โโ๏ธ.
- If the client and the RS it has requested an access token for do not share a common profile, the AS MUST reject that request with a response code equivalent to the CoAP code 4.00 (Bad Request), including the error code "incompatible_ace_profiles" specified in Table 3 ๐.
5.8.4. Request and Response Parameters โจ
This section gives you more detail about the new parameters you can use in access token requests and responses ๐ง. It also covers the shorter abbreviations for existing parameters and common parameter values, so everything packs down nicely ๐ฆ.
5.8.4.1. Grant Type ๐
The abbreviations in the registry defined in Section 8.5 MUST be used in CBOR encodings instead of the string values defined in [RFC6749], if CBOR payloads are used ๐ .
+====================+============+============================+
| Name | CBOR Value | Original Specification |
+====================+============+============================+
| password | 0 | Section 4.3.2 of [RFC6749] |
+--------------------+------------+----------------------------+
| authorization_code | 1 | Section 4.1.3 of [RFC6749] |
+--------------------+------------+----------------------------+
| client_credentials | 2 | Section 4.4.2 of [RFC6749] |
+--------------------+------------+----------------------------+
| refresh_token | 3 | Section 6 of [RFC6749] |
+--------------------+------------+----------------------------+
Table 4: CBOR Abbreviations for Common Grant Types
5.8.4.2. Token Type ๐ฆ
The token_type parameter, defined in Section 5.1 of [RFC6749], lets the AS tell the client what kind of access token it's getting, like a bearer token ๐.
This document registers the new value "PoP" for the "OAuth Access Token Types" registry, which means a proof-of-possession token ๐. How the client proves possession to the RS MUST be specified by the profiles ๐.
The values in the token_type parameter MUST use the CBOR abbreviations defined in the registry specified by Section 8.7 if a CBOR encoding is used ๐.
In this framework, the "pop" value for the token_type parameter is the default. The AS may, however, provide a different value from those registered in [IANA.OAuthAccessTokenTypes] ๐.
5.8.4.3. Profile ๐
okay so bestie, profiles of this framework MUST define the communication protocol and the communication security protocol between the client and the RS ๐. The security protocol MUST provide encryption, integrity, and replay protection ๐ . It MUST also provide a binding between requests and responses ๐ฆ. And if a profile supports proof-of-possession tokens, it MUST define a list of allowed proof-of-possession methods โจ. No cap, these rules are non-negotiable.
A profile MUST specify an identifier that MUST be used to uniquely identify itself in the ace_profile parameter ๐ธ. The text version of the profile identifier is there so humans can read it and so JSON-based interactions can use it, but it MUST NOT be used for CBOR-based interactions ๐. Profiles MUST register their identifier in the registry defined in Section 8.8 ๐.
Profiles MAY define additional parameters for both the token request and the Access Information in the access token response ๐ง. That's how they can negotiate or signal profile-specific stuff, and it's giving flexibility ๐.
If a client wants the AS to send back the ace_profile parameter in the access token response, it can ask for it by sending an ace_profile parameter in the access token request ๐ซถ. For CBOR-based interactions, the value is null. If CBOR isn't being used, the value is an empty string ๐.
5.8.4.4. Client-Nonce ๐
this parameter MUST be sent from the client to the AS if the client previously received a cnonce parameter in the AS Request Creation Hints (Section 5.3) ๐ญ. It's encoded as a byte string for CBOR-based interactions, and as a string (base64url without padding encoded binary [RFC4648]) if CBOR is not used โจ. The client MUST copy the value from the cnonce parameter in the AS Request Creation Hints, so no creative edits allowed ๐
.
5.8.5. Mapping Parameters to CBOR ๐ฆ
if CBOR encoding is used, all OAuth parameters in access token requests and responses MUST be mapped to CBOR types ๐ฅ. The mapping follows the registry defined by Section 8.10, and each parameter uses its given integer abbreviation for the map keys ๐.
Also, the abbreviations for claims line up with the ones defined in [RFC8392] ๐. Abbreviations from -24 to 23 take up a single byte in CBOR, so those were given to the parameters we expect to see most often in constrained scenarios โญ.
+===================+==========+=============+===============+
| Name | CBOR Key | Value Type | Original |
| | | | Specification |
+===================+==========+=============+===============+
| access_token | 1 | byte string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| expires_in | 2 | unsigned | [RFC6749] |
| | | integer | |
+-------------------+----------+-------------+---------------+
| audience | 5 | text string | [RFC8693] |
+-------------------+----------+-------------+---------------+
| scope | 9 | text or | [RFC6749] |
| | | byte string | |
+-------------------+----------+-------------+---------------+
| client_id | 24 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| client_secret | 25 | byte string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| response_type | 26 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| redirect_uri | 27 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| state | 28 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| code | 29 | byte string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| error | 30 | integer | [RFC6749] |
+-------------------+----------+-------------+---------------+
| error_description | 31 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| error_uri | 32 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| grant_type | 33 | unsigned | [RFC6749] |
| | | integer | |
+-------------------+----------+-------------+---------------+
| token_type | 34 | integer | [RFC6749] |
+-------------------+----------+-------------+---------------+
| username | 35 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| password | 36 | text string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| refresh_token | 37 | byte string | [RFC6749] |
+-------------------+----------+-------------+---------------+
| ace_profile | 38 | integer | RFC 9200 |
+-------------------+----------+-------------+---------------+
| cnonce | 39 | byte string | RFC 9200 |
+-------------------+----------+-------------+---------------+
Table 5: CBOR Mappings Used in Token Requests and Responses
5.9. The Introspection Endpoint ๐
Token introspection [RFC7662] MAY be implemented by the AS and the RS ๐. If it's implemented, it MAY be used by the RS to ask the AS for metadata about a given token, like whether it's still valid or what scope it has ๐ซ. This section works like the protocol in [RFC7662] for HTTP and JSON, but adapts it for more constrained environments by using CBOR and leaving the application protocol choice to the profile ๐ง. The client MAY also implement and use introspection in the same way the RS does, to get info about a given token ๐ซง.
Communication between the requesting entity and the introspection endpoint at the AS MUST be integrity protected and encrypted ๐. The communication security protocol MUST also provide a binding between requests and responses ๐. The two interacting parties MUST perform mutual authentication ๐ค. Finally, the AS SHOULD verify that the requesting entity has the right to access introspection information about the provided token ๐. Profiles of this framework that support introspection MUST specify how authentication and communication security between the requesting entity and the AS is implemented ๐ .
The default name of this endpoint in a url-path SHOULD be '/introspect' ๐ท. Implementations aren't required to use that name, though, and they can define their own instead ๐ฆ.
5.9.1. Introspection Request ๐
The requesting entity sends a POST request to the introspection endpoint at the AS ๐ฌ. The profile MUST specify how the communication is protected ๐ก๏ธ. If CoAP is used, the payload MUST be encoded as a CBOR map with a token entry containing the access token ๐งธ. Extra optional parameters that give the AS more context, which the requesting entity already knows, MAY be included to help it respond ๐ญ.
For CoAP-based interaction, all messages MUST use the content type "application/ace+cbor" ๐ฆ. For HTTP, the encoding defined in Section 2.1 of [RFC7662] is used ๐.
The same parameters are required and optional as in Section 2.1 of [RFC7662] ๐.
For example, Figure 8 shows an RS calling the token introspection endpoint at the AS to ask about an OAuth 2.0 proof-of-possession token ๐ต๏ธโโ๏ธ. This example assumes object security based on OSCORE [RFC8613], so the Content-Format is "application/oscore" โจ. Figure 9 shows the decoded payload ๐ซถ.
Header: POST (Code=0.02)
Uri-Host: "as.example.com"
Uri-Path: "introspect"
OSCORE: 0x09, 0x05, 0x25
Content-Format: application/oscore
Payload:
... COSE content ...
Figure 8: Example Introspection Request
{
/ token / 11 : b64'7gj0dXJQ43U',
/ token_type_hint / 33 : 2 / PoP /
}
Figure 9: Decoded Payload
5.9.2. Introspection Response ๐บ
If the introspection request is authorized and successfully processed, the AS sends a response with the response code equivalent to the CoAP code 2.01 (Created) ๐. If the introspection request was invalid, not authorized, or couldn't be processed, the AS returns an error response, as described in Section 5.9.3 ๐ฅฒ.
For a successful response, the AS encodes the response parameters in a map ๐บ๏ธ. If CoAP is used, this MUST be encoded as a CBOR map ๐. If HTTP is used, the JSON encoding specified in Section 2.2 of [RFC7662] is used ๐ง. The map containing the response payload includes the same required and optional parameters as in Section 2.2 of [RFC7662], plus the following additions โจ:
ace_profile This parameter is OPTIONAL ๐. It indicates the profile that the RS MUST use with the client. See Section 5.8.4.3 for more details on how this parameter is formatted ๐. If this parameter is absent, the AS assumes that the RS implicitly knows which profile to use towards the client ๐ง .
cnonce This parameter is OPTIONAL ๐ซง. It's a client-nonce that the client gave to the AS. The RS MUST verify that it matches the client-nonce previously provided to the client in the AS Request Creation Hints. See Sections 5.3 and 5.8.4.4 ๐. When encoded in CBOR, its value is a byte string. When encoded in JSON, its value is the base64url encoding of that byte string, without padding [RFC4648] ๐.
cti This parameter is OPTIONAL ๐ฆ. It's the cti claim associated with this access token. It has the same meaning and processing rules as the jti parameter defined in Section 3.1.2 of [RFC7662], except that its value is a byte string when encoded in CBOR and is the base64url encoding of that byte string without padding when encoded in JSON [RFC4648] ๐ธ.
exi This parameter is OPTIONAL ๐. It's the expires_in claim associated with this access token. See Section 5.10.3 โฐ.
Furthermore, [RFC9201] defines more parameters that the AS MUST be able to use when responding to a request to the introspection endpoint ๐งฉ.
For example, Figure 10 shows an AS response to the introspection request in Figure 8. This example contains the cnf parameter defined in [RFC9201] ๐.
Header: Created (Code=2.01)
Content-Format: application/ace+cbor
Payload:
{
/ active / 10 : true,
/ scope / 9 : "read",
/ ace_profile / 38 : 1 / coap_dtls /,
/ cnf / 8 : {
/ COSE_Key / 1 : {
/ kty / 1 : 4 / Symmetric /,
/ kid / 2 : b64'39Gqlw',
/ k / -1 : b64'hJtXhkV8FJG+Onbc6mxC'
}
}
}
Figure 10: Example Introspection Response
5.9.3. Error Response โ
okay so the error responses for CoAP-based chats with the AS are basically the same vibe as the HTTP ones, see Section 2.3 of [RFC7662] ๐ , with a few plot twists:
- If content is sent and CoAP is used, the payload MUST be encoded as a CBOR map and the Content-Format "application/ace+cbor" MUST be used. For HTTP, the encoding defined in Section 2.3 of [RFC6749] is used. ๐
- If the credentials used by the requesting entity (usually the RS) are invalid, the AS MUST respond with the response code equivalent to the CoAP code 4.01 (Unauthorized) and use the required and optional parameters from Section 2.3 of [RFC7662]. ๐
- If the requesting entity does not have the right to perform this introspection request, the AS MUST respond with a response code equivalent to the CoAP code 4.03 (Forbidden). In this case, no payload is returned. ๐ซ
- The parameters error, error_description, and error_uri MUST be abbreviated using the codes specified in Table 5. โ๏ธ
- The error codes MUST be abbreviated using the codes specified in the registry defined by Section 8.4. ๐
Note that a properly formed and authorized query for an inactive or otherwise invalid token does not warrant an error response by this specification. In these cases, the authorization server MUST instead respond with an introspection response with the active field set to "false". ๐ so it's not an error, it's just a "nope, that token is dead" answer, iykyk ๐
5.9.4. Mapping Introspection Parameters to CBOR ๐งฉ
okay so if CBOR is in the mix, the introspection request and response parameters MUST be mapped to CBOR types, as specified in the registry defined by Section 8.12, using the given integer abbreviation for the map key. ๐
Note that we have aligned abbreviations that correspond to a claim with the abbreviations defined in [RFC8392] and the abbreviations of parameters with the same name from Section 5.8.5. It's giving consistency, bestie ๐ everything lines up so nobody gets confused ๐ง
+===================+======+======================+===============+
| Parameter name | CBOR | Value Type | Original |
| | Key | | Specification |
+===================+======+======================+===============+
| iss | 1 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| sub | 2 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| aud | 3 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| exp | 4 | integer or floating- | [RFC7662] |
| | | point number | |
+-------------------+------+----------------------+---------------+
| nbf | 5 | integer or floating- | [RFC7662] |
| | | point number | |
+-------------------+------+----------------------+---------------+
| iat | 6 | integer or floating- | [RFC7662] |
| | | point number | |
+-------------------+------+----------------------+---------------+
| cti | 7 | byte string | RFC 9200 |
+-------------------+------+----------------------+---------------+
| scope | 9 | text or byte string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| active | 10 | True or False | [RFC7662] |
+-------------------+------+----------------------+---------------+
| token | 11 | byte string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| client_id | 24 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| error | 30 | integer | [RFC7662] |
+-------------------+------+----------------------+---------------+
| error_description | 31 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| error_uri | 32 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| token_type_hint | 33 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| token_type | 34 | integer | [RFC7662] |
+-------------------+------+----------------------+---------------+
| username | 35 | text string | [RFC7662] |
+-------------------+------+----------------------+---------------+
| ace_profile | 38 | integer | RFC 9200 |
+-------------------+------+----------------------+---------------+
| cnonce | 39 | byte string | RFC 9200 |
+-------------------+------+----------------------+---------------+
| exi | 40 | unsigned integer | RFC 9200 |
+-------------------+------+----------------------+---------------+
Table 6: CBOR Mappings for Token Introspection Parameters
5.10. The Access Token ๐๏ธ
In this framework, the use of CBOR Web Token (CWT) as specified in [RFC8392] is RECOMMENDED. CWTs are the main character here, no cap ๐
In order to facilitate offline processing of access tokens, this document uses the cnf claim from [RFC8747] and the scope claim from [RFC8693] for JWT- and CWT-encoded tokens. In addition to string encoding specified for the scope claim, a binary encoding MAY be used. The syntax of such an encoding is explicitly not specified here and left to profiles or applications, specifically note that a binary encoded scope does not necessarily use the space character '0x20' to delimit scope-tokens. the spec is literally leaving this one to the profiles, so no guessing allowed ๐ โโ๏ธ
If the AS needs to convey a hint to the RS about which profile it should use to communicate with the client, the AS MAY include an ace_profile claim in the access token, with the same syntax and semantics as defined in Section 5.8.4.3. โจ
If the client submitted a cnonce parameter in the access token request (Section 5.8.4.4), the AS MUST include the value of this parameter in the cnonce claim specified here. The cnonce claim uses binary encoding. ๐ซถ
5.10.1. The Authorization Information Endpoint ๐ช
The access token, containing authorization information and information about the proof-of-possession method used by the client, needs to be transported to the RS so that the RS can authenticate and authorize the client request. it's the VIP pass to get past the bouncer ๐ซ
This section defines a method for transporting the access token to the RS using a RESTful protocol, such as CoAP. Profiles of this framework MAY define other methods for token transport. ๐ฆ
The method consists of an authz-info endpoint, implemented by the RS. A client using this method MUST make a POST request to the authz-info endpoint at the RS with the access token in the payload. The CoAP Content-Format or HTTP media type MUST reflect the format of the token, e.g., "application/cwt", for CBOR Web Tokens; if no Content-Format or media type is defined for the token format, "application/octet-stream" MUST be used. the format label has to match the token, periodt ๐
The RS receiving the token MUST verify the validity of the token. If the token is valid, the RS MUST respond to the POST request with a response code equivalent to CoAP code 2.01 (Created). Section 5.10.1.1 outlines how an RS MUST proceed to verify the validity of an access token. ๐
The RS MUST be prepared to store at least one access token for future use. This is a difference as to how access tokens are handled in OAuth 2.0, where the access token is typically sent along with each request and therefore not stored at the RS. so this is a big glow-up compared to plain OAuth 2.0 โจ
When using this framework, it is RECOMMENDED that an RS stores only one token per proof-of-possession key. This means that an additional token linked to the same key will supersede any existing token at the RS by replacing the corresponding authorization information. The reason is that this greatly simplifies (constrained) implementations, with respect to required storage and resolving a request to the applicable token. The use of multiple access tokens for a single client increases the strain on the resource server, as it must consider every access token and calculate the actual permissions of the client. Also, tokens may contradict each other, which may lead the server to enforce wrong permissions. If one of the access tokens expires earlier than others, the resulting permissions may offer insufficient protection. one token per key keeps things clean and drama-free ๐งน๐ธ
If the payload sent to the authz-info endpoint does not parse to a token, the RS MUST respond with a response code equivalent to the CoAP code 4.00 (Bad Request). ๐
The RS MAY make an introspection request to validate the token before responding to the POST request to the authz-info endpoint, e.g., if the token is an opaque reference. Some transport protocols may provide a way to indicate that the RS is busy and the client should retry after an interval; this type of status update would be appropriate while the RS is waiting for an introspection response. basically "hold on, I'm checking" energy โณ
Profiles MUST specify whether the authz-info endpoint is protected, including whether error responses from this endpoint are protected. Note that since the token contains information that allows the client and the RS to establish a security context in the first place, mutual authentication may not be possible at this point. ๐ this part is kinda dramatic, the token is literally how they get to know each other, so mutual auth might not be on the table yet ๐ญ
The default name of this endpoint in a url-path is '/authz-info'; however, implementations are not required to use this name and can define their own instead. ๐ /authz-info is the default, but you do you, bestie ๐
5.10.1.1. Verifying an Access Token โจ
okay bestie, when an RS gets an access token, it MUST verify it before storing it ๐. How the checks go depends on a bunch of stuff: the token encoding, the type of token, the security protection on it, and the claims. The encoding matters bc the security protection is different for each one ๐ . Like, a CWT uses COSE, while a JWT uses JSON Object Signing and Encryption (JOSE). The type of token changes the whole vibe too ๐ฆ. A self-contained token may get verified locally at the RS, but a reference token needs more back-and-forth with the authorization server, like token introspection, to get the claims tied to that reference. Self-contained tokens MUST at least be integrity protected, but they MAY also be encrypted ๐.
For self-contained tokens, the RS MUST process the security protection of the token first, as specified by the respective token format. For CWT, the description can be found in [RFC8392]; for JWT, the relevant specification is [RFC7519]. This MUST include a verification that security protection (and thus the token) was generated by an AS that has the right to issue access tokens for this RS ๐ง.
If the token is communicated by reference, the RS needs to obtain the claims first. When the RS uses token introspection, the relevant specification is [RFC7662], with CoAP transport specified in Section 5.9 ๐ธ.
Errors may happen during this initial processing stage ๐:
- If the verification of the security wrapper fails, or the token was issued by an AS that does not have the right to issue tokens for the receiving RS, the RS MUST discard the token and, if this was an interaction with authz-info, return an error message with a response code equivalent to the CoAP code
4.01 (Unauthorized). - If the claims cannot be obtained, the RS MUST discard the token and, in case of an interaction via the authz-info endpoint, return an error message with a response code equivalent to the CoAP code
4.00 (Bad Request).
Next, the RS MUST verify claims, if present, contained in the access token. Errors are returned when claim checks fail, in the order of priority of this list ๐:
iss: The iss claim (if present) must identify the AS that has produced the security protection for the access token. If that is not the case, the RS MUST discard the token. If this was an interaction with authz-info, the RS MUST also respond with a response code equivalent to the CoAP code4.01 (Unauthorized).exp: The expiration date must be in the future. If that is not the case, the RS MUST discard the token. If this was an interaction with authz-info, the RS MUST also respond with a response code equivalent to the CoAP code4.01 (Unauthorized). Note that the RS has to terminate access rights to the protected resources at the time when the tokens expire โฐ.aud: The aud claim must refer to an audience that the RS identifies with. If that is not the case, the RS MUST discard the token. If this was an interaction with authz-info, the RS MUST also respond with a response code equivalent to the CoAP code4.03 (Forbidden).scope: The RS must recognize value of the scope claim. If that is not the case, the RS MUST discard the token. If this was an interaction with authz-info, the RS MUST also respond with a response code equivalent to the CoAP code4.00 (Bad Request). The RS MAY provide additional information in the error response to clarify what went wrong ๐.
Additional processing may be needed for other claims in a way specific to a profile or the underlying application.
Note that the sub (Subject) claim cannot always be verified when the token is submitted to the RS, since the client may not have authenticated yet ๐คทโโ๏ธ. Also note that a counter for the exi (expires in) claim MUST be initialized when the RS first verifies this token โญ.
Also note that profiles of this framework may define access token transport mechanisms that do not allow for error responses. Therefore, the error messages specified here only apply if the token was sent to the authz-info endpoint ๐.
When sending error responses, the RS MAY use the error codes from Section 3.1 of [RFC6750] to provide additional details to the client ๐ซถ.
5.10.1.2. Protecting the Authorization Information Endpoint ๐ก๏ธ
As this framework can be used in RESTful environments, it is important to make sure that attackers cannot perform unauthorized requests on the authz-info endpoints, other than submitting access tokens. Main character energy: only token submissions get through the door ๐ช.
Specifically, it SHOULD NOT be possible to perform GET, DELETE, or PUT on the authz-info endpoint.
The RS SHOULD implement rate-limiting measures to mitigate attacks aiming to overload the processing capacity of the RS by repeatedly submitting tokens ๐. For CoAP-based communication, the RS could use the mechanisms from [RFC8516] to indicate that it is overloaded ๐ฆ.
5.10.2. Client Requests to the RS ๐
Before sending a request to an RS, the client MUST verify that the keys used to protect this communication are still valid. See Section 5.10.4 for details on how the client determines the validity of the keys used ๐.
If an RS receives a request from a client and the target resource requires authorization, the RS MUST first verify that it has an access token that authorizes this request and that the client has performed the proof-of-possession binding for that token to the request ๐งพ.
The response code MUST be 4.01 (Unauthorized) in case the client has not performed the proof of possession or if the RS has no valid access token for the client. If the RS has an access token for the client but the token does not authorize access for the resource that was requested, the RS MUST reject the request with a 4.03 (Forbidden). If the RS has an access token for the client but it does not cover the action that was requested on the resource, the RS MUST reject the request with a 4.05 (Method Not Allowed) ๐
โโ๏ธ.
Note: The use of the response codes4.03and4.05is intended to prevent infinite loops where a client optimistically tries to access a requested resource with any access token received from AS. As malicious clients could pretend to be the C to determine the C's privileges, these detailed response codes must be used only when a certain level of security is already available, which can be achieved only when the client is authenticated ๐.
Note: The RS MAY use introspection for timely validation of an access token at the time when a request is presented ๐ต๏ธโโ๏ธ.
Note: Matching the claims of the access token (e.g., scope) to a specific request is application specific ๐งฉ.
If the request matches a valid token and the client has performed the proof of possession for that token, the RS continues to process the request as specified by the underlying application ๐.
5.10.3. Token Expiration โณ
Depending on the capabilities of the RS, there are various ways in which it can verify the expiration of a received access token. The following is a list of the possibilities, including what functionality they require of the RS ๐.
- The token is a CWT and includes an
expclaim and possibly thenbfclaim. The RS verifies these by comparing them to values from its internal clock, as defined in [RFC7519]. In this case, the RS's internal clock must reflect the current date and time, or at least be synchronized with the AS's clock. How this clock synchronization would be performed is out of scope for this specification โ. - The RS verifies the validity of the token by performing an introspection request, as specified in Section 5.9. This requires the RS to have a reliable network connection to the AS and to be able to handle two secure sessions in parallel (C to RS and RS to AS) ๐งต.
- In order to support token expiration for devices that have no reliable way of synchronizing their internal clocks, this specification defines the following approach: The claim
exi(expires in) can be used to provide the RS with the lifetime of the token in seconds from the time the RS first receives the token. This mechanism only works for self-contained tokens, i.e., CWTs and JWTs. For CWTs, this parameter is encoded as an unsigned integer, while JWTs encode this as a JSON number ๐. - Processing this claim requires that the RS does the following:
- For each token the RS receives that contains an
exiclaim, keep track of the time it received that token, and revisit that list regularly to expunge expired tokens ๐งน. - Keep track of the identifiers of tokens containing the
exiclaim that have expired (in order to avoid accepting them again). In order to avoid an unbounded memory usage growth, this MUST be implemented in the following way when theexiclaim is used:- When creating the token, the AS MUST add a
cticlaim (orjtifor JWTs) to the access token. The value of this claim MUST be created as the binary representation of the concatenation of the identifier of the RS with a sequence number counting the tokens containing anexiclaim, issued by this AS for the RS ๐ข. - The RS MUST store the highest sequence number of an expired token containing the
exiclaim that it has seen, and treat tokens with lower sequence numbers as expired. Note that this could lead to discarding valid tokens with lower sequence numbers if the AS were to issue tokens of different validity time for the same RS. The assumption is that typically tokens in such a scenario would all have the same validity time ๐ซ .
- When creating the token, the AS MUST add a
- For each token the RS receives that contains an
If a token that authorizes a long-running request, such as a CoAP Observe [RFC7641], expires, the RS MUST send an error response with the response code equivalent to the CoAP code 4.01 (Unauthorized) to the client, and then terminate processing the long-running request ๐.
5.10.4. Key Expiration ๐
okay so the AS hands the client the key material the RS is going to use ๐ that can be either a shared symmetric PoP key, or an asymmetric key the RS uses to authenticate itself towards the client. and here's the lowkey scary part ๐ญ there is currently no expiration metadata attached to those keys, so the client literally has no way of knowing if they're still valid. that means it could send sensitive info to the RS with a key that's expired and possibly in an attacker's hands, OR it could accept responses from the RS that aren't properly protected and could have been forged by an attacker. not it ๐
so to prevent this, the client must assume those keys are only valid as long as the related access token is. and since the access token is opaque to the client (it can't peek inside ๐), one of the following methods MUST be used to inform the client about the validity of an access token:
- The client knows a default validity time for all tokens it is using (aka how long a token is valid after being issued ๐ฐ๏ธ). This info could be provisioned to the client when it's registered at the AS, or published by the AS in a way the client can query.
- The AS informs the client about the token validity using the
expires_inparameter in the Access Information.
A client that is not able to obtain information about the expiration of a token MUST NOT use this token. no cap, that's a hard stop ๐ซ
6. Security Considerations ๐ก๏ธ
Security considerations applicable to authentication and authorization in RESTful environments provided in OAuth 2.0 [RFC6749] apply to this work. Furthermore, [RFC6819] provides additional security considerations for OAuth, which apply to IoT deployments as well. If the introspection endpoint is used, the security considerations from [RFC7662] also apply. it's giving "read the fine print" energy, bestie ๐
The following subsections address issues specific to this document and its use in constrained environments.
6.1. Protecting Tokens ๐
A large range of threats can be mitigated by protecting the contents of the access token using a digital signature or a keyed message digest, e.g., a Message Authentication Code (MAC) or an Authenticated Encryption with Associated Data (AEAD) algorithm. Consequently, the token integrity protection MUST be applied to prevent the token from being modified, particularly since it contains a reference to the symmetric key or the asymmetric key used for proof of possession. If the access token contains the symmetric key, this symmetric key MUST be encrypted by the authorization server so that only the resource server can decrypt it. Note that using an AEAD algorithm is preferable over using a MAC unless the token needs to be publicly readable. โจ
If the token is intended for multiple recipients (i.e., an audience that is a group), integrity protection of the token with a symmetric key, shared between the AS and the recipients, is not sufficient. the reason is that any of the recipients could modify the token undetected by the other recipients ๐ฌ Therefore, a token with a multirecipient audience MUST be protected with an asymmetric signature.
It is important for the authorization server to include the identity of the intended recipient (the audience), typically a single resource server (or a list of resource servers), in the token. The same shared secret MUST NOT be used as a proof-of-possession key with multiple resource servers, since the benefit from using the proof-of-possession concept is then significantly reduced. main character energy for PoP keys is one RS per key, periodt ๐
If clients are capable of doing so, they should frequently request fresh access tokens, as this allows the AS to keep the lifetime of the tokens short. This allows the AS to use shorter proof-of-possession key sizes, which translate to a performance benefit for the client and for the resource server. Shorter keys also lead to shorter messages (particularly with asymmetric keying material). ๐ฆ
When authorization servers bind symmetric keys to access tokens, they SHOULD scope these access tokens to a specific permission.
In certain situations, it may be necessary to revoke an access token that is still valid. Client-initiated revocation is specified in [RFC7009] for OAuth 2.0. Other revocation mechanisms are currently not specified, as the underlying assumption in OAuth is that access tokens are issued with a relatively short lifetime. This may not hold true for disconnected constrained devices needing access tokens with relatively long lifetimes, and would therefore necessitate further standardization work that is out of scope for this document. ๐ธ
6.2. Communication Security ๐ก
Communication with the authorization server MUST use confidentiality protection. This step is extremely important since the client or the RS may obtain the proof-of-possession key from the authorization server for use with a specific access token. Not using confidentiality protection exposes this secret (and the access token) to an eavesdropper, thereby completely negating proof-of-possession security. ๐ซฃ The requirements for communication security of profiles are specified in Section 5.
Additional protection for the access token can be applied by encrypting it. For example, encryption of CWTs is specified in Section 7.1 of [RFC8392]. Such additional protection can be necessary if the token is later transferred over an insecure connection (e.g., when it is sent to the authz-info endpoint). ๐ง
Care must be taken by developers to prevent leakage of the PoP credentials (i.e., the private key or the symmetric key). An adversary in possession of the PoP credentials bound to the access token will be able to impersonate the client. Be aware that this is a real risk with many constrained environments, since adversaries may get physical access to the devices and can therefore use physical extraction techniques to gain access to memory contents. This risk can be mitigated to some extent by making sure that keys are refreshed frequently, by using software isolation techniques, and by using hardware security. ๐
6.3. Long-Term Credentials ๐๏ธ
Both the clients and RSs have long-term credentials that are used to secure communications and authenticate to the AS. These credentials need to be protected against unauthorized access. In constrained devices deployed in publicly accessible places, such protection can be difficult to achieve without specialized hardware (e.g., secure key storage memory).
If credentials are lost or compromised, the operator of the affected devices needs to have procedures to invalidate any access these credentials give, and needs to revoke tokens linked to such credentials. The loss of a credential linked to a specific device MUST NOT lead to a compromise of other credentials not linked to that device; therefore, secret keys used for authentication MUST NOT be shared between more than two parties. ๐
Operators of the clients or RSs SHOULD have procedures in place to replace credentials that are suspected to have been compromised or that have been lost.
Operators also SHOULD have procedures for decommissioning devices that include securely erasing credentials and other security-critical material in the devices being decommissioned. ๐งน
6.4. Unprotected AS Request Creation Hints ๐โโ๏ธ
Initially, no secure channel exists to protect the communication between the C and RS. Thus, the C cannot determine if the AS Request Creation Hints contained in an unprotected response from the RS to an unauthorized request (see Section 5.3) are authentic. Therefore, the C MUST determine if an AS is authorized to provide access tokens for a certain RS. How this determination is implemented is out of scope for this document and left to the applications. ๐คทโโ๏ธ
6.5. Minimal Security Requirements for Communication ๐
This section summarizes the minimal requirements for the communication security of the different protocol interactions. โ
C-AS
All communication between the client and the authorization server MUST be encrypted and integrity and replay protected. Furthermore, responses from the AS to the client MUST be bound to the client's request, to avoid attacks where the attacker swaps the intended response for an older one valid for a previous request. This requires that the client and the authorization server have previously exchanged either a shared secret or their public keys in order to negotiate a secure communication. Furthermore, the client MUST be able to determine whether an AS has the authority to issue access tokens for a certain RS. This can, for example, be done through preconfigured lists or through an online lookup mechanism that in turn also must be secured.
RS-AS
The communication between the resource server and the authorization server via the introspection endpoint MUST be encrypted and integrity and replay protected. Furthermore, responses from the AS to the RS MUST be bound to the RS's request. This requires that the RS and the authorization server have previously exchanged either a shared secret or their public keys in order to negotiate a secure communication. Furthermore, the RS MUST be able to determine whether an AS has the authority to issue access tokens itself. This is usually configured out of band, but could also be performed through an online lookup mechanism, provided that it is also secured in the same way.
C-RS
The initial communication between the client and the resource server cannot be secured in general, since the RS is not in possession of an access token for that client, which would carry the necessary parameters. If both parties support DTLS without client authentication, it is RECOMMENDED to use this mechanism for protecting the initial communication. After the client has successfully transmitted the access token to the RS, a secure communication protocol MUST be established between the client and RS for the actual resource request. This protocol MUST provide confidentiality, integrity, and replay protection, as well as a binding between requests and responses. This requires that the client learned either the RS's public key or received a symmetric proof-of-possession key bound to the access token from the AS. The RS must have learned either the client's public key, a shared symmetric key from the claims in the token, or an introspection request. Since ACE does not provide profile negotiation between the C and RS, the client MUST have learned what profile the RS supports (e.g., from the AS or preconfigured) and initiated the communication accordingly. that's the whole security picture, and it's a lot, but every piece matters ๐
6.6. Token Freshness and Expiration โฐ
okay so an RS that's offline has a clock drift problem ๐ญ It can't sync its clock with the AS, which means it could get tricked into accepting old access tokens that aren't valid anymore or that got compromised ๐ To prevent this, an RS may use the nonce-based mechanism (cnonce) defined in Section 5.3 to make sure an Access Token presented to it is fresh ๐ซถ
Another clock drift headache is that checking the standard token expiration claim exp can give unpredictable results. Not ideal, bestie ๐
How much clock drift is acceptable depends a lot on the app. The big factors are how long access tokens are valid and how critical it is for the token to expire on time โจ
The exi claim expiration mechanism, which is based on the first time the RS sees the token, was created as a more predictable option ๐ฆ It still has some drawbacks you need to think about:
- A malicious client may hold back tokens with the
exiclaim in order to prolong their lifespan. - If an RS loses state (e.g., due to an unscheduled reboot), it may lose the current values of counters tracking the
exiclaims of tokens it is storing.
The first drawback is baked into the deployment scenario and the exi solution itself ๐ค so it can't be fixed without requiring the RS to be online at times. The second one can be mitigated by regularly storing the value of exi counters to persistent memory ๐พ
6.7. Combining Profiles ๐งฉ
okay so there might be use cases where different transport and security protocols are allowed for different interactions. If that isn't explicitly covered by an existing profile, it basically means combining profiles into a new one ๐ For example, a new profile could say that a previously defined MQTT-TLS profile is used between the client and the RS, paired with a previously defined CoAP-DTLS profile for interactions between the client and the AS ๐ The new profile that combines existing profiles MUST specify how the existing profiles' security requirements remain satisfied. Therefore, any profile MUST clearly specify its security requirements and MUST document if its security depends on the combination of various protocol interactions. ๐ฅ
6.8. Unprotected Information ๐
Communication with the authz-info endpoint, plus the various error responses defined in this framework, can potentially include sending information over an unprotected channel. These messages may leak information to an adversary or be manipulated by active attackers to induce incorrect behavior. For example, error responses for requests to the authorization information endpoint can reveal information about an otherwise opaque access token to an adversary who has intercepted that token ๐ฌ
As far as error messages go, this framework is written under the assumption that, in general, the benefits of detailed error messages outweigh the risk of information leakage. For particular use cases where this assessment doesn't apply, detailed error messages can be swapped out for more generic ones ๐ธ
In some scenarios, it may be possible to protect communication with the authz-info endpoint (e.g., through DTLS with only server-side authentication). In cases where that isn't possible, it is RECOMMENDED to use encrypted CWTs or tokens that are opaque references and need to be subjected to introspection by the RS.
If the initial Unauthorized Resource Request message (see Section 5.2) is used, the client MUST make sure it is not sending sensitive content in this request. GET and DELETE requests only reveal the target URI of the resource, but POST and PUT requests would reveal the whole payload of the intended operation ๐
Since the client isn't authenticated at the point where it submits an access token to the authz-info endpoint, attackers may pretend to be a client and try to trick an RS into using an obsolete profile that specifies a vulnerable security mechanism. Such an attack would require a valid access token containing an ace_profile claim requesting the use of that obsolete profile. Resource owners should update the configuration of their RSs so they can't use such obsolete profiles ๐
6.9. Identifying Audiences ๐ฏ
The aud claim, as defined in [RFC7519], and the equivalent audience parameter from [RFC8693] are intentionally vague about how to match the audience value to a specific RS. This is intended to allow application-specific semantics. This section gives some general guidance on using audiences in constrained environments ๐
URLs aren't a good way to identify mobile devices that can switch networks and get associated with new URLs ๐ฑ If the audience represents a single RS and asymmetric keys are used, the RS can be uniquely identified by a hash of its public key. If this approach is used, it is RECOMMENDED to apply the procedure from Section 3 of [RFC6920].
If the audience addresses a group of resource servers, the mapping of a group identifier to an individual RS has to be provisioned to each RS before the group-audience is usable. Managing dynamic groups could be an issue if any RS isn't always reachable when group memberships change. Furthermore, issuing access tokens bound to symmetric proof-of-possession keys that apply to a group-audience is problematic, because an RS that holds the access token can impersonate the client towards the other RSs in the group ๐ฑ It is therefore NOT RECOMMENDED to issue access tokens bound to a group-audience and symmetric proof-of possession keys.
Even the client must be able to determine the correct values to put into the audience parameter in order to obtain a token for the intended RS. Errors in this process can lead to the client inadvertently getting a token for the wrong RS ๐ The correct audience values can either be provisioned to the client as part of its configuration or dynamically looked up by the client in some directory. In the latter case, the integrity and correctness of the directory data must be assured. Note that the audience hint provided by the RS as part of the AS Request Creation Hints (Section 5.3) isn't typically source authenticated or integrity protected, so it should not be treated as a trusted value ๐ซฃ
6.10. Denial of Service Against or with Introspection ๐จ
The optional introspection mechanism provided by OAuth and supported in the ACE framework allows for two types of attacks that implementers need to consider ๐ง
First, an attacker could launch a denial-of-service attack against the introspection endpoint at the AS to stop access tokens from being validated. To keep the system secure, an RS that is configured to use introspection MUST NOT allow access based on a token for which it couldn't reach the introspection endpoint.
Second, an attacker could use the fact that an RS performs introspection to launch a denial-of-service attack against that RS, by repeatedly sending tokens to its authz-info endpoint that require an introspection call ๐ The RS can mitigate these attacks by rate-limiting how many introspection requests it performs in a given time interval for a certain client IP address submitting tokens to /authz-info. Once that limit is hit, incoming requests from that address get rejected for a certain amount of time. A general rate limit on introspection requests should also be considered to mitigate distributed attacks ๐ก๏ธ
7. Privacy Considerations ๐
Implementers and users should be aware of the privacy implications of the different possible deployments of this framework ๐
The AS is in a very central position and can potentially learn sensitive information about the clients requesting access tokens. If the client credentials grant is used, the AS can track what kind of access the client intends to perform ๐ณ With other grants, the resource owner can prevent this. To do so, the resource owner needs to bind the grants it issues to anonymous, ephemeral credentials that don't allow the AS to link different grants, and therefore different access token requests from the same client ๐ฅท
The claims in a token can reveal privacy-sensitive information about the client and the RS to any party with access to them (whether by processing the content of a self-contained token or by introspection). The AS SHOULD be configured to minimize the information about clients and RSs disclosed in the tokens it issues ๐ค
If tokens are only integrity protected and not encrypted, they may reveal information to attackers listening on the wire, or attackers may be able to acquire the access tokens in some other way. In the case of CWTs, the token may, e.g., reveal the audience, the scope, and the confirmation method used by the client. The confirmation method may reveal the identity of the device or application running the client, which may be linkable to the identity of the person using the client (if there is a person and not a machine-to-machine interaction) ๐ซ
Clients using asymmetric keys for proof of possession should be aware of the consequences of using the same key pair with different RSs. A set of colluding RSs, or an attacker able to obtain the access tokens, will be able to link the requests or even determine the client's identity ๐ต๏ธโโ๏ธ
An unprotected response to an unauthorized request (see Section 5.3) may disclose information about the RS and/or its existing relationship with the C. It's a good idea to include as little information as possible in an unencrypted response. Even the absolute URI of the AS may reveal sensitive information about the service the RS provides ๐ Developers must make sure the RS doesn't disclose information that affects the privacy of the stakeholders in the AS Request Creation Hints. They may choose to use a different mechanism for discovering the AS if necessary. If means of encrypting communication between the C and RS already exist, more detailed information may be included in an error response, so the C has enough info to react to that particular error ๐ง
8. IANA Considerations ๐ธ
This document creates several registries with a registration policy of Expert Review. Guidelines for the experts are given in Section 8.17 ๐
8.1. ACE Authorization Server Request Creation Hints ๐
This specification establishes the IANA "ACE Authorization Server Request Creation Hints" registry โจ
The columns of the registry are:
Name: The name of the parameter.CBOR Key: CBOR map key for the parameter. Different ranges of values use different registration policies [RFC8126]. Integer values from -256 to 255 are designated as Standards Action. Integer values from -65536 to -257 and from 256 to 65535 are designated as Specification Required. Integer values greater than 65535 are designated as Expert Review. Integer values less than -65536 are marked as Private Use.Value Type: The CBOR data types allowable for the values of this parameter.Reference: This contains a pointer to the public specification of the Request Creation Hint abbreviation, if one exists.
This registry has been initially populated by the values in Table 1. The Reference column for all of these entries is this document ๐
8.2. CoRE Resource Types ๐
okay bestie, IANA just registered a brand new Resource Type (rt=) Link Target Attribute in the "Resource Type (rt=) Link Target Attribute Values" subregistry, which lives under the "Constrained RESTful Environments (CoRE) Parameters" [IANA.CoreParameters] registry ๐ง
- Value:
ace.ai - Description: ACE-OAuth authz-info endpoint resource.
- Reference: RFC 9200
specific ACE-OAuth profiles can use this common resource type to define their own profile-specific discovery processes ๐
8.3. OAuth Extensions Errors โจ
this spec registers the following error values in the "OAuth Extensions Error Registry" [IANA.OAuthExtensionsErrorRegistry] ๐
- Name:
unsupported_pop_key - Name:
incompatible_ace_profiles
8.4. OAuth Error Code CBOR Mappings ๐ฆ
this spec sets up the IANA "OAuth Error Code CBOR Mappings" registry, and it's giving organized ๐ญ
the columns of the registry are:
- Name: the OAuth Error Code name. It refers to the name in Section 5.2 of [RFC6749], e.g.,
invalid_request. - CBOR Value: the CBOR abbreviation for this error code. Integer values less than -65536 are marked as Private Use. All other values use the registration policy Expert Review [RFC8126].
- Reference: this contains a pointer to the public specification of the error code abbreviation, if one exists.
- Original Specification: this contains a pointer to the public specification of the error code, if one exists.
this registry has been initially populated by the values in Table 3. The Reference column for all of these entries is this document ๐ธ
8.5. OAuth Grant Type CBOR Mappings ๐
this spec establishes the IANA "OAuth Grant Type CBOR Mappings" registry, so grant types get their own tiny CBOR nicknames now โจ
the columns of this registry are:
- Name: the name of the grant type, as specified in Section 1.3 of [RFC6749].
- CBOR Value: the CBOR abbreviation for this grant type. Integer values less than -65536 are marked as Private Use. All other values use the registration policy Expert Review [RFC8126].
- Reference: this contains a pointer to the public specification of the grant type abbreviation, if one exists.
- Original Specification: this contains a pointer to the public specification of the grant type, if one exists.
this registry has been initially populated by the values in Table 4. The Reference column for all of these entries is this document ๐ซถ
8.6. OAuth Access Token Types ๐
this section registers one new token type in the "OAuth Access Token Types" registry [IANA.OAuthAccessTokenTypes] and yes, it's the main character ๐
- Name: PoP
- Additional Token Endpoint Response Parameters:
cnf,rs_cnf(see Section 3.1 of [RFC8747] and Section 3.2 of [RFC9201]). - HTTP Authentication Scheme(s): N/A
- Change Controller: IETF
- Reference: RFC 9200
8.7. OAuth Access Token Type CBOR Mappings ๐
this spec establishes the IANA "OAuth Access Token Type CBOR Mappings" registry, which is the CBOR version of the token type names ๐งโโ๏ธ
the columns of this registry are:
- Name: the name of the token type, as registered in the "OAuth Access Token Types" registry, e.g., "Bearer".
- CBOR Value: the CBOR abbreviation for this token type. Integer values less than -65536 are marked as Private Use. All other values use the registration policy Expert Review [RFC8126].
- Reference: this contains a pointer to the public specification of the OAuth token type abbreviation, if one exists.
- Original Specification: this contains a pointer to the public specification of the OAuth token type, if one exists.
8.7.1. Initial Registry Contents ๐
- Name: Bearer
- Name: PoP
8.8. ACE Profiles ๐ธ
this spec establishes the IANA "ACE Profile" registry. Its columns are a whole vibe, so let's go ๐
- Name: the name of the profile to be used as the value of the profile attribute.
- Description: text giving an overview of the profile and the context it is developed for.
- CBOR Value: the CBOR abbreviation for this profile name. Different ranges of values use different registration policies [RFC8126]. Integer values from -256 to 255 are designated as Standards Action. Integer values from -65536 to -257 and from 256 to 65535 are designated as Specification Required. Integer values greater than 65535 are designated as Expert Review. Integer values less than -65536 are marked as Private Use.
- Reference: this contains a pointer to the public specification of the profile abbreviation, if one exists.
8.9. OAuth Parameters ๐ฆ
this spec registers the following parameter in the "OAuth Parameters" registry [IANA.OAuthParameters] ๐
- Name:
ace_profile - Parameter Usage Location: token response
- Change Controller: IETF
- Reference: Sections 5.8.2 and 5.8.4.3 of RFC 9200
8.10. OAuth Parameters CBOR Mappings โจ
this spec establishes the IANA "OAuth Parameters CBOR Mappings" registry ๐
the columns of this registry are:
- Name: the OAuth Parameter name. It refers to the name in the OAuth parameter registry, e.g.,
client_id. - CBOR Key: the CBOR map key for this parameter. Integer values less than -65536 are marked as Private Use. All other values use the registration policy Expert Review [RFC8126].
- Value Type: the allowable CBOR data types for values of this parameter.
- Reference: this contains a pointer to the public specification of the OAuth parameter abbreviation, if one exists.
- Original Specification: this contains a pointer to the public specification of the OAuth parameter, if one exists.
this registry has been initially populated by the values in Table 5. The Reference column for all of these entries is this document ๐
8.11. OAuth Introspection Response Parameters ๐ง
this spec registers the following parameters in the "OAuth Token Introspection Response" registry [IANA.TokenIntrospectionResponse] ๐ฅ
- Name:
ace_profile- Description: The ACE profile used between the client and RS.
- Change Controller: IETF
- Reference: Section 5.9.2 of RFC 9200
- Name:
cnonce- Description: "client-nonce". A nonce previously provided to the AS by the RS via the client. Used to verify token freshness when the RS cannot synchronize its clock with the AS.
- Change Controller: IETF
- Reference: Section 5.9.2 of RFC 9200
- Name
cti - Name:
exi- Description: "Expires in". Lifetime of the token in seconds from the time the RS first sees it. Used to implement a weaker form of token expiration for devices that cannot synchronize their internal clocks.
- Change Controller: IETF
- Reference: Section 5.9.2 of RFC 9200
8.12. OAuth Token Introspection Response CBOR Mappings ๐
this spec establishes the IANA "OAuth Token Introspection Response CBOR Mappings" registry ๐ซง
the columns of this registry are:
- Name: the OAuth Parameter name. It refers to the name in the OAuth parameter registry, e.g.,
client_id. - CBOR Key: the CBOR map key for this parameter. Integer values less than -65536 are marked as Private Use. All other values use the registration policy Expert Review [RFC8126].
- Value Type: the allowable CBOR data types for values of this parameter.
- Reference: this contains a pointer to the public specification of the introspection response parameter abbreviation, if one exists.
- Original Specification: this contains a pointer to the public specification of the OAuth Token Introspection parameter, if one exists.
this registry has been initially populated by the values in Table 6. The Reference column for all of these entries is this document.
note that the mappings of parameters corresponding to claim names intentionally coincide with the CWT claim name mappings from [RFC8392]. that's a deliberate match, not an accident ๐ฅน๐
8.13. JSON Web Token Claims ๐
this spec registers the following new claims in the "JSON Web Token Claims" subregistry under the "JSON Web Token (JWT)" registry [IANA.JsonWebTokenClaims] ๐ธ
- Claim Name:
ace_profile- Claim Description: The ACE profile a token is supposed to be used with.
- Change Controller: IETF
- Reference: Section 5.10 of RFC 9200
- Claim Name:
cnonce- Claim Description: "client-nonce". A nonce previously provided to the AS by the RS via the client. Used to verify token freshness when the RS cannot synchronize its clock with the AS.
- Change Controller: IETF
- Reference: Section 5.10 of RFC 9200
- Claim Name:
exi- Claim Description: "Expires in". Lifetime of the token in seconds from the time the RS first sees it. Used to implement a weaker form of token expiration for devices that cannot synchronize their internal clocks.
- Change Controller: IETF
- Reference: Section 5.10.3 of RFC 9200
8.14. CBOR Web Token Claims ๐งโโ๏ธ
this spec registers the following new claims in the "CBOR Web Token (CWT) Claims" registry [IANA.CborWebTokenClaims] โจ
- Claim Name:
ace_profile- Claim Description: The ACE profile a token is supposed to be used with.
- JWT Claim Name:
ace_profile - Claim Key: 38
- Claim Value Type: integer
- Change Controller: IETF
- Reference: Section 5.10 of RFC 9200
- Claim Name:
cnonce- Claim Description: The client-nonce sent to the AS by the RS via the client.
- JWT Claim Name:
cnonce - Claim Key: 39
- Claim Value Type: byte string
- Change Controller: IETF
- Reference: Section 5.10 of RFC 9200
- Claim Name:
exi- Claim Description: The expiration time of a token measured from when it was received at the RS in seconds.
- JWT Claim Name:
exi - Claim Key: 40
- Claim Value Type: unsigned integer
- Change Controller: IETF
- Reference: Section 5.10.3 of RFC 9200
- Claim Name:
scope
8.15. Media Type Registration ๐ฆ
this spec registers the application/ace+cbor media type for messages of the protocols defined in this document that carry parameters encoded in CBOR. This registration follows the procedures specified in [RFC6838] ๐
- Type name: application
- Subtype name: ace+cbor
- Required parameters: N/A
- Optional parameters: N/A
- Encoding considerations: Must be encoded as a CBOR map containing the protocol parameters defined in RFC 9200.
- Security considerations: See Section 6 of RFC 9200
- Interoperability considerations: N/A
- Published specification: RFC 9200
- Applications that use this media type: The type is used by authorization servers, clients, and resource servers that support the ACE framework with CBOR encoding, as specified in RFC 9200.
- Fragment identifier considerations: N/A
- Additional information: N/A
- Person & email address to contact for further information: IESG <iesg@ietf.org>
- Intended usage: COMMON
- Restrictions on usage: none
- Author: Ludwig Seitz <ludwig.seitz@combitech.se>
- Change controller: IETF
8.16. CoAP Content-Formats โจ
Okay so, this one's a quick flex ๐ The following entry has been registered in the "CoAP Content-Formats" registry:
Media Type: application/ace+cbor
Encoding: -
ID: 19
Reference: RFC 9200
Content-Format 19 is officially ours ๐ง
8.17. Expert Review Instructions ๐
Every IANA registry this document sets up uses a registration policy of Expert Review. This section gives some general guidelines for what the experts should look for. But they're experts for a reason, so they should get substantial latitude ๐
Expert Reviewers should take the following points into consideration:
- Point squatting should be discouraged ๐ โโ๏ธ Reviewers are encouraged to get enough information in registration requests to make sure the usage won't duplicate something already registered and that the point is likely to show up in real deployments. The zones tagged as Private Use are meant for testing and closed environments, so code points in other ranges should not be assigned for testing.
- Specifications are needed for the first-come, first-serve range if the point is expected to be used outside closed environments in an interoperable way. When no specification is provided, the description needs enough information to identify what the point is being used for.
- Experts should take the expected usage of fields into account when approving a point assignment. The fact that there's a range for Standards Track documents doesn't mean a Standards Track document can't get points outside that range. The length of the encoded value should be weighed against how many code points of that length are left, i.e., the size of the device it'll be used on ๐ง
- There's going to be a lot of overlap between these registries and the contents of the OAuth parameters [IANA.OAuthParameters] registries, so experts should require new registrations to stay aligned with parameters from OAuth that have comparable functionality. Deviating from that alignment should only be allowed if there are functional differences motivated by the use case that can't be easily or efficiently handled by a comparable OAuth parameter. ๐
9. References ๐
9.1. Normative References
- [IANA.CborWebTokenClaims] IANA, "CBOR Web Token (CWT) Claims",
https://www.iana.org/assignments/cwt. - [IANA.CoreParameters] IANA, "Constrained RESTful Environments (CoRE) Parameters",
https://www.iana.org/assignments/core-parameters. - [IANA.JsonWebTokenClaims] IANA, "JSON Web Token Claims",
https://www.iana.org/assignments/jwt. - [IANA.OAuthAccessTokenTypes] IANA, "OAuth Access Token Types",
https://www.iana.org/assignments/oauth-parameters. - [IANA.OAuthExtensionsErrorRegistry] IANA, "OAuth Extensions Error Registry",
https://www.iana.org/assignments/oauth-parameters. - [IANA.OAuthParameters] IANA, "OAuth Parameters",
https://www.iana.org/assignments/oauth-parameters. - [IANA.TokenIntrospectionResponse] IANA, "OAuth Token Introspection Response",
https://www.iana.org/assignments/oauth-parameters. - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997,
https://www.rfc-editor.org/info/rfc2119. - [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, January 2005,
https://www.rfc-editor.org/info/rfc3986. - [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
https://www.rfc-editor.org/info/rfc4648. - [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, January 2012,
https://www.rfc-editor.org/info/rfc6347. - [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", RFC 6749, DOI 10.17487/RFC6749, October 2012,
https://www.rfc-editor.org/info/rfc6749. - [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization Framework: Bearer Token Usage", RFC 6750, DOI 10.17487/RFC6750, October 2012,
https://www.rfc-editor.org/info/rfc6750. - [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, DOI 10.17487/RFC6838, January 2013,
https://www.rfc-editor.org/info/rfc6838. - [RFC6920] Farrell, S., Kutscher, D., Dannewitz, C., Ohlman, B., Keranen, A., and P. Hallam-Baker, "Naming Things with Hashes", RFC 6920, DOI 10.17487/RFC6920, April 2013,
https://www.rfc-editor.org/info/rfc6920. - [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10.17487/RFC7252, June 2014,
https://www.rfc-editor.org/info/rfc7252. - [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015,
https://www.rfc-editor.org/info/rfc7519. - [RFC7662] Richer, J., Ed., "OAuth 2.0 Token Introspection", RFC 7662, DOI 10.17487/RFC7662, October 2015,
https://www.rfc-editor.org/info/rfc7662. - [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 8126, DOI 10.17487/RFC8126, June 2017,
https://www.rfc-editor.org/info/rfc8126. - [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", RFC 8152, DOI 10.17487/RFC8152, July 2017,
https://www.rfc-editor.org/info/rfc8152. - [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017,
https://www.rfc-editor.org/info/rfc8174. - [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, May 2018,
https://www.rfc-editor.org/info/rfc8392. - [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, June 2019,
https://www.rfc-editor.org/info/rfc8610. - [RFC8693] Jones, M., Nadalin, A., Campbell, B., Ed., Bradley, J., and C. Mortimore, "OAuth 2.0 Token Exchange", RFC 8693, DOI 10.17487/RFC8693, January 2020,
https://www.rfc-editor.org/info/rfc8693. - [RFC8747] Jones, M., Seitz, L., Selander, G., Erdtman, S., and H. Tschofenig, "Proof-of-Possession Key Semantics for CBOR Web Tokens (CWTs)", RFC 8747, DOI 10.17487/RFC8747, March 2020,
https://www.rfc-editor.org/info/rfc8747. - [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", STD 94, RFC 8949, DOI 10.17487/RFC8949, December 2020,
https://www.rfc-editor.org/info/rfc8949. - [RFC9201] Seitz, L., "Additional OAuth Parameters for Authentication and Authorization in Constrained Environments (ACE)", RFC 9201, DOI 10.17487/RFC9201, August 2022,
https://www.rfc-editor.org/info/rfc9201.
9.2. Informative References ๐โจ
Okay bestie, these are the extra reads that help you understand the whole vibe, not the must-reads. ๐ง๐
[BLE] Bluetooth Special Interest Group, "Core Specification 5.3", Section 4.4, July 2021, https://www.bluetooth.com/specifications/bluetooth-core-specification/. ๐ก
[DCAF] Gerdes, S., Bergmann, O., and C. Bormann, "Delegated CoAP Authentication and Authorization Framework (DCAF)", Work in Progress, Internet-Draft, draft-gerdes-ace-dcaf-authorize-04, 19 October 2015, https://datatracker.ietf.org/doc/html/draft-gerdes-ace-dcaf-authorize-04. ๐
[Margi10impact] Margi, C., de Oliveira, B., de Sousa, G., Simplicio Jr, M., Barreto, P., Carvalho, T., Naeslund, M., and R. Gold, "Impact of Operating Systems on Wireless Sensor Networks (Security) Applications and Testbeds", Proceedings of the 19th International Conference on Computer Communications and Networks, DOI 10.1109/ICCCN.2010.5560028, August 2010, https://doi.org/10.1109/ICCCN.2010.5560028. ๐ฅ๏ธ
[MQTT5.0] Banks, A., Briggs, E., Borgendale, K., and R. Gupta, "MQTT Version 5.0", OASIS Standard, March 2019, https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html. ๐ฆ
[OAUTH-RPCC] Seitz, L., Erdtman, S., and M. Tiloca, "Raw-Public-Key and Pre-Shared-Key as OAuth client credentials", Work in Progress, Internet-Draft, draft-erdtman-oauth-rpcc-00, 21 November 2017, https://datatracker.ietf.org/doc/html/draft-erdtman-oauth-rpcc-00. ๐
[POP-KEY-DIST] Bradley, J., Hunt, P., Jones, M., Tschofenig, H., and M. Meszaros, "OAuth 2.0 Proof-of-Possession: Authorization Server to Client Key Distribution", Work in Progress, Internet-Draft, draft-ietf-oauth-pop-key-distribution-07, 27 March 2019, https://datatracker.ietf.org/doc/html/draft-ietf-oauth-pop-key-distribution-07. ๐ธ
[RFC4949] Shirey, R., "Internet Security Glossary, Version 2", FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, https://www.rfc-editor.org/info/rfc4949. ๐
[RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, https://www.rfc-editor.org/info/rfc6690. ๐
[RFC6819] Lodderstedt, T., Ed., McGloin, M., and P. Hunt, "OAuth 2.0 Threat Model and Security Considerations", RFC 6819, DOI 10.17487/RFC6819, January 2013, https://www.rfc-editor.org/info/rfc6819. ๐จ
[RFC7009] Lodderstedt, T., Ed., Dronia, S., and M. Scurtescu, "OAuth 2.0 Token Revocation", RFC 7009, DOI 10.17487/RFC7009, August 2013, https://www.rfc-editor.org/info/rfc7009. ๐๏ธ
[RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for Constrained-Node Networks", RFC 7228, DOI 10.17487/RFC7228, May 2014, https://www.rfc-editor.org/info/rfc7228. ๐ง
[RFC7521] Campbell, B., Mortimore, C., Jones, M., and Y. Goland, "Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants", RFC 7521, DOI 10.17487/RFC7521, May 2015, https://www.rfc-editor.org/info/rfc7521. ๐
[RFC7591] Richer, J., Ed., Jones, M., Bradley, J., Machulak, M., and P. Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", RFC 7591, DOI 10.17487/RFC7591, July 2015, https://www.rfc-editor.org/info/rfc7591. ๐
[RFC7641] Hartke, K., "Observing Resources in the Constrained Application Protocol (CoAP)", RFC 7641, DOI 10.17487/RFC7641, September 2015, https://www.rfc-editor.org/info/rfc7641. ๐
[RFC7744] Seitz, L., Ed., Gerdes, S., Ed., Selander, G., Mani, M., and S. Kumar, "Use Cases for Authentication and Authorization in Constrained Environments", RFC 7744, DOI 10.17487/RFC7744, January 2016, https://www.rfc-editor.org/info/rfc7744. ๐ก
[RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in the Constrained Application Protocol (CoAP)", RFC 7959, DOI 10.17487/RFC7959, August 2016, https://www.rfc-editor.org/info/rfc7959. ๐งฉ
[RFC8252] Denniss, W. and J. Bradley, "OAuth 2.0 for Native Apps", BCP 212, RFC 8252, DOI 10.17487/RFC8252, October 2017, https://www.rfc-editor.org/info/rfc8252. ๐ฑ
[RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, December 2017, https://www.rfc-editor.org/info/rfc8259. ๐งพ
[RFC8414] Jones, M., Sakimura, N., and J. Bradley, "OAuth 2.0 Authorization Server Metadata", RFC 8414, DOI 10.17487/RFC8414, June 2018, https://www.rfc-editor.org/info/rfc8414. ๐๏ธ
[RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, https://www.rfc-editor.org/info/rfc8446. ๐
[RFC8516] Keranen, A., ""Too Many Requests" Response Code for the Constrained Application Protocol", RFC 8516, DOI 10.17487/RFC8516, January 2019, https://www.rfc-editor.org/info/rfc8516. ๐
โโ๏ธ
[RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, "Object Security for Constrained RESTful Environments (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, https://www.rfc-editor.org/info/rfc8613. ๐ก๏ธ
[RFC8628] Denniss, W., Bradley, J., Jones, M., and H. Tschofenig, "OAuth 2.0 Device Authorization Grant", RFC 8628, DOI 10.17487/RFC8628, August 2019, https://www.rfc-editor.org/info/rfc8628. ๐บ
[RFC9000] Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based Multiplexed and Secure Transport", RFC 9000, DOI 10.17487/RFC9000, May 2021, https://www.rfc-editor.org/info/rfc9000. โก
[RFC9110] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP Semantics", STD 97, RFC 9110, DOI 10.17487/RFC9110, June 2022, https://www.rfc-editor.org/info/rfc9110. ๐
[RFC9113] Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113, DOI 10.17487/RFC9113, June 2022, https://www.rfc-editor.org/info/rfc9113. ๐
[RFC9147] Rescorla, E., Tschofenig, H., and N. Modadugu, "The Datagram Transport Layer Security (DTLS) Protocol Version 1.3", RFC 9147, DOI 10.17487/RFC9147, April 2022, https://www.rfc-editor.org/info/rfc9147. ๐
[RFC9202] Gerdes, S., Bergmann, O., Bormann, C., Selander, G., and L. Seitz, "Datagram Transport Layer Security (DTLS) Profile for Authentication and Authorization for Constrained Environments (ACE)", RFC 9202, DOI 10.17487/RFC9202, August 2022, https://www.rfc-editor.org/info/rfc9202. ๐
[RFC9203] Palombini, F., Seitz, L., Selander, G., and M. Gunnarsson, "The Object Security for Constrained RESTful Environments (OSCORE) Profile of the Authentication and Authorization for Constrained Environments (ACE) Framework", RFC 9203, DOI 10.17487/RFC9203, August 2022, https://www.rfc-editor.org/info/rfc9203. ๐
Appendix A. Design Justification โจ
okay bestie, this section is basically the "why did they do it like this" tea โ๐ . It explains the design decisions behind everything in this document. Section 3 lists the building blocks and gives a quick rundown of why each one matters, and this appendix is where we get into why some of those blocks exist instead of just using plain OAuth 2.0 as is ๐ฆ.
First up, the common IoT constraints that push everything in a different direction ๐ธ
Low Power Radio ๐: a lot of IoT devices run on a tiny battery that has to last forever, and for many constrained wireless devices the biggest energy drain is sending or receiving messages. It's roughly 10x more expensive than AES, per [Margi10impact] ๐ญ. So keeping the total communication overhead low is a big deal, and that means minimizing how many messages get sent and received and how big they are. This affects the message format and the protocol you pick. Using CoAP over UDP and CBOR-encoded messages handles some of this already ๐. Security protocols add to the overhead too, but they can sometimes be optimized. For example, where the security requirements allow it, authentication and key establishment might be swapped out for provisioning a security context from a trusted third party, using transport or application-layer security โจ.
Low CPU Speed ๐ข: some IoT devices have processors that are way slower than what most current Internet devices have. That limits which cryptographic operations can run in a timely way, and that affects things like protocol latency ๐. Symmetric key cryptography can be used instead of the more expensive public key cryptography, but only where the security requirements allow it. This may also need trusted, third-party-assisted secret key establishment using transport- or application-layer security ๐.
Small Amount of Memory ๐ง : microcontrollers in IoT devices often have only a small amount of RAM and flash, so there are limits on what processing can happen and how much code fits on the device. To shrink the code, you can put fewer and smaller protocol implementations in the firmware. In that case, CoAP may be used instead of HTTP, symmetric-key cryptography may be used instead of public-key cryptography, and CBOR may be used instead of JSON ๐. An authentication and key establishment protocol, like the DTLS handshake, also affects memory and code footprint compared to assisted key establishment ๐ง.
User Interface Limitations ๐: protecting access to resources is a major security and privacy feature. End users and enterprise customers may not want to give anyone access to the data their IoT device collects, or to the functions it offers to third parties ๐. Asking for permission through a rich user interface doesn't work in many IoT deployments, so these decisions get delegated to user-controlled devices that are better suited for the job, like smartphones and tablets ๐ฑ๐.
Communication Constraints ๐ถ: in some constrained settings, an IoT device can't talk to a given device all the time. Devices might be sleeping, or disconnected from the Internet because the area has no connectivity, because of cost, or for security reasons, like avoiding an entry point for denial-of-service attacks ๐ฌ.
The communication interactions this framework builds on (shown in Figure 1) can run over a bunch of different protocols, and not every part of the message flow gets used in every application because of those communication constraints ๐ฆ. CoAP deployments are expected, but the framework isn't limited to them. Protocols like HTTP or Bluetooth Smart communication, which don't necessarily use IP, could also be used. Using those means you need application-layer security over the various interfaces ๐ซถ.
With all of that in mind, here are the design decisions the framework made, and honestly they're iconic ๐๐
CBOR, COSE, CWT ๐: when you use this framework, it is RECOMMENDED to use CBOR [RFC8949] as the data format. When CBOR data needs protecting, using COSE [RFC8152] is RECOMMENDED. And where self-contained tokens are needed, it is RECOMMENDED to use CWT [RFC8392]. The goal is smaller messages on the wire, less RAM for data objects that have to stay in memory, and smaller libraries that devices need to support โจ.
CoAP ๐ธ: when you use this framework, it is RECOMMENDED to use CoAP [RFC7252] instead of HTTP. This doesn't rule out other protocols built for constrained devices, like Bluetooth Low Energy (see Section 3.2). It's the same goal again: smaller messages on the wire, less RAM for data objects, and smaller libraries ๐ .
Access Information ๐: this framework defines the name "Access Information" for data about the RS that the AS sends back to the client in an access token response (see Section 5.8.2). The point is to enable scenarios where a powerful client that supports multiple profiles needs to talk to an RS whose supported profiles and raw public key it doesn't know yet ๐งโจ.
Proof of Possession ๐: this framework uses proof-of-possession tokens with the cnf claim [RFC8747]. A request parameter cnf and a response parameter cnf are both defined for the token endpoint, and their value space is semantically and syntactically identical to the cnf claim. They let the client request confirmation keys and state them ๐. This makes token theft harder, which matters a lot in constrained use cases. Communication often passes through middleboxes, and those could steal bearer tokens and use them to get unauthorized access ๐ฑ.
Authz-Info endpoint ๐ฎ: this framework introduces a new way to give an RS access tokens. It exposes an authz-info endpoint that access tokens can be POSTed to. This reduces the size of the request message and the code complexity at the RS ๐. Request size is a problem because many constrained protocols have severe message size limits at the physical layer, like around 100 bytes. Bigger packets get fragmented, and that combines badly with high packet loss and the need to retransmit the whole message if even one packet gets lost ๐. So separating the request from sending the access tokens helps reduce fragmentation ๐ซถ.
Client Credentials Grant ๐ค: in this framework, using the client credentials grant is RECOMMENDED for machine-to-machine communication use cases, where a resource owner manually producing a grant token isn't feasible ๐ โโ๏ธ. The intention is that the resource owner prearranges authorization with the AS based on the client's own credentials instead. Then the client can get access tokens from the AS without any manual intervention ๐.
Introspection ๐: in this framework, access token introspection is RECOMMENDED in cases where the client is constrained so it can't easily get new access tokens. That happens when it has connectivity issues that stop it from talking to the AS ๐ฅบ. In that case, it is RECOMMENDED to use a long-term token, which could just be a simple reference. The RS is assumed to be able to talk to the AS, so it can do introspection to learn the claims tied to that token reference ๐ง . The big win is that the resource owner can change the claims linked to the token reference without having to contact the client at all. That means access rights can be granted or revoked on the fly, and honestly that's giving main character energy ๐โจ
Appendix B. Roles and Responsibilities ๐โจ
okay bestie, this is the who's responsible for what section and it's giving group project chart ๐๐ . Each role has its own to-do list, so let's go through them.
Resource Owner ๐ฆ
- Make sure that the RS is registered at the AS. This includes making known to the AS which profiles,
token_type, scopes, and key types (symmetric/asymmetric) the RS supports. Also making it known to the AS which audience(s) the RS identifies itself with. - Make sure that clients can discover the AS that is in charge of the RS.
- If the client-credentials grant is used, make sure that the AS has the necessary, up-to-date access control policies for the RS.
Requesting Party ๐ธ
- Make sure that the client is provisioned the necessary credentials to authenticate to the AS.
- Make sure that the client is configured to follow the security requirements of the requesting party when issuing requests (e.g., minimum communication security requirements or trust anchors).
- Register the client at the AS. This includes making known to the AS which profiles,
token_types, and key types (symmetric/asymmetric) for the client.
Authorization Server ๐
- Register the RS and manage corresponding security contexts.
- Register clients and authentication credentials.
- Allow resource owners to configure and update access control policies related to their registered RSs.
- Expose the token endpoint to allow clients to request tokens.
- Authenticate clients that wish to request a token.
- Process a token request using the authorization policies configured for the RS.
- Optionally, expose the introspection endpoint that allows RSs to submit token introspection requests.
- If providing an introspection endpoint, authenticate RSs that wish to get an introspection response.
- If providing an introspection endpoint, process token introspection requests.
- Optionally, handle token revocation.
- Optionally, provide discovery metadata. See [RFC8414].
- Optionally, handle refresh tokens.
Client ๐ง
- Discover the AS in charge of the RS that is to be targeted with a request.
- Submit the token request (see step (A) of Figure 1).
- Authenticate to the AS.
- Optionally (if not preconfigured), specify which RS, which resource(s), and which action(s) the request(s) will target.
- If raw public keys (RPKs) or certificates are used, make sure the AS has the right RPK or certificate for this client.
- Process the access token and Access Information (see step (B) of Figure 1).
- Check that the Access Information provides the necessary security parameters (e.g., PoP key or information on communication security protocols supported by the RS).
- Safely store the proof-of-possession key.
- If provided by the AS, safely store the refresh token.
- Send the token and request to the RS (see step (C) of Figure 1).
- Authenticate towards the RS (this could coincide with the proof-of-possession process).
- Transmit the token as specified by the AS (default is to the
authz-infoendpoint; alternative options are specified by profiles). - Perform the proof-of-possession procedure as specified by the profile in use (this may already have been taken care of through the authentication procedure).
- Process the RS response (see step (F) of Figure 1) of the RS.
Resource Server ๐
- Expose a way to submit access tokens. By default, this is the
authz-infoendpoint. - Process an access token.
- Verify the token is from a recognized AS.
- Check the token's integrity.
- Verify that the token applies to this RS.
- Check that the token has not expired (if the token provides expiration information).
- Store the token so that it can be retrieved in the context of a matching request.
Note: The order proposed here is not normative; any process that arrives at an equivalent result can be used. A noteworthy consideration is whether one can use cheap operations early on to quickly discard nonapplicable or invalid tokens before performing expensive cryptographic operations (e.g., doing an expiration check before verifying a signature).
- Process a request.
- Set up communication security with the client.
- Authenticate the client.
- Match the client against existing tokens.
- Check that tokens belonging to the client actually authorize the requested action.
- Optionally, check that the matching tokens are still valid, using introspection (if this is possible.)
- Send a response following the agreed upon communication security mechanism(s).
- Safely store credentials, such as raw public keys, for authentication or proof-of-possession keys linked to access tokens.
Appendix C. Requirements on Profiles ๐๐
this section is the cheat sheet for profile designers, so it's basically a checklist of what a profile can and has to do ๐ซถ
This section lists the requirements on profiles of this framework for the convenience of profile designers.
- Optionally, define new methods for the client to discover the necessary permissions and AS for accessing a resource different from the one proposed in Sections 5.1 and 4
- Optionally, specify new grant types (Section 5.4).
- Optionally, define the use of client certificates as client credential type (Section 5.5).
- Specify the communication protocol the client and RS must use (e.g., CoAP) (Sections 5 and 5.8.4.3).
- Specify the security protocol the client and RS must use to protect their communication (e.g., OSCORE or DTLS). This must provide encryption and integrity and replay protection (Section 5.8.4.3).
- Specify how the client and the RS mutually authenticate (Section 4).
- Specify the proof-of-possession protocol(s) and how to select one if several are available. Also specify which key types (e.g., symmetric/asymmetric) are supported by a specific proof-of-possession protocol (Section 5.8.4.2).
- Specify a unique
ace_profileidentifier (Section 5.8.4.3). - If introspection is supported, specify the communication and security protocol for introspection (Section 5.9).
- Specify the communication and security protocol for interactions between the client and AS. This must provide encryption, integrity protection, replay protection, and a binding between requests and responses (Sections 5 and 5.8).
- Specify how/if the
authz-infoendpoint is protected, including how error responses are protected (Section 5.10.1). - Optionally, define other methods of token transport than the
authz-infoendpoint (Section 5.10.1).
Appendix D. Assumptions on AS Knowledge about the C and RS ๐ง ๐
this one's about what the AS should already know about clients and RSs before it can answer token and introspection requests. ngl, it's a lot of background info, but it's all important ๐
This section lists the assumptions on what an AS should know about a client and an RS in order to be able to respond to requests to the token and introspection endpoints. How this information is established is out of scope for this document.
- The identifier of the client or RS.
- The profiles that the client or RS supports.
- The scopes that the RS supports.
- The audiences that the RS identifies with.
- The key types (e.g., pre-shared symmetric key, raw public key, key length, and other key parameters) that the client or RS supports.
- The types of access tokens the RS supports (e.g., CWT).
- If the RS supports CWTs, the COSE parameters for the crypto wrapper (e.g., algorithm, key-wrap algorithm, and key-length) that the RS supports.
- The expiration time for access tokens issued to this RS (unless the RS accepts a default time chosen by the AS).
- The symmetric key shared between the client and AS (if any).
- The symmetric key shared between the RS and AS (if any).
- The raw public key of the client or RS (if any).
- Whether the RS has synchronized time (and thus is able to use the
expclaim) or not.
Appendix E. Differences to OAuth 2.0 ๐๐ฆ
okay so this appendix is the "what's different from regular OAuth 2.0" tea โ It's basically OAuth 2.0 glow-up for tiny constrained devices, so it's lowkey iconic that they changed stuff.
This document adapts OAuth 2.0 to be suitable for constrained environments. This section lists the main differences from the normative requirements of OAuth 2.0.
Use of TLS ๐
OAuth 2.0 requires the use of TLS to protect the communication between the AS and client when requesting an access token, between the client and RS when accessing a resource, and between the AS and RS if introspection is used. This framework requires similar security properties but does not require that they be realized with TLS. See Section 5.
Cardinality of grant_type parameter ๐๏ธ
In client-to-AS requests using OAuth 2.0, the grant_type parameter is required (per [RFC6749]). In this framework, this parameter is optional. See Section 5.8.1.
Encoding of scope parameter ๐งต
In client-to-AS requests using OAuth 2.0, the scope parameter is string encoded (per [RFC6749]). In this framework, this parameter may also be encoded as a byte string. See Section 5.8.1.
Cardinality of token_type parameter ๐ท๏ธ
In AS-to-client responses using OAuth 2.0, the token_type parameter is required (per [RFC6749]). In this framework, this parameter is optional. See Section 5.8.2.
Access token retention ๐พ
In OAuth 2.0, the access token may be sent with every request to the RS. The exact use of access tokens depends on the semantics of the application and the session management concept it uses. In this framework, the RS must be able to store these tokens for later use. See Section 5.10.1.
Appendix F. Deployment Examples ๐งโโ๏ธ๐
the final stop for this part! This is where we see the framework in action with some real-world-ish IoT setups, and yes, it's giving a whole vibe โจ
There is a large variety of IoT deployments, as is indicated in Appendix A, and this section highlights a few common variants. This section is not normative but illustrates how the framework can be applied.
For each of the deployment variants, there are a number of possible security setups between clients, resource servers, and authorization servers. The main focus in the following subsections is on how authorization of a client request for a resource hosted by an RS is performed. This requires the security of the requests and responses between the clients and the RS to be considered.
Note: CBOR diagnostic notation is used for examples of requests and responses. ๐
F.1. Local Token Validation
In this scenario, the case where the resource server is offline is considered, i.e., it is not connected to the AS at the time of the access request. This access procedure involves steps (A), (B), (C), and (F) of Figure 1.
Since the resource server must be able to verify the access token locally, self-contained access tokens must be used.
This example shows the interactions between a client, the authorization server, and a temperature sensor acting as a resource server. Message exchanges A and B are shown in Figure 11.
A: The client first generates a public-private key pair used for communication security with the RS.
The client sends a CoAP POST request to the token endpoint at the AS. The security of this request can be transport or application layer. It is up the communication security profile to define. In the example, it is assumed that both the client and AS have performed mutual authentication, e.g., via DTLS. The request contains the public key of the client and the audience parameter set to "tempSensorInLivingRoom", a value that the temperature sensor identifies itself with. The AS evaluates the request and authorizes the client to access the resource.
B: The AS responds with a 2.05 (Content) response containing the Access Information, including the access token. The PoP access token contains the public key of the client, and the Access Information contains the public key of the RS. For communication security, this example uses DTLS RawPublicKey between the client and the RS. The issued token will have a short validity time, i.e., exp close to iat, in order to mitigate attacks using stolen client credentials. The token includes claims, such as scope, with the authorized access that an owner of the temperature device can enjoy. In this example, the scope claim issued by the AS informs the RS that the owner of the token that can prove the possession of a key is authorized to make a GET request against the /temperature resource and a POST request on the /firmware resource. Note that the syntax and semantics of the scope claim are application specific.
Note: In this example, it is assumed that the client knows what resource it wants to access and is therefore able to request specific audience and scope claims for the access token.
Authorization
Client Server
| |
|<=======>| DTLS Connection Establishment
| | and mutual authentication
| |
A: +-------->| Header: POST (Code=0.02)
| POST | Uri-Path:"token"
| | Content-Format: application/ace+cbor
| | Payload: <Request-Payload>
| |
B: |<--------+ Header: 2.05 Content
| 2.05 | Content-Format: application/ace+cbor
| | Payload: <Response-Payload>
| |
Figure 11: Token Request and Response Using Client Credentials
The information contained in the Request-Payload and the Response-Payload is shown in Figure 12. Note that the parameter rs_cnf from [RFC9201] is used to inform the client about the resource server's public key.
Request-Payload :
{
/ audience / 5 : "tempSensorInLivingRoom",
/ client_id / 24 : "myclient",
/ req_cnf / 4 : {
/ COSE_Key / 1 : {
/ kid / 2 : b64'1Bg8vub9tLe1gHMzV76e',
/ kty / 1 : 2 / EC2 /,
/ crv / -1 : 1 / P-256 /,
/ x / -2 : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',
/ y / -3 : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0'
}
}
}
Response-Payload :
{
/ access_token / 1 : b64'0INDoQEKoQVNKkXfb7xaWqMT'/ .../,
/ rs_cnf / 41 : {
/ COSE_Key / 1 : {
/ kid / 2 : b64'c29tZSBwdWJsaWMga2V5IGlk',
/ kty / 1 : 2 / EC2 /,
/ crv / -1 : 1 / P-256 /,
/ x / -2 : b64'MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4',
/ y / -3 : b64'4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM'
}
}
}
Figure 12: Request and Response Payload Details
The content of the access token is shown in Figure 13.
{
/ aud / 3 : "tempSensorInLivingRoom",
/ iat / 6 : 1563451500,
/ exp / 4 : 1563453000,
/ scope / 9 : "temperature_g firmware_p",
/ cnf / 8 : {
/ COSE_Key / 1 : {
/ kid / 2 : b64'1Bg8vub9tLe1gHMzV76e',
/ kty / 1 : 2 / EC2 /,
/ crv / -1 : 1 / P-256 /,
/ x / -2 : b64'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',
/ y / -3 : b64'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0'
}
}
}
Figure 13: Access Token Including Public Key of the Client
Messages C and F are shown in Figures 14 and 15.
C: The client then sends the PoP access token to the authz-info endpoint at the RS. This is a plain CoAP POST request, i.e., no transport or application-layer security is used between the client and RS since the token is integrity protected between the AS and RS. The RS verifies that the PoP access token was created by a known and trusted AS, which it applies to this RS, and that it is valid. The RS caches the security context together with authorization information about this client contained in the PoP access token.
Resource
Client Server
| |
C: +-------->| Header: POST (Code=0.02)
| POST | Uri-Path:"authz-info"
| | Payload: 0INDoQEKoQVN ...
| |
|<--------+ Header: 2.04 Changed
| 2.04 |
| |
Figure 14: Access Token Provisioning to the RS
The client and the RS runs the DTLS handshake using the raw public keys established in steps B and C.
The client sends a CoAP GET request to /temperature on the RS over DTLS. The RS verifies that the request is authorized based on previously established security context.
F: The RS responds over the same DTLS channel with a CoAP 2.05 Content response containing a resource representation as payload.
Resource
Client Server
| |
|<=======>| DTLS Connection Establishment
| | using Raw Public Keys
| |
+-------->| Header: GET (Code=0.01)
| GET | Uri-Path: "temperature"
| |
| |
| |
F: |<--------+ Header: 2.05 Content
| 2.05 | Payload: <sensor value>
| |
Figure 15: Resource Request and Response Protected by DTLS
F.2. Introspection Aided Token Validation ๐ฆ
okay so this one is for when the client is offline at access time but the RS is plugged into the back-end ๐ bestie, this is giving "the door is smart but the key fob is lowkey off-grid" energy ๐โจ So the RS can just use token introspection to ask the AS what the token actually means. The procedure is steps (A)-(F) of Figure 1, but steps (A) and (B) happen earlier, during a provisioning phase when the client still had connectivity to the AS ๐ธ
Since the client is offline for a while, the token has to be long lived ๐ And because the client is constrained, the token won't be self-contained (so not a CWT ๐ โโ๏ธ). It's just a reference, and the RS uses its connection to learn the claims through introspection. Here's an example with an offline client (key fob), an RS (online lock), and an AS. The provisioning step, where the client talks to the AS, is messages A and B, shown in Figure 16 ๐
Authorization consent from the resource owner can be preconfigured, or it can come from an interactive flow with the owner ๐ซถ For the key fob, the owner has a connected car and buys a generic key for it. They connect the fob to a computer that provides the UI for the device, and then the OAuth 2.0 implicit flow can be used to authorize the key for the car at the car manufacturer's AS ๐
Note: In this example, the client doesn't know which exact door it'll open, since the token request isn't sent at access time. So the scope and audience parameters are set pretty wide to start with ๐ Tailored values that narrow the claims to the specific RS being accessed can be given to that RS during an introspection step.
A: The client sends a CoAP POST request to the token endpoint at the AS ๐ฎ The request has the audience parameter set to "PACS1337" (Physical Access System (PACS)). That's the value that identifies the physical access control system the individual doors are connected to ๐ช The AS generates an access token as an opaque string, which it can match to the specific client and the targeted audience. It also generates a symmetric proof-of-possession key ๐ Communication security and authentication between the client and AS is assumed to be provided at the transport layer (e.g., via DTLS) using a pre-shared security context (pre-shared key (PSK), RPK, or certificate) ๐
B: The AS responds with a CoAP 2.05 Content response ๐ฌ The payload is the Access Information, including the access token and the symmetric proof-of-possession key. Communication security between the C and RS will be DTLS and PreSharedKey. The PoP key is used as the PreSharedKey ๐
Note: In this example, we're using a symmetric key for a multi-RS audience. That's not recommended normally (see Section 6.9) ๐ฌ However, here the risk is deemed acceptable, since all the doors are part of the same physical access control system. So the risk of a malicious RS impersonating the client towards another RS is low ๐ง
Authorization
Client Server
| |
|<=======>| DTLS Connection Establishment
| | and mutual authentication
| |
A: +-------->| Header: POST (Code=0.02)
| POST | Uri-Path:"token"
| | Content-Format: application/ace+cbor
| | Payload: <Request-Payload>
| |
B: |<--------+ Header: 2.05 Content
| | Content-Format: application/ace+cbor
| 2.05 | Payload: <Response-Payload>
| |
Figure 16: Token Request and Response Using Client Credentials
The info in the Request-Payload and the Response-Payload is shown in Figure 17 ๐
Request-Payload:
{
/ client_id / 24 : "keyfob",
/ audience / 5 : "PACS1337"
}
Response-Payload:
{
/ access_token / 1 : b64'VGVzdCB0b2tlbg',
/ cnf / 8 : {
/ COSE_Key / 1 : {
/ kid / 2 : b64'c29tZSBwdWJsaWMga2V5IGlk',
/ kty / 1 : 4 / Symmetric /,
/ k / -1 : b64'ZoRSOrFzN_FzUA5XKMYoVHyzff5oRJxl-IXRtztJ6uE'
}
}
}
Figure 17: Request and Response Payload for the C Offline
In this case, the access token is just an opaque byte string that references the authorization information at the AS ๐ซง
C: Next, the client POSTs the access token to the authz-info endpoint on the RS ๐ค This is a plain CoAP request, so no DTLS between client and RS. Since the token is opaque, the RS can't verify it on its own, so it holds off on responding with a status code until after step E โณ
D: The RS sends the token to the introspection endpoint on the AS using a CoAP POST request ๐ In this example, the RS and AS have done mutual authentication using a pre-shared security context (PSK, RPK, or certificate), with the RS acting as the DTLS client ๐ค
E: The AS sends back the introspection response (2.05 Content) with parameters about the token ๐ This includes the confirmation key (cnf) parameter, which lets the RS verify the client's proof of possession in step F ๐ช Heads up: our example in Figure 19 assumes a preestablished key (e.g., one used by the client and the RS for a previous token) that's now only referenced by its key identifier kid ๐๏ธ
After getting message E, the RS answers the client's POST from step C with the CoAP response code 2.01 (Created) ๐
Resource
Client Server
| |
C: +-------->| Header: POST (T=CON, Code=0.02)
| POST | Uri-Path:"authz-info"
| | Payload: b64'VGVzdCB0b2tlbg'
| |
| | Authorization
| | Server
| | |
| D: +--------->| Header: POST (Code=0.02)
| | POST | Uri-Path: "introspect"
| | | Content-Format: application/ace+cbor
| | | Payload: <Request-Payload>
| | |
| E: |<---------+ Header: 2.05 Content
| | 2.05 | Content-Format: application/ace+cbor
| | | Payload: <Response-Payload>
| | |
| |
|<--------+ Header: 2.01 Created
| 2.01 |
| |
Figure 18: Token Introspection for the C Offline
The info in the Request-Payload and the Response-Payload is shown in Figure 19 ๐
Request-Payload:
{
/ token / 11 : b64'VGVzdCB0b2tlbg',
/ client_id / 24 : "FrontDoor"
}
Response-Payload:
{
/ active / 10 : true,
/ aud / 3 : "lockOfDoor4711",
/ scope / 9 : "open close",
/ iat / 6 : 1563454000,
/ cnf / 8 : {
/ kid / 3 : b64'c29tZSBwdWJsaWMga2V5IGlk'
}
}
Figure 19: Request and Response Payload for Introspection
The client uses the symmetric PoP key to set up a DTLS PreSharedKey secure connection to the RS ๐ Then the CoAP PUT request goes to the uri-path /state on the RS, changing the door's state to locked ๐โจ
F: The RS responds with an appropriate response over the secure DTLS channel ๐
Resource
Client Server
| |
|<=======>| DTLS Connection Establishment
| | using Pre Shared Key
| |
+-------->| Header: PUT (Code=0.03)
| PUT | Uri-Path: "state"
| | Payload: <new state for the lock>
| |
F: |<--------+ Header: 2.04 Changed
| 2.04 | Payload: <new state for the lock>
| |
Figure 20: Resource Request and Response Protected by OSCORE
Acknowledgments ๐ท
This document is a product of the ACE Working Group of the IETF ๐
Thanks to Eve Maler for her contributions to the use of OAuth 2.0 and Unlicensed Mobile Access (UMA) in IoT scenarios, Robert Taylor for his discussion input, and Maliลกa Vuฤiniฤ for his input on the predecessors of this proposal ๐ซถ
Thanks to the authors of "[POP-KEY-DIST]OAuth 2.0 Proof-of-Possession: Authorization Server to Client Key Distribution" [POP-KEY-DIST], from where parts of the security considerations where copied ๐
Thanks to Stefanie Gerdes, Olaf Bergmann, and Carsten Bormann for contributing their work on AS discovery from "Delegated CoAP Authentication and Authorization Framework (DCAF)" [DCAF] (see Section 5.1) and the considerations on multiple access tokens ๐
Thanks to Jim Schaad and Mike Jones for their comprehensive reviews ๐
Thanks to Benjamin Kaduk for his input on various questions related to this work ๐
Thanks to Cigdem Sengul for some very useful review comments ๐ง
Thanks to Carsten Bormann for contributing the text for the CoRE Resource Type registry ๐
Thanks to Roman Danyliw for suggesting Appendix E (including its contents) ๐
Ludwig Seitz and Gรถran Selander worked on this document as part of the CelticPlus project CyberWI, with funding from Vinnova. Ludwig Seitz has also received further funding for this work by Vinnova in the context of the CelticNext project CRITISEC ๐
Authors' Addresses ๐
Ludwig Seitz Combitech Djรคknegatan 31 SE-211 35 Malmรถ Sweden Email: ludwig.seitz@combitech.com
Gรถran Selander Ericsson SE-164 80 Kista Sweden Email: goran.selander@ericsson.com
Erik Wahlstroem Sweden Email: erik@wahlstromstekniska.se
Samuel Erdtman Spotify AB Birger Jarlsgatan 61, 4tr SE-113 56 Stockholm Sweden Email: erdtman@spotify.com
Hannes Tschofenig Arm Ltd. 6067 Absam Austria Email: Hannes.Tschofenig@arm.com
๐ฆ where this page comes from
- ietf: rfc9200 2022-08
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms