RFC 9200 | ACE-OAuth | August 2022 |
Seitz, et al. | Standards Track | [Page] |
This specification defines a framework for authentication and authorization in Internet of Things (IoT) environments called ACE‑OAuth. The framework is based on a set of building blocks including OAuth 2.0 and the Constrained Application Protocol (CoAP), thus transforming a well-known and widely used authorization solution into a form suitable for IoT devices. Existing specifications are used where possible, but extensions are added and profiles are defined to better serve the IoT use cases.¶
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained athttps://www.rfc-editor.org/info/rfc9200.¶
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 of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
Authorization is the process for granting approval to an entity to access a generic resource[RFC4949]. The authorization task itself can best be described as granting access to a requesting client for a resource hosted on a device, i.e., the resource server (RS). This exchange is mediated by one or multiple authorization servers (ASes). Managing authorization for a large number of devices and users can be a complex task.¶
While prior work on authorization solutions for the Web and for the mobile environment also applies to the Internet of Things (IoT) environment, many IoT devices are constrained, for example, in terms of processing capabilities, available memory, etc. For such devices, the Constrained Application Protocol (CoAP)[RFC7252] can alleviate some resource concerns when used instead of HTTP to implement the communication flows of this specification.¶
Appendix A gives an overview of the constraints considered in this design, and a more detailed treatment of constraints can be found in[RFC7228]. This design aims to accommodate different IoT deployments as well as a continuous range of device and network capabilities. Taking energy consumption as an example, at one end, there are energy-harvesting or battery-powered devices that have a tight power budget; on the other end, there are mains-powered devices; and all levels exist in between.¶
Hence, IoT devices may be very different in terms of available processing and message exchange capabilities, and there is a need to support many different authorization use cases[RFC7744].¶
This specification describes a framework for Authentication and Authorization for Constrained Environments (ACE) built on reuse of OAuth 2.0[RFC6749], thereby extending authorization to Internet of Things devices. This specification contains the necessary building blocks for adjusting OAuth 2.0 to IoT environments.¶
Profiles of this framework are available in separate specifications, such as[RFC9202] or[RFC9203]. Such profiles may specify the use of the framework for a specific security protocol and the underlying transports for use in a specific deployment environment to improve interoperability. Implementations may claim conformance with a specific profile, whereby implementations utilizing the same profile interoperate, while implementations of different profiles are not expected to be interoperable. More powerful devices, such as mobile phones and tablets, may implement multiple profiles and will therefore be able to interact with a wider range of constrained devices. Requirements on profiles are described at contextually appropriate places throughout this specification and also summarized inAppendix C.¶
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.¶
Certain security-related terms, such as "authentication","authorization", "confidentiality", "(data) integrity", "messageauthentication code", and "verify", are taken from[RFC4949].¶
Since exchanges in this specification are described as RESTful protocol interactions, HTTP[RFC9110] offers useful terminology. (Note that "RESTful" refers to the Representational State Transfer (REST) architecture.)¶
Terminology for entities in the architecture is defined in OAuth 2.0[RFC6749], such as client (C), resource server (RS), and authorization server (AS).¶
Note that the term "endpoint" is used here following its OAuthdefinition, which is to denote resources, such as token andintrospection at the AS and authz-info at the RS (seeSection 5.10.1 for a definition of the authz-info endpoint).The CoAP definition, which is "[a]n entityparticipating in the CoAP protocol"[RFC7252], is not used in this specification.¶
The specification in this document is called the "framework" or "ACE framework".When referring to "profiles of this framework", it refers to additional specifications thatdefine the use of this specification with concrete transport and communicationsecurity protocols (e.g., CoAP over DTLS).¶
The term "Access Information" is used for parameters, other than the access token, provided to the client by the AS to enable it to access the RS(e.g., public key of the RS or profile supported by RS).¶
The term "authorization information" is used to denote all information, including the claims of relevant access tokens, that an RS uses to determine whether an access request should be granted.¶
Throughout this document, examples for CBOR data items are expressed in CBOR extended diagnostic notation as defined inSection 8 of [RFC8949] andAppendix G of [RFC8610] ("diagnostic notation"), unless noted otherwise. We often use diagnostic notation comments to provide a textual representation of the numeric parameter names and values.¶
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 verbsMUST 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 remainsRECOMMENDED.¶
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 inAppendix 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.¶
The OAuth 2.0 authorization framework enables a client to obtain scoped access to a resource with the permission of a resource owner. Authorization information, or references to it, is 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 access the protected resources hosted by the resource server.¶
A number of OAuth 2.0 terms are used within this specification:¶
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.¶
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) inFigure 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.¶
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.¶
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 keyMUST be encrypted in the latter case. The PoP key is also returned to client together with the token, protected by the secure channel.¶
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.¶
In OAuth 2.0, the client specifies the type of permissions it is seeking to obtain (via thescope
parameter) in the access token request. In turn, the AS may use thescope
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 (seeSection 5) for such requests and responses.¶
The values of thescope
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 underSection 3.3 of [RFC6749].¶
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 theiss
claim) and what audience the access token is intended for (via theaud
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.¶
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.)¶
CoAP is an application-layer protocol similar to HTTP but specifically designed for constrained environments. CoAP typically uses datagram-oriented transport, such as UDP, where reordering and loss of packets can occur. A security solution needs to take the latter aspects into account.¶
While HTTP uses headers and query strings to convey additional information about a request, CoAP encodes such information into header parameters called 'options'.¶
CoAP supports application-layer fragmentation of the CoAP payloads through block-wise transfers[RFC7959]. However, block-wise transfer does not increase the size limits of CoAP options; therefore, data encoded in options has to be kept small.¶
Transport layer security for CoAP can be provided by DTLS or TLS[RFC6347][RFC8446][RFC9147]. CoAP defines a number of proxy operations that require transport layer security to be terminated at the proxy. One approach for protecting CoAP communication end-to-end through proxies, and also to support security for CoAP over a different transport in a uniform way, is to provide security at the application layer using an object-based security mechanism, such as COSE[RFC8152].¶
One application of COSE is OSCORE[RFC8613], which provides end-to-end confidentiality, integrity and replay protection, and a secure binding between CoAP request and response messages. In OSCORE, the CoAP messages are wrapped in COSE objects and sent using CoAP.¶
In this framework, the use of CoAP as replacement for HTTP isRECOMMENDED for use in constrained environments. For communication security, this framework does not make an explicit protocol recommendation, since the choice depends on the requirements of the specific application. DTLS[RFC6347][RFC9147] and OSCORE[RFC8613] are mentioned as examples; other protocols fulfilling the requirements fromSection 6.5 are also applicable.¶
The ACE framework is based on the OAuth 2.0 protocol interactions using the token endpoint and optionally the introspection endpoint. A client obtains an access token, and optionally a refresh token, from an AS using the token endpoint and subsequently presents the access token to an RS to gain access to a protected resource. In most deployments, the RS can process the access token locally; however, in some cases, the RS may present it to the AS via the introspection endpoint to get fresh information. These interactions are shown inFigure 1. An overview of various OAuth concepts is provided inSection 3.1.¶
+--------+ +---------------+| |---(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 || | | |+--------+ +--------------+
The client makes an access token request to the token endpoint at the AS. This framework assumes the use of PoP access tokens (seeSection 3.1 for a short description) wherein the AS binds a key to an access token. The client may include permissions it seeks to obtain and information about the credentials it wants to use for proof of possession (e.g., symmetric/asymmetric cryptography or a reference to a specific key) of the access token.¶
If the request from the client has been successfully verified, authenticated, and authorized, the AS returns an access token and optionally a refresh token. Note that only certain grant types support refresh tokens. The AS can also return additional parameters, referred to as "Access Information". In addition to the response parameters defined by OAuth 2.0 and the PoP access token extension, this framework defines parameters that can be used to inform the client about capabilities of the RS, e.g., the profile the RS supports. More information about these parameters can be found inSection 5.8.4.¶
The client interacts with the RS to request access to the protected resource and provides the access token. The protocol to use between the client and the RS is not restricted to CoAP. HTTP, HTTP/2[RFC9113], QUIC[RFC9000], MQTT[MQTT5.0], Bluetooth Low Energy[BLE], etc., are also viable candidates.¶
Depending on the device limitations and the selected protocol, this exchange may be split up into two parts:¶
The client and the RS mutually authenticate using the security protocol specified in the profile (see step (B)) and the keys obtained in the access token or the Access Information. The RS verifies that the token is integrity protected and originated by the AS. It then compares the claims contained in the access token with the resource request. If the RS is online, validation can be handed over to the AS using token introspection (see messages (D) and (E)) over HTTP or CoAP.¶
A resource server may be configured to introspect the access token by including it in a request to the introspection endpoint at that AS. Token introspection over CoAP is defined inSection 5.9 and for HTTP in[RFC7662].¶
Note that token introspection is an optional step and can be omitted if the token is self-contained and the resource server is prepared to perform the token validation on its own.¶
The AS validates the token and returns the most recent parameters, such asscope
,audience
, validity, etc., associated with it back to the RS. The RS then uses the received parameters to process the request to either accept or to deny it.¶
The OAuth 2.0 framework defines a number of "protocol flows" via grant types, which have been extended further with extensions to OAuth 2.0 (such as[RFC7521] and[RFC8628]). What grant type works best depends on the usage scenario;[RFC7744] describes many different IoT use cases, but there are two grant types that cover a majority of these scenarios, namely the authorization code grant (described inSection 4.1 of [RFC6749]) and the client credentials grant (described inSection 4.4 of [RFC6749]). The authorization code grant is a good fit for use with apps running on smartphones and tablets that request access to IoT devices, a common scenario in the smart home environment, where users need to go through an authentication and authorization phase (at least during the initial setup phase). The native apps guidelines described in[RFC8252] are applicable to this use case. The client credentials grant is a good fit for use with IoT devices where the OAuth client itself is constrained. In such a case, the resource owner has prearranged access rights for the client with the authorization server, which is often accomplished using a commissioning tool.¶
The consent of the resource owner, for giving a client access to a protected resource, can be provided dynamically as in the classical OAuth flows, or it could be preconfigured by the resource owner as authorization policies at the AS, which the AS evaluates when a token request arrives. The resource owner and the requesting party (i.e., client owner) are not shown inFigure 1.¶
This framework supports a wide variety of communication security mechanisms between the ACE entities, such as the client, AS, and RS. It is assumed that the client has been registered (also called enrolled or onboarded) to an AS using a mechanism defined outside the scope of this document. In practice, various techniques for onboarding have been used, such as factory-based provisioning or the use of commissioning tools. Regardless of the onboarding technique, this provisioning procedure implies that the client and the AS exchange credentials and configuration parameters. These credentials are used to mutually authenticate each other and to protect messages exchanged between the client and the AS.¶
It is also assumed that the RS has been registered with the AS, potentially in a similar way as the client has been registered with the AS. Established keying material between the AS and the RS allows the AS to apply cryptographic protection to the access token to ensure that its content cannot be modified and, if needed, that the content is confidentiality protected. Confidentiality protection of the access token content would be provided on top of confidentiality protection via a communication security protocol.¶
The keying material necessary for establishing communication security between the C and RS is dynamically established as part of the protocol described in this document.¶
At the start of the protocol, there is an optional discovery step where the client discovers the resource server and the resources this server hosts. In this step, the client might also determine what permissions are needed to access the protected resource. A generic procedure is described inSection 5.1; profilesMAY define other procedures for discovery.¶
In Bluetooth Low Energy, for example, advertisements are broadcast by a peripheral, including information about the primary services. In CoAP, as a second example, a client can make a request to "/.well-known/core" to obtain information about available resources, which are returned in a standardized format, as described in[RFC6690].¶
The following sections detail the profiling and extensions of OAuth 2.0 for constrained environments, which constitutes the ACE framework.¶
In constrained environments, it cannot be assumed that the client and the RS are part of a common key infrastructure. Therefore, the AS provisions credentials and associated information to allow mutual authentication between the client and the RS. The resulting security association between the client and the RS may then also be used to bind these credentials to the access tokens the client uses.¶
The ACE framework, by default, implements proof of possession for access tokens, i.e., that the token holder can prove being a holder of the key bound to the token. The binding is provided by thecnf
(confirmation) claim[RFC8747], indicating what key is used for proof of possession. If a client needs to submit a new access token, e.g., to obtain additional access rights, they can request that the AS binds this token to the same key as the previous one.¶
ace_profile
parameter in the token response.¶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. In constrained settings, TLS is not always feasible or desirable. Nevertheless, it isREQUIRED that the communications named above are encrypted, integrity protected, and protected against message replay. It is alsoREQUIRED that the communicating endpoints perform mutual authentication. Furthermore, itMUST be assured that responses are bound to the requests in the sense that the receiver of a response can be certain that the response actually belongs to a certain request. Note that setting up such a secure communication may require some unprotected messages to be exchanged first (e.g., sending the token from the client to the RS).¶
ProfilesMUST specify a communication security protocol between the client and RS that provides the features required above. ProfilesMUST specify a communication security protocolRECOMMENDED to be used between the client and AS that provides the features required above. ProfilesMUST specify, for introspection, a communication security protocolRECOMMENDED to be used between the RS and AS that provides the features required above. These recommendations enable interoperability between different implementations without the need to define a new profile if the communication between the C and AS, or between the RS and AS, is protected with a different security protocol complying with the security requirements above.¶
In OAuth 2.0, the communication with the Token and the Introspection endpoints at the AS is assumed to be via HTTP and may use Uri-query parameters. When profiles of this framework use CoAP instead, it isREQUIRED to use of 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. The CBOR encoding for a number of OAuth 2.0 parameters is specified in this document; if a profile needs to use other OAuth 2.0 parameters with CoAP, itMUST specify their CBOR encoding.¶
Profiles that use CBOR encoding of protocol message parameters at the outermost encoding layerMUST use the Content-Format "application/ace+cbor". If CoAP is used for communication, the Content-FormatMUST be abbreviated with the ID: 19 (seeSection 8.16).¶
The OAuth 2.0 AS uses a JSON structure in the payload of its responses both to the client and RS. If CoAP is used, it isREQUIRED to use CBOR[RFC8949] instead of JSON. Depending on the profile, the CBOR payloadMAY be enclosed in a non-CBOR cryptographic wrapper.¶
The C must discover the AS in charge of the RS to determine where to request theaccess token. To do so, the C 1) must find out the AS URI to which the tokenrequest message must be sent and 2)MUST validate that the AS with thisURI is authorized to provide access tokens for this RS.¶
In order to determine the AS URI, the CMAY send an initial UnauthorizedResource Request message to the RS. The RS then denies the request and sendsthe address of its AS back to the C (seeSection 5.2). How the C validates theAS authorization is not in scope for this document. The C may, for example, askits owner if this AS is authorized for this RS. The C may also use amechanism that addresses both problems at once (e.g., by querying a dedicated secure service provided by the client owner) .¶
An Unauthorized Resource Request message is a request for any resource hosted by the RS for which the client does not have authorization granted. The RSsMUST treat any request for a protected resource as an Unauthorized Resource Request message when any of the following hold:¶
Note: These conditions ensure that the RS can handle requests autonomously once access was granted and a secure channel has been established between the C and RS. The authz-info endpoint, as part of the process for authorizing to protected resources, is not itself a protected resource andMUST NOT be protected as specified above (cf.Section 5.10.1).¶
Unauthorized Resource Request messagesMUST be denied with an "unauthorized_client" error response. In this response, the resource serverSHOULD provide proper AS Request Creation Hints to enable the client to request an access token from the RS's AS, as described inSection 5.3.¶
The handling of all client requests (including unauthorized ones) by the RS is described inSection 5.10.2.¶
The AS Request Creation Hints are sent by an RS as a response to an Unauthorized Resource Request message (seeSection 5.2) to help the sender of the Unauthorized Resource Request message acquire a valid access token. The AS Request Creation Hints are a CBOR or JSON map, with anOPTIONAL elementAS
specifying an absolute URI (seeSection 4.3 of [RFC3986]) that identifies the appropriate AS for the RS.¶
The message can also contain the followingOPTIONAL parameters:¶
audience
element contains an identifier the client should request at the AS, as suggested by the RS. With this parameter, when included in the access token request to the AS, the AS is able to restrict the use of the access token to specific RSs. SeeSection 6.9 for a discussion of this parameter.¶kid
(key identifier) element contains 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 in order to avoid having to reestablish the security association.¶cnonce
element contains a client-nonce. SeeSection 5.3.1.¶scope
element contains the suggested scope that the client should request towards the AS.¶Table 1 summarizes 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 |
Note that the schema part of the AS parameter may need to be adapted to the security protocol that is used between the client and the AS. Thus, the example AS value "coap://as.example.com/token" might need to be transformed to "coaps://as.example.com/token". It is assumed that the client can determine the correct schema part on its own depending on the way it communicates with the AS.¶
Figure 2 shows an example for an 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' }
In the example above, the response parameterAS
points the receiver of this message to the URI "coaps://as.example.com/token" to request access tokens. The RS sending this response uses an internal clock that is not synchronized with the clock of the AS. Therefore, it cannot reliably verify the expiration time of access tokens it receives. Nevertheless, to ensure a certain level of access token freshness, the RS has included acnonce
parameter (seeSection 5.3.1) in the response. (The hex sequence of thecnonce
parameter is encoded in CBOR-based notation in this example.)¶
Figure 3 illustrates the mandatory use of binary encoding of the message payload shown inFigure 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 #
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. In order to ensure some level of token freshness in that case, the RS can use thecnonce
(client-nonce) parameter. The processing requirements for this parameter are as follows:¶
cnonce
parameter in an AS Request Creation Hints messageMUST store information to validate that a given cnonce is 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.¶cnonce
parameter in an AS Request Creation Hints messageMUST include this in the parameters when requesting an access token at the AS, using thecnonce
parameter fromSection 5.8.4.4.¶cnonce
parameter, itMUST include this value in the access token, using thecnonce
claim specified inSection 5.10.¶cnonce
claim, with a client-nonce value that is fresh according to the information stored at the first step above. If thecnonce
claim is not present or if thecnonce
claim value is not fresh, the RSMUST discard the access token. If this was an interaction with the authz-info endpoint, the RSMUST also respond with an error message using a response code equivalent to the CoAP code 4.01 (Unauthorized).¶To request an access token, the client obtains authorization from the resource owner or uses its client credentials as a grant. The authorization is expressed in the form of an authorization grant.¶
The OAuth framework[RFC6749] defines four grant types. The grant types can be split up 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, seeSection 1.3 of [RFC6749]. The OAuth 2.0 framework provides an extension mechanism for defining additional grant types, so profiles of this frameworkMAY define additional grant types, if needed.¶
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 inSection 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 frameworkMAY extend it with an additional client credentials type using client certificates.¶
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 frameworkMUST 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.¶
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 inSection 3.1 of [RFC6749] and the attack countermeasures suggested inSection 4.2 of [RFC6819].¶
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 profileMUST define the details of the mapping between the fields described below and these transports. If HTTPS with JSON is used, the semantics of Sections4.1.3 and4.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 thissectionMUST be followed.¶
For the AS to be able to issue a token, the clientMUST be authenticated and present a valid grant for the scopes requested. Profiles of this frameworkMUST specify how the AS authenticates the client and how the communication between the client and AS is protected, fulfilling the requirements specified inSection 5.¶
The default name of this endpoint in a url-pathSHOULD be '/token'. However, implementations are not required to use this name and can define their own instead.¶
The client sends a POST request to the token endpoint at the AS. The profileMUST specify how the communication is protected. The content of the request consists of the parameters specified in the relevant subsection of Section4 of the OAuth 2.0 specification[RFC6749], depending on the grant type, with the following exceptions and additions:¶
grant_type
parameter isOPTIONAL in the context of this framework (as opposed toREQUIRED in[RFC6749]). If that parameter is missing, the default value "client_credentials" is implied.¶audience
parameter from[RFC8693] isOPTIONAL to request an access token bound to a specific audience.¶cnonce
parameter defined inSection 5.8.4.4 isREQUIRED if the RS provided a client-nonce in the AS Request Creation Hints message (Section 5.3).¶scope
parameterMAY be encoded as a byte string instead of the string encoding specified inSection 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 character '0x20' to delimit scope-tokens.¶ace_profile
parameter to indicate that it wants the AS to include theace_profile
parameter in the response. SeeSection 5.8.4.3.¶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 thereq_cnf
parameter from[RFC9201].¶
If CoAP is used, then these parametersMUST be provided in a CBOR map (seeTable 5).¶
When HTTP is used as a transport, then the client makes a request to the token endpoint; the parametersMUST be encoded as defined inAppendix 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+cborPayload:{ / client_id / 24 : "myclient", / audience / 5 : "tempSensor4711"}
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 thereq_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/oscorePayload: 0x44025d1/ ... (full payload omitted for brevity) ... /68b3825eDecrypted 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 6 shows a request for a token where a previously communicated proof-of-possession key is only referenced using thereq_cnf
parameter from[RFC9201].¶
Header: POST (Code=0.02)Uri-Host: "as.example.com"Uri-Path: "token"Content-Format: application/ace+cborPayload:{ / client_id / 24 : "myclient", / audience / 5 : "valve424", / scope / 9 : "read", / req_cnf / 4 : { / kid / 3 : b64'6kg0dXJM13U' }}
Refresh tokens are typically not stored as securely as proof-of-possession keys in requesting clients. Proof-of-possession-based refresh token requestsMUST 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.¶
If the access token request has been successfully verified by the AS and the client is authorized to obtain an access token corresponding to its access token request, the AS sends a response with the response code equivalent to the CoAP response code 2.01 (Created). If the client request was invalid, or not authorized, the AS returns an error response, as described inSection 5.8.3.¶
Note that the AS decides which token type and profile to use when issuing a successful response. It is assumed that the AS has prior knowledge of the capabilities of the client and the RS (seeAppendix D). This prior knowledge may, for example, be set by the use of a dynamic client registration protocol exchange[RFC7591]. If the client has requested a specific proof-of-possession key using thereq_cnf
parameter from[RFC9201], this may also influence which profile the AS selects, as it needs to support the use of the key type requested by the client.¶
The content of the successful reply is the Access Information. When using CoAP, the payloadMUST be encoded as a CBOR map; when using HTTP, the encoding is a JSON map, as specified inSection 5.1 of [RFC6749]. In both cases, the parameters specified inSection 5.1 of [RFC6749] are used, with the following additions and changes:¶
ace_profile
parameter, in which case it is MANDATORY. This indicates the profile that the clientMUST use towards the RS. SeeSection 5.8.4.3 for the formatting of this parameter. If this parameter is absent, the AS assumes that the client implicitly knows which profile to use towards the RS.¶token_type
:token_type
is "PoP". If a specific use case requires anothertoken_type
(e.g., "Bearer") to be used, then this parameter isREQUIRED.¶Furthermore,[RFC9201] defines additional parameters that the ASMUST be able to use when responding to a request to the token endpoint.¶
Table 2 summarizes the parameters that can currently be part of the Access Information. Future extensions may define additional 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] |
Figure 7 shows a response containing a token and acnf
parameter with a symmetric proof-of-possession key, which is defined in[RFC9201]. Note that the key identifierkid
is only used to simplify indexing and retrieving the key, and no assumptions should be made that it is unique in the domains of either the client or the RS.¶
Header: Created (Code=2.01)Content-Format: application/ace+cborPayload:{ / 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' } }}
The error responses for interactions with the AS are generally equivalent to the ones defined inSection 5.2 of [RFC6749], with the following exceptions:¶
error
,error_description
, anderror_uri
MUST be abbreviated using the codes specified inTable 5, when a CBOR encoding is used.¶error
parameter)MUST be abbreviated, as specified inTable 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 |
In addition to the error responses defined in OAuth 2.0, the following behaviorMUST be implemented by the AS:¶
This section provides more detail about the new parameters that can be used in access token requests and responses, as well as abbreviations for more compact encoding of existing parameters and common parameter values.¶
The abbreviations specified in the registry defined inSection 8.5MUST 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] |
Thetoken_type
parameter, defined inSection 5.1 of [RFC6749], allows the AS to indicate to the client which type of access token it is receiving (e.g., a bearer token).¶
This document registers the new value "PoP" for the "OAuth Access Token Types" registry, specifying a proof-of-possession token. How the proof of possession by the client to the RS is performedMUST be specified by the profiles.¶
The values in thetoken_type
parameterMUST use the CBOR abbreviations defined in the registry specified bySection 8.7 if a CBOR encoding is used.¶
In this framework, the "pop" value for thetoken_type
parameter is the default. The AS may, however, provide a different value from those registered in[IANA.OAuthAccessTokenTypes].¶
Profiles of this frameworkMUST define the communication protocol and the communication security protocol between the client and the RS. The security protocolMUST provide encryption, integrity, and replay protection. ItMUST also provide a binding between requests and responses. Furthermore, profilesMUST define a list of allowed proof-of-possession methods if they support proof-of-possession tokens.¶
A profileMUST specify an identifier thatMUST be used to uniquely identify itself in theace_profile
parameter. The textual representation of the profile identifier is intended for human readability and for JSON-based interactions; itMUST NOT be used for CBOR-based interactions. ProfilesMUST register their identifier in the registry defined inSection 8.8.¶
ProfilesMAY define additional parameters for both the token request and the Access Information in the access token response in order to support negotiation or signaling of profile-specific parameters.¶
Clients that want the AS to provide them with theace_profile
parameter in the access token response can indicate that by sending anace_profile
parameter with a null value for CBOR-based interactions, or an empty string if CBOR is not used, in the access token request.¶
This parameterMUST be sent from the client to the AS if it previously received acnonce
parameter in the AS Request Creation Hints (Section 5.3). The parameter is encoded as a byte string for CBOR-based interactions and as a string (base64url without padding encoded binary[RFC4648]) if CBOR is not used. ItMUST copy the value from thecnonce
parameter in the AS Request Creation Hints.¶
If CBOR encoding is used, all OAuth parameters in access token requests and responsesMUST be mapped to CBOR types, as specified in the registry defined bySection 8.10, using the given integer abbreviation for the map keys.¶
Note that we have aligned the abbreviations corresponding to claims with the abbreviations defined in[RFC8392].¶
Note also that abbreviations from -24 to 23 have a 1-byte encoding size in CBOR. We have thus chosen to assign abbreviations in that range to parameters we expect to be used most frequently in constrained scenarios.¶
Name | CBOR Key | Value Type | Original Specification |
---|---|---|---|
access_token | 1 | byte string | [RFC6749] |
expires_in | 2 | unsigned integer | [RFC6749] |
audience | 5 | text string | [RFC8693] |
scope | 9 | text or byte string | [RFC6749] |
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 integer | [RFC6749] |
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 |
Token introspection[RFC7662]MAY be implemented by the AS and the RS. When implemented, itMAY be used by the RS and to query the AS for metadata about a given token, e.g., validity or scope. Analogous to the protocol defined in[RFC7662] for HTTP and JSON, this section defines adaptations to more constrained environments using CBOR and leaving the choice of the application protocol to the profile. The clientMAY also implement and use introspection analogously to the RS to obtain information about a given token.¶
Communication between the requesting entity and the introspection endpoint at the ASMUST be integrity protected and encrypted. The communication security protocolMUST also provide a binding between requests and responses. Furthermore, the two interacting partiesMUST perform mutual authentication. Finally, the ASSHOULD verify that the requesting entity has the right to access introspection information about the provided token. Profiles of this framework that support introspectionMUST specify how authentication and communication security between the requesting entity and the AS is implemented.¶
The default name of this endpoint in a url-pathSHOULD be '/introspect'. However, implementations are not required to use this name and can define their own instead.¶
The requesting entity sends a POST request to the introspection endpoint at the AS. The profileMUST specify how the communication is protected. If CoAP is used, the payloadMUST be encoded as a CBOR map with atoken
entry containing the access token. Further optional parameters representing additional context that is known by the requesting entity to aid the AS in its responseMAY be included.¶
For CoAP-based interaction, all messagesMUST use the content type "application/ace+cbor". For HTTP, the encoding defined inSection 2.1 of [RFC7662] is used.¶
The same parameters are required and optional as inSection 2.1 of [RFC7662].¶
For example,Figure 8 shows an RS calling the token introspection endpoint at the AS to query about an OAuth 2.0 proof-of-possession token. Note that object security based on OSCORE[RFC8613] is assumed in this example; therefore, 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, 0x25Content-Format: application/oscorePayload:... COSE content ...
{ / token / 11 : b64'7gj0dXJQ43U', / token_type_hint / 33 : 2 / PoP /}
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 inSection 5.9.3.¶
In a successful response, the AS encodes the response parameters in a map. If CoAP is used, thisMUST be encoded as a CBOR map; if HTTP is used, the JSON encoding specified inSection 2.2 of [RFC7662] is used. The map containing the response payload includes the same required and optional parameters as inSection 2.2 of [RFC7662], with the following additions:¶
ace_profile
cnonce
cti
cti
claim associated to this access token. This parameter has the same meaning and processing rules as thejti
parameter defined inSection 3.1.2 of [RFC7662] except that its value is a byte string when encoded in CBOR and is the base64url encoding of this byte string without padding when encoded in JSON[RFC4648].¶exi
expires_in
claim associated to this access token. SeeSection 5.10.3.¶Furthermore,[RFC9201] defines more parameters that the ASMUST 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 inFigure 8. Note that this example contains thecnf
parameter defined in[RFC9201].¶
Header: Created (Code=2.01)Content-Format: application/ace+cborPayload:{ / 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' } }}
The error responses for CoAP-based interactions with the AS are equivalent to the ones for HTTP-based interactions, as defined inSection 2.3 of [RFC7662], with the following differences:¶
error
,error_description
, anderror_uri
MUST be abbreviated using the codes specified inTable 5.¶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 serverMUST instead respond with an introspection response with theactive
field set to "false".¶
If CBOR is used, the introspection request and response parametersMUST be mapped to CBOR types, as specified in the registry defined bySection 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 fromSection 5.8.5.¶
Parameter name | CBOR Key | Value Type | Original Specification |
---|---|---|---|
iss | 1 | text string | [RFC7662] |
sub | 2 | text string | [RFC7662] |
aud | 3 | text string | [RFC7662] |
exp | 4 | integer or floating-point number | [RFC7662] |
nbf | 5 | integer or floating-point number | [RFC7662] |
iat | 6 | integer or floating-point number | [RFC7662] |
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 |
In this framework, the use of CBOR Web Token (CWT) as specified in[RFC8392] isRECOMMENDED.¶
In order to facilitate offline processing of access tokens, this document uses thecnf
claim from[RFC8747] and thescope
claim from[RFC8693] for JWT- and CWT-encoded tokens. In addition to string encoding specified for thescope
claim, a binary encodingMAY 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.¶
If the AS needs to convey a hint to the RS about which profile it should use to communicate with the client, the ASMAY include anace_profile
claim in the access token, with the same syntax and semantics as defined inSection 5.8.4.3.¶
If the client submitted acnonce
parameter in the access token request (Section 5.8.4.4), the ASMUST include the value of this parameter in thecnonce
claim specified here. Thecnonce
claim uses binary encoding.¶
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.¶
This section defines a method for transporting the access token to the RS using a RESTful protocol, such as CoAP. Profiles of this frameworkMAY define other methods for token transport.¶
The method consists of an authz-info endpoint, implemented by the RS. A client using this methodMUST 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 typeMUST 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 RS receiving the tokenMUST verify the validity of the token. If the token is valid, the RSMUST respond to the POST request with a response code equivalent to CoAP code 2.01 (Created).Section 5.10.1.1 outlines how an RSMUST proceed to verify the validity of an access token.¶
The RSMUST 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.¶
When using this framework, it isRECOMMENDED 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.¶
If the payload sent to the authz-info endpoint does not parse to a token, the RSMUST respond with a response code equivalent to the CoAP code 4.00 (Bad Request).¶
The RSMAY 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.¶
ProfilesMUST 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.¶
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.¶
When an RS receives an access token, itMUST verify it before storing it. The details of token verification depends on various aspects, including the token encoding, the type of token, the security protection applied to the token, and the claims. The token encoding matters since the security protection differs between the token encodings. For example, a CWT token uses COSE, while a JWT token uses JSON Object Signing and Encryption (JOSE). The type of token also has an influence on the verification procedure since tokens may be self-contained, whereby token verification may happen locally at the RS, while a reference token requires further interaction with the authorization server, for example, using token introspection, to obtain the claims associated with the token reference. Self-contained tokensMUST at least be integrity protected, but theyMAY also be encrypted.¶
For self-contained tokens, the RSMUST 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]. ThisMUST 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.¶
In case 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 inSection 5.9.¶
Errors may happen during this initial processing stage:¶
Next, the RSMUST 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
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 RSMUST discard the token. If this was an interaction with authz-info, the RSMUST also respond with a response code equivalent to the CoAP code 4.01 (Unauthorized).¶exp
aud
aud
claim must refer to an audience that the RS identifies with. If that is not the case, the RSMUST discard the token. If this was an interaction with authz-info, the RSMUST also respond with a response code equivalent to the CoAP code 4.03 (Forbidden).¶scope
scope
claim. If that is not the case, the RSMUST discard the token. If this was an interaction with authz-info, the RSMUST also respond with a response code equivalent to the CoAP code 4.00 (Bad Request). The RSMAY 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 thesub
(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 theexi
(expires in) claimMUST 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 RSMAY use the error codes fromSection 3.1 of [RFC6750] to provide additional details to the client.¶
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.¶
Specifically, itSHOULD NOT be possible to perform GET, DELETE, or PUT on the authz-info endpoint.¶
The RSSHOULD 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.¶
Before sending a request to an RS, the clientMUST verify that the keys used to protect this communication are still valid. SeeSection 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 RSMUST 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 codeMUST 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 RSMUST 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 RSMUST reject the request with a 4.05 (Method Not Allowed).¶
Note: The use of the response codes 4.03 and 4.05 is 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 RSMAY 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.¶
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.¶
exp
claim and possibly thenbf
claim. 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.¶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 JSON number.¶Processing this claim requires that the RS does the following:¶
exi
claim, 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 theexi
claim that have expired (in order to avoid accepting them again). In order to avoid an unbounded memory usage growth, thisMUST be implemented in the following way when theexi
claim is used:¶
cti
claim (orjti
for JWTs) to the access token. The value of this claimMUST be created as the binary representation of the concatenation of the identifier of the RS with a sequence number counting the tokens containing anexi
claim, issued by this AS for the RS.¶exi
claim 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 where 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.¶If a token that authorizes a long-running request, such as a CoAP Observe[RFC7641], expires, the RSMUST 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.¶
The AS provides the client with key material that the RS uses. This can either be a common symmetric PoP key or an asymmetric key used by the RS to authenticate towards the client. Since there is currently no expiration metadata associated to those keys, the client has no way of knowing if these keys are still valid. This may lead to situations where the client sends requests containing sensitive information to the RS using a key that is expired and possibly in the hands of an attacker or where the client accepts responses from the RS that are not properly protected and could possibly have been forged by an attacker.¶
In order to prevent this, the client must assume that those keys are only valid as long as the related access token is. Since the access token is opaque to the client, one of the following methodsMUST be used to inform the client about the validity of an access token:¶
expires_in
parameter in the Access Information.¶A client that is not able to obtain information about the expiration of a tokenMUST NOT use this token.¶
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.¶
The following subsections address issues specific to this document and its use in constrained environments.¶
A large range of threats can be mitigated by protecting the contents of the access token by 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 protectionMUST 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 keyMUST 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, since any of the recipients could modify the token undetected by the other recipients. Therefore, a token with a multirecipient audienceMUST 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 secretMUST 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.¶
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, theySHOULD 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.¶
Communication with the authorization serverMUST 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 inSection 5.¶
Additional protection for the access token can be applied by encrypting it, for example, encryption of CWTs is specified inSection 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.¶
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 deviceMUST NOT lead to a compromise of other credentials not linked to that device; therefore, secret keys used for authenticationMUST NOT be shared between more than two parties.¶
Operators of the clients or RSsSHOULD have procedures in place to replace credentials that are suspected to have been compromised or that have been lost.¶
Operators alsoSHOULD have procedures for decommissioning devices that include securely erasing credentials and other security-critical material in the devices being decommissioned.¶
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 (seeSection 5.3) are authentic. Therefore, the CMUST 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.¶
This section summarizes the minimal requirements for the communication security of the different protocol interactions.¶
An RS that is offline faces the problem of clock drift. Since it cannot synchronize its clock with the AS, it may be tricked into accepting old access tokens that are no longer valid or have been compromised. In order to prevent this, an RS may use the nonce-based mechanism (cnonce
) defined inSection 5.3 to ensure freshness of an Access Token subsequently presented to this RS.¶
Another problem with clock drift is that evaluating the standard token expiration claimexp
can give unpredictable results.¶
Acceptable ranges of clock drift are highly dependent on the concrete application. Important factors are how long access tokens are valid and how critical timely expiration of the access token is.¶
The expiration mechanism implemented by theexi
claim, based on the first time the RS sees the token, was defined to provide a more predictable alternative. Theexi
approach has some drawbacks that need to be considered:¶
exi
claim in order to prolong their lifespan.¶exi
claims of tokens it is storing.¶ The first drawback is inherent to the deployment scenario and theexi
solution. It can therefore not be mitigated without requiring the RS be online at times. The second drawback can be mitigated by regularly storing the value ofexi
counters to persistent memory.¶
There may be use cases where different transport and security protocols are allowed for the different interactions, and, if that is not explicitly covered by an existing profile, it corresponds to combining profiles into a new one. For example, a new profile could specify that a previously defined MQTT-TLS profile is used between the client and the RS in combination with a previously defined CoAP-DTLS profile for interactions between the client and the AS. The new profile that combines existing profilesMUST specify how the existing profiles' security requirements remain satisfied. Therefore, any profileMUST clearly specify its security requirements andMUST document if its security depends on the combination of various protocol interactions.¶
Communication with the authz-info endpoint, as well as the various error responses defined in this framework, potentially includes sending information over an unprotected channel. These messages may leak information to an adversary or may 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 this token.¶
As far as error messages are concerned, this framework is written under the assumption that, in general, the benefits of detailed error messages outweigh the risk due to information leakage. For particular use cases where this assessment does not apply, detailed error messages can be replaced by more generic ones.¶
In some scenarios, it may be possible to protect the communication with the authz-info endpoint (e.g., through DTLS with only server-side authentication). In cases where this is not possible, it isRECOMMENDED 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 (seeSection 5.2) is used, the clientMUST make sure that it is not sending sensitive content in this request. While GET and DELETE requests only reveal the target URI of the resource, POST and PUT requests would reveal the whole payload of the intended operation.¶
Since the client is not authenticated at the point when it is submitting an access token to the authz-info endpoint, attackers may be pretending to be a client and trying to trick an RS to use an obsolete profile that in turn specifies a vulnerable security mechanism via the authz-info endpoint. Such an attack would require a valid access token containing anace_profile
claim requesting the use of said obsolete profile. Resource owners should update the configuration of their RSs to prevent them from using such obsolete profiles.¶
Theaud
claim, as defined in[RFC7519], and the equivalentaudience
parameter from[RFC8693] are intentionally vague on how to match the audience value to a specific RS. This is intended to allow application-specific semantics to be used. This section attempts to give some general guidance for the use of audiences in constrained environments.¶
URLs are not a good way of identifying mobile devices that can switch networks and thus be 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 isRECOMMENDED to apply the procedure fromSection 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 is not always reachable when the groups' memberships change. Furthermore, issuing access tokens bound to symmetric proof-of-possession keys that apply to a group-audience is problematic, as an RS that is in possession of the access token can impersonate the client towards the other RSs that are part of the group. It is thereforeNOT 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 theaudience
parameter in order to obtain a token for the intended RS. Errors in this process can lead to the client inadvertently obtaining a token for the wrong RS. The correct values foraudience
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 theaudience
hint provided by the RS as part of the AS Request Creation Hints (Section 5.3) is not typically source authenticated and integrity protected and should therefore not be treated a trusted value.¶
The optional introspection mechanism provided by OAuth and supported in the ACE framework allows for two types of attacks that need to be considered by implementers.¶
First, an attacker could perform a denial-of-service attack against the introspection endpoint at the AS in order to prevent validation of access tokens. To maintain the security of the system, an RS that is configured to use introspectionMUST 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 perform 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 such attacks by implementing rate limits on how many introspection requests they perform in a given time interval for a certain client IP address submitting tokens to /authz-info. When that limit has been reached, incoming requests from that address are rejected for a certain amount of time. A general rate limit on the introspection requests should also be considered in order to mitigate distributed attacks.¶
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, this can be prevented by the resource owner. To do so, the resource owner needs to bind the grants it issues to anonymous, ephemeral credentials that do not allow the AS to link different grants and thus different access token requests by the same client.¶
The claims contained in a token can reveal privacy-sensitive information about the client and the RS to any party having access to them (whether by processing the content of a self-contained token or by introspection). The ASSHOULD 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 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 latter may reveal the identity of the device or application running the client. This 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 for proof of possession towards 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 to determine the client's identity.¶
An unprotected response to an unauthorized request (seeSection 5.3) may disclose information about the RS and/or its existing relationship with the C. It is advisable 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 that the RS provides. Developers must ensure that the RS does not disclose information that has an impact on the privacy of the stakeholders in the AS Request Creation Hints. They may choose to use a different mechanism for the discovery of the AS if necessary. If means of encrypting communication between the C and RS already exist, more detailed information may be included with an error response to provide the C with sufficient information to react on that particular error.¶
This document creates several registries with a registration policy of Expert Review; guidelines to the experts are given inSection 8.17.¶
This specification establishes the IANA "ACE Authorization Server Request Creation Hints" registry.¶
The columns of the registry are:¶
This registry has been initially populated by the values inTable 1. The Reference column for all of these entries is this document.¶
IANA has registered a new Resource Type (rt=) Link Target Attribute in the "Resource Type (rt=) Link Target Attribute Values" subregistry under the "Constrained RESTful Environments (CoRE) Parameters"[IANA.CoreParameters] registry:¶
Specific ACE-OAuth profiles can use this common resource type for defining their profile-specific discovery processes.¶
This specification registers the following error values in the "OAuth Extensions Error Registry"[IANA.OAuthExtensionsErrorRegistry].¶
This specification establishes the IANA "OAuth Error Code CBOR Mappings" registry.¶
The columns of the registry are:¶
This registry has been initially populated by the values inTable 3. The Reference column for all of these entries is this document.¶
This specification establishes the IANA "OAuth Grant Type CBOR Mappings" registry.¶
The columns of this registry are:¶
This registry has been initially populated by the values inTable 4. The Reference column for all of these entries is this document.¶
This section registers the following new token type in the "OAuth Access Token Types" registry[IANA.OAuthAccessTokenTypes].¶
PoP
¶cnf
,rs_cnf
(seeSection 3.1 of [RFC8747] andSection 3.2 of [RFC9201]).¶This specification establishes the IANA "OAuth Access Token Type CBOR Mappings" registry.¶
The columns of this registry are:¶
This specification establishes the IANA "ACE Profile" registry.¶
The columns of this registry are:¶
This specification registers the following parameter in the "OAuth Parameters" registry[IANA.OAuthParameters]:¶
This specification establishes the IANA "OAuth Parameters CBOR Mappings" registry.¶
The columns of this registry are:¶
client_id
.¶This registry has been initially populated by the values inTable 5. The Reference column for all of these entries is this document.¶
This specification registers the following parameters in the "OAuth Token Introspection Response" registry[IANA.TokenIntrospectionResponse].¶
ace_profile
¶cnonce
¶cti
¶exi
¶This specification establishes the IANA "OAuth Token Introspection Response CBOR Mappings" registry.¶
The columns of this registry are:¶
client_id
.¶This registry has been initially populated by the values inTable 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].¶
This specification registers the following new claims in the "JSON Web Token Claims" subregistry under the "JSON Web Token (JWT)" registry[IANA.JsonWebTokenClaims]:¶
ace_profile
¶cnonce
¶exi
¶This specification registers the following new claims in the "CBOR Web Token (CWT) Claims" registry[IANA.CborWebTokenClaims].¶
ace_profile
¶ace_profile
¶cnonce
¶cnonce
¶This specification registers the "application/ace+cbor" media type for messages of the protocols defined in this document carrying parameters encoded in CBOR. This registration follows the procedures specified in[RFC6838].¶
The following entry has been registered in the "CoAP Content-Formats" registry:¶
All of the IANA registries established in this document are defined to use a registration policy of Expert Review. This section gives some general guidelines for what the experts should be looking for, but they are being designated as experts for a reason, so they should be given substantial latitude.¶
Expert Reviewers should take into consideration the following points:¶
This section provides further insight into the design decisions of the solution documented in this document.Section 3 lists several building blocks and briefly summarizes their importance. The justification for offering some of those building blocks, as opposed to using OAuth 2.0 as is, is given below.¶
Common IoT constraints are:¶
In certain constrained settings, an IoT device may not be able to communicate with a given device at all times. Devices may be sleeping or just disconnected from the Internet because of general lack of connectivity in the area, cost reasons, or security reasons, e.g., to avoid an entry point for denial-of-service attacks.¶
The communication interactions this framework builds upon (as shown graphically inFigure 1) may be accomplished using a variety of different protocols, and not all parts of the message flow are used in all applications due to the communication constraints. Deployments making use of CoAP are expected, but this framework is not limited to them. Other protocols, such as HTTP or Bluetooth Smart communication, that do not necessarily use IP could also be used. The latter raises the need for application-layer security over the various interfaces.¶
In the light of these constraints, we have made the following design decisions:¶
cnf
claim[RFC8747]. A request parametercnf
and a Response parametercnf
, both having a value space semantically and syntactically identical to thecnf
claim, are defined for the token endpoint to allow requesting and stating confirmation keys. This aims at making token theft harder. Token theft is specifically relevant in constrained use cases, as communication often passes through middleboxes, which could be able to steal bearer tokens and use them to gain unauthorized access.¶Process the access token and Access Information (see step (B) ofFigure 1).¶
Send the token and request to the RS (see step (C) ofFigure 1).¶
Process an access token.¶
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.¶
This section lists the requirements on profiles of this framework for the convenience of profile designers.¶
ace_profile
identifier (Section 5.8.4.3).¶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.¶
exp
claim) or not.¶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.¶
grant_type
parametergrant_type
parameter is required (per[RFC6749]). In this framework, this parameter is optional. SeeSection 5.8.1.¶scope
parameterscope
parameter is string encoded (per[RFC6749]). In this framework, this parameter may also be encoded as a byte string. SeeSection 5.8.1.¶token_type
parametertoken_type
parameter is required (per[RFC6749]). In this framework, this parameter is optional. SeeSection 5.8.2.¶There is a large variety of IoT deployments, as is indicated inAppendix 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.¶
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) ofFigure 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 inFigure 11.¶
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 theaudience
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.¶
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 toiat
, in order to mitigate attacks using stolen client credentials. The token includes claims, such asscope
, with the authorized access that an owner of the temperature device can enjoy. In this example, thescope
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 thescope
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 specificaudience
andscope
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> | |
The information contained in the Request-Payload and the Response-Payload is shown inFigure 12. Note that the parameterrs_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' } }}
The content of the access token is shown inFigure 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' } }}
Messages C and F are shown in Figures14 and15.¶
Resource Client Server | |C: +-------->| Header: POST (Code=0.02) | POST | Uri-Path:"authz-info" | | Payload: 0INDoQEKoQVN ... | | |<--------+ Header: 2.04 Changed | 2.04 | | |
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.¶
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> | |
In this deployment scenario, it is assumed that a client is not able to access the AS at the time of the access request, whereas the RS is assumed to be connected to the back-end infrastructure. Thus, the RS can make use of token introspection. This access procedure involves steps (A)-(F) ofFigure 1 but assumes steps (A) and (B) have been carried out during a phase when the client had connectivity to the AS.¶
Since the client is assumed to be offline, at least for a certain period of time, a preprovisioned access token has to be long lived. Since the client is constrained, the token will not be self-contained (i.e., not a CWT) but instead just a reference. The resource server uses its connectivity to learn about the claims associated to the access token by using introspection, which is shown in the example below.¶
In the example, interactions between an offline client (key fob), an RS (online lock), and an AS is shown. It is assumed that there is a provisioning step where the client has access to the AS. This corresponds to message exchanges A and B, which are shown inFigure 16.¶
Authorization consent from the resource owner can be preconfigured, but it can also be provided via an interactive flow with the resource owner. An example of this for the key fob case could be that the resource owner has a connected car and buys a generic key to use with the car. To authorize the key fob, the owner connects it to a computer that then provides the UI for the device. After that, 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 does not know the exact door it will be used to access since the token request is not sent at the time of access. So thescope
andaudience
parameters are set quite wide to start with, while tailored values narrowing down the claims to the specific RS being accessed can be provided to that RS during an introspection step.¶
audience
parameter set to "PACS1337" (Physical Access System (PACS)), a value that identifies the physical access control system to which the individual doors are connected. The AS generates an access token as an opaque string, which it can match to the specific client and the targeted audience. It furthermore generates a symmetric proof-of-possession key. The communication security and authentication between the client and AS is assumed to have been provided at the transport layer (e.g., via DTLS) using a pre-shared security context (pre-shared key (PSK), RPK, or certificate).¶Note: In this example, we are using a symmetric key for a multi-RS audience, which is not recommended normally (seeSection 6.9). However, in this case, the risk is deemed to be acceptable, since all the doors are part of the same physical access control system; therefore, 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> | |
The information contained in the Request-Payload and the Response-Payload is shown inFigure 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' } }}
In this case, the access token is just an opaque byte string referencing the authorization information at the AS.¶
The AS provides the introspection response (2.05 Content) containing parameters about the token. This includes the confirmation key (cnf
) parameter that allows the RS to verify the client's proof of possession in step F. Note that our example inFigure 19 assumes a preestablished key (e.g., one used by the client and the RS for a previous token) that is now only referenced by its key identifierkid
.¶
After receiving message E, the RS responds to the client's POST in 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 | | |
The information contained in the Request-Payload and the Response-Payload is shown inFigure 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' }}
The client uses the symmetric PoP key to establish a DTLS PreSharedKey secure connection to the RS. The CoAP request PUT is sent to the uri-path /state on the RS, changing the state of the door to locked.¶
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> | |
This document is a product of the ACE Working Group of the IETF.¶
Thanks toEve 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, andMališ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 toStefanie Gerdes,Olaf Bergmann, andCarsten Bormann for contributing their work on AS discovery from "Delegated CoAP Authentication and Authorization Framework (DCAF)"[DCAF] (seeSection 5.1) and the considerations on multiple access tokens.¶
Thanks toJim Schaad andMike Jones for their comprehensive reviews.¶
Thanks toBenjamin Kaduk for his input on various questions related to this work.¶
Thanks toCigdem Sengul for some very useful review comments.¶
Thanks toCarsten Bormann for contributing the text for the CoRE Resource Type registry.¶
Thanks toRoman Danyliw for suggestingAppendix E (including its contents).¶
Ludwig Seitz andGö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.¶