The following subsections describe the details of the POST request and response to the authz-info endpoint between the client and RS. The client generates a nonce N1 and an identifier ID1 that is unique in the sets of its own Recipient IDs and posts them together with the token that includes the materials (e.g., OSCORE parameters) received from the AS to the RS. The RS then generates a nonce N2 and an identifier ID2 that is unique in the sets of its own Recipient IDs and uses
Section 3.2 of
RFC 8613 to derive a security context based on a shared Master Secret, the two exchanged nonces, and the two identifiers, established between the client and server. The exchanged nonces and identifiers are encoded as a CBOR byte string if CBOR is used and as a base64 string if JSON is used. This security context is used to protect all future communication between the client and RS using OSCORE, as long as the access token is valid.
Note that the RS and client authenticate each other by generating the shared OSCORE security context using the PoP key as the Master Secret. An attacker posting a valid token to the RS will not be able to generate a valid OSCORE security context and thus will not be able to prove possession of the PoP key. Additionally, the mutual authentication is only achieved after the client has successfully verified a response from the RS protected with the generated OSCORE security context.
The client
MUST generate a nonce value N1 that is very unlikely to have been previously used with the same input keying material. The use of a 64-bit long random number as the nonce's value is
RECOMMENDED in this profile. The client
MUST store the nonce N1 as long as the response from the RS is not received and the access token related to it is still valid (to the best of the client's knowledge).
The client generates its own Recipient ID, ID1, for the OSCORE security context that it is establishing with the RS. By generating its own Recipient ID, the client makes sure that it does not collide with any of its Recipient IDs, nor with any other identifier ID1 if the client is executing this exchange with a different RS at the same time.
The client
MUST use CoAP and the authorization information resource as described in
Section 5.8.1 of
RFC 9200 to transport the token, N1, and ID1 to the RS.
Note that the use of the payload and the Content-Format is different from what is described in
Section 5.8.1 of
RFC 9200, which only transports the token without any CBOR wrapping. In this profile, the client
MUST wrap the token, N1, and ID1 in a CBOR map. The client
MUST use the Content-Format application/ace+cbor defined in
Section 8.16 of
RFC 9200. The client
MUST include the access token using the
access_token parameter; N1 using the
nonce1 parameter defined in
Section 4.1.1; and ID1 using the
ace_client_recipientid parameter defined in
Section 4.1.2.
The communication with the authz-info endpoint does not have to be protected, except for the update of access rights case described below.
Note that a client may be required to repost the access token in order to complete a request, since an RS may delete a stored access token (and associated security context) at any time, for example, due to all storage space being consumed. This situation is detected by the client when it receives an AS Request Creation Hints response. Reposting the same access token will result in deriving a new OSCORE security context to be used with the RS, as different exchanged nonces will be used.
The client may also choose to repost the access token in order to update its OSCORE security context. In that case, the client and the RS will exchange newly generated nonces, renegotiate identifiers, and derive new keying material. The client and RS might decide to keep the same identifiers or renew them during the renegotiation.
Figure 11 shows an example of the request sent from the client to the RS. The access token has been truncated for readability.
Header: POST (Code=0.02)
Uri-Host: "rs.example.com"
Uri-Path: "authz-info"
Content-Format: application/ace+cbor
Payload:
{
/ access_token / 1 : h'8343a1010aa2044c53/...
(remainder of access token (CWT) omitted for brevity)/',
/ nonce1 / 40 : h'018a278f7faab55a',
/ ace_client_recipientid / 43 : h'1645'
}
If the client has already posted a valid token, has already established a security association with the RS, and wants to update its access rights, the client can do so by posting the new token (retrieved from the AS and containing the update of access rights) to the /authz-info endpoint. The client
MUST protect the request using the OSCORE security context established during the first token exchange. The client
MUST only send the
access_token field in the CBOR map in the payload; no nonce or identifier is sent. After proper verification (see
Section 4.2), the RS will replace the old token with the new one, maintaining the same security context.
The
nonce1 parameter
MUST be sent from the client to the RS, together with the access token, if the ACE profile used is
coap_oscore, and the message is not an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for CBOR-based interactions and as a string (base64-encoded binary) for JSON-based interactions. This parameter is registered in
Section 9.2.
The
ace_client_recipientid parameter
MUST be sent from the client to the RS, together with the access token, if the ACE profile used is
coap_oscore, and the message is not an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for CBOR-based interactions and as a string (base64-encoded binary) for JSON-based interactions. This parameter is registered in
Section 9.2.
The RS
MUST follow the procedures defined in
Section 5.8.1 of
RFC 9200: the RS must verify the validity of the token. If the token is valid, the RS must respond to the POST request with 2.01 (Created). If the token is valid but is associated to claims that the RS cannot process (e.g., an unknown scope), or if any of the expected parameters are missing (e.g., any of the mandatory parameters from the AS or the identifier ID1), or if any parameters received in the
osc field are unrecognized, the RS must respond with an error response code equivalent to the CoAP code 4.00 (Bad Request). In the latter two cases, the RS may provide additional information in the error response, in order to clarify what went wrong. The RS may make an introspection request (see
Section 5.9.1 of
RFC 9200) to validate the token before responding to the POST request to the authz-info endpoint.
Additionally, the RS
MUST generate a nonce N2 that is very unlikely to have been previously used with the same input keying material and its own Recipient ID, ID2. The RS makes sure that ID2 does not collide with any of its Recipient IDs. The RS
MUST ensure that ID2 is different from the value received in the
ace_client_recipientid parameter. The RS sends N2 and ID2 within the 2.01 (Created) response. The payload of the 2.01 (Created) response
MUST be a CBOR map containing the
nonce2 parameter defined in
Section 4.2.1, set to N2, and the
ace_server_recipientid parameter defined in
Section 4.2.2, set to ID2. The use of a 64-bit long random number as the nonce's value is
RECOMMENDED in this profile. The RS
MUST use the Content-Format application/ace+cbor defined in
Section 8.16 of
RFC 9200.
Figure 12 shows an example of the response sent from the RS to the client.
Header: Created (Code=2.01)
Content-Format: application/ace+cbor
Payload:
{
/ nonce2 / 42 : h'25a8991cd700ac01',
/ ace_server_recipientid / 44 : h'0000'
}
As specified in
Section 5.8.3 of
RFC 9200, the RS must notify the client with an error response with code 4.01 (Unauthorized) for any long running request before terminating the session, when the access token expires.
If the RS receives the token in an OSCORE-protected message, it means that the client is requesting an update of access rights. The RS
MUST ignore any nonce and identifiers in the request, if any were sent. The RS
MUST check that the
kid of the
cnf claim of the new access token matches the identifier of the OSCORE Input Material of the context used to protect the message. If that is the case, the RS
MUST overwrite the old token and associate the new token to the security context identified by the
kid value in the
cnf claim. The RS
MUST respond with a 2.01 (Created) response protected with the same security context, with no payload. If any verification fails, the RS
MUST respond with a 4.01 (Unauthorized) error response.
As specified in
Section 5.8.1 of
RFC 9200, when receiving an updated access token with updated authorization information from the client (see
Section 3.1), it is recommended that the RS overwrites the previous token; that is, only the latest authorization information in the token received by the RS is valid. This simplifies the process needed by the RS to keep track of authorization information for a given client.
The
nonce2 parameter
MUST be sent from the RS to the client if the ACE profile used is
coap_oscore and the message is not a response to an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for CBOR-based interactions and as a string (base64-encoded binary) for JSON-based interactions. This parameter is registered in
Section 9.2
The
ace_server_recipientid parameter
MUST be sent from the RS to the client if the ACE profile used is
coap_oscore and the message is not a response to an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for CBOR-based interactions and as a string (base64-encoded binary) for JSON-based interactions. This parameter is registered in
Section 9.2
Once the 2.01 (Created) response is received from the RS, following the POST request to authz-info endpoint, the client
MUST extract the bstr nonce N2 from the
nonce2 parameter in the CBOR map in the payload of the response. Then, the client
MUST set the Master Salt of the security context created to communicate with the RS to the concatenation of salt, N1, and N2 in this order: Master Salt = salt | N1 | N2, where | denotes byte string concatenation, salt is the CBOR byte string received from the AS in
Section 3.2, and N1 and N2 are the two nonces encoded as CBOR byte strings. An example of Master Salt construction using CBOR encoding is given in
Figure 13.
N1, N2, and input salt expressed in CBOR diagnostic notation:
nonce1 = h'018a278f7faab55a'
nonce2 = h'25a8991cd700ac01'
input salt = h'f9af838368e353e78888e1426bd94e6f'
N1, N2, and input salt as CBOR encoded byte strings:
nonce1 = 0x48018a278f7faab55a
nonce2 = 0x4825a8991cd700ac01
input salt = 0x50f9af838368e353e78888e1426bd94e6f
Master Salt = 0x50 f9af838368e353e78888e1426bd94e6f
48 018a278f7faab55a 48 25a8991cd700ac01
If JSON is used instead of CBOR, the Master Salt of the security context is the base64 encoding of the concatenation of the same parameters, each of them prefixed by their size, encoded in 1 byte. When using JSON, the nonces and input salt have a maximum size of 255 bytes. An example of Master Salt construction using base64 encoding is given in
Figure 14.
N1, N2, and input salt values:
nonce1 = 0x018a278f7faab55a (8 bytes)
nonce2 = 0x25a8991cd700ac01 (8 bytes)
input salt = 0xf9af838368e353e78888e1426bd94e6f (16 bytes)
Input to base64 encoding: 0x10 f9af838368e353e78888e1426bd94e6f
08 018a278f7faab55a 08 25a8991cd700ac01
Master Salt = b64'EPmvg4No41PniIjhQmvZTm8IAYonj3+qtVoIJaiZHNcArAE='
The client
MUST set the Sender ID to the
ace_server_recipientid received in
Section 4.2 and set the Recipient ID to the
ace_client_recipientid sent in
Section 4.1. The client
MUST set the Master Secret from the parameter received from the AS in
Section 3.2. The client
MUST set the AEAD algorithm, ID Context, HKDF, and OSCORE version from the parameters received from the AS in
Section 3.2, if present. In case an optional parameter is omitted, the default value
SHALL be used as described in Sections
3.2 and
5.4 of [
RFC 8613]. After that, the client
MUST derive the complete security context following
Section 3.2.1 of
RFC 8613. From this point on, the client
MUST use this security context to communicate with the RS when accessing the resources as specified by the authorization information.
If any of the expected parameters are missing (e.g., any of the mandatory parameters from the AS or the RS), or if
ace_client_recipientid equals
ace_server_recipientid (and as a consequence, the Sender and Recipient Keys derived would be equal; see
Section 3.3 of
RFC 8613), then the client
MUST stop the exchange and
MUST NOT derive the security context. The client
MAY restart the exchange, to get the correct security material.
The client then uses this security context to send requests to the RS using OSCORE.
After sending the 2.01 (Created) response, the RS
MUST set the Master Salt of the security context created to communicate with the client to the concatenation of salt, N1, and N2 in the same way described above. An example of Master Salt construction using CBOR encoding is given in
Figure 13 and using base64 encoding is given in
Figure 14. The RS
MUST set the Sender ID from the
ace_client_recipientid received in
Section 4.1 and set the Recipient ID from the
ace_server_recipientid sent in
Section 4.2. The RS
MUST set the Master Secret from the parameter received from the AS and forwarded by the client in the access token in
Section 4.1 after validation of the token as specified in
Section 4.2. The RS
MUST set the AEAD algorithm, ID Context, HKDF, and OSCORE version from the parameters received from the AS and forwarded by the client in the access token in
Section 4.1 after validation of the token as specified in
Section 4.2, if present. In case an optional parameter is omitted, the default value
SHALL be used as described in Sections
3.2 and
5.4 of [
RFC 8613]. After that, the RS
MUST derive the complete security context following
Section 3.2.1 of
RFC 8613 and
MUST associate this security context with the authorization information from the access token.
The RS then uses this security context to verify requests and send responses to the client using OSCORE. If OSCORE verification fails, error responses are used, as specified in
Section 8 of
RFC 8613. Additionally, if OSCORE verification succeeds, the verification of access rights is performed as described in
Section 4.4. The RS
MUST NOT use the security context after the related token has expired and
MUST respond with an unprotected 4.01 (Unauthorized) error message to requests received that correspond to a security context with an expired token.
Note that the ID Context can be assigned by the AS, communicated and set in both the RS and client after the exchange specified in this profile is executed. Subsequently, the client and RS can update their ID Context by running a mechanism such as the one defined in
Appendix B.2 of
RFC 8613 if they both support it and are configured to do so. In that case, the ID Context in the OSCORE security context will not match the
contextId parameter of the corresponding OSCORE_Input_Material. Running Appendix
B.2 results in the keying material being updated in the security contexts of the client and RS; this same result can also be achieved by the client reposting the access token to the unprotected /authz-info endpoint at the RS, as described in
Section 4.1, but without updating the ID Context.
The RS
MUST follow the procedures defined in
Section 5.8.2 of
RFC 9200: if an RS receives an OSCORE-protected request from a client, then the RS processes it according to [
RFC 8613]. If OSCORE verification succeeds, and the target resource requires authorization, the RS retrieves the authorization information using the access token associated to the security context. The RS then must verify that the authorization information covers the resource and the action requested.