Skip to content

Commit 125ee38

Browse files
Updates after proof reading
1 parent 93bf809 commit 125ee38

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

Documents/Authorization.md

+26-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Authorization in nmos-cpp
22

3-
This is based on the ``OAuth 2.0`` recommendations which allows NMOS Node and NMOS Registry to protect APIs by giving limited access to third-party applications. Third-party applications might include Broadcast Controllers, which queries the Registry via the IS-04 API and handles connection to nodes via the IS-05 API. NMOS Nodes also act as a third-party to the Registry when performing IS-04 node registrations.
3+
Authorization in nmos-cpp is based on the IS-10 / BCP-003-02 specifications, which are themselves based on OAuth 2.0.
4+
5+
Authorization allows NMOS Nodes and Registries to protect APIs by limiting their access by third-party applications.
6+
7+
Third-party applications might include Broadcast Controllers, which queries the Registry via the IS-04 API and handles connections to nodes via the IS-05 API. NMOS Nodes also act as a third-party to the Registry when performing IS-04 node registrations.
48

59
## Overview
610

@@ -14,7 +18,7 @@ A similar idea is also applied to how Nodes perform node registration. The Regis
1418

1519
## Client Registration
1620

17-
This this context the term Client is used to refer to clients of the Authorization Server. In this way Broadcast Controllers, Registries and Nodes are all referred to here as Clients.
21+
In this context the term Client is used to refer to clients of the Authorization Server. In this way Broadcast Controllers, Registries and Nodes are all referred to as Clients.
1822

1923
Clients locate the Authorization Server's API endpoints via DNS-SD. The Authorization Server has a well-known endpoint for returning server metadata.
2024

@@ -28,13 +32,15 @@ See the client registration sequence diagram below on how a Node is registered t
2832

2933
## Access Token
3034

31-
There are a number of ways to request the access token according to the type of authorization grant. The grant type depends on the location and the nature of the Client involved in obtaining the access token.
35+
There are two ways of requesting access tokens from the Authomrization Server according to the type of authorization grant used. The grant type depends on the location and the nature of the Client involved in obtaining the access token.
3236

33-
A number of grant types are defined in OAuth 2.0. IS-10/BCP-003-02 focuses on using the following grant types; the ``Authorization Code Grant`` and the ``Client Credentials Grant``.
37+
A number of grant types are defined in OAuth 2.0, but the IS-10/BCP-003-02 specifications focus on using the following grant types:
38+
- Authorization Code Grant.
39+
- Client Credentials Grant.
3440

3541
### Authorization Code Grant
3642

37-
This recommended grant type and should be used if the Client runs within web browser (for instance a Broadcast Controller). An authorization code is returned by the Authorization Server via the client's redirect URI. The client can then exchange this code for a time-limited access token, which can be renewed with the refresh token.
43+
This is the recommended grant type and should be used if the Client runs within web browser (for instance a Broadcast Controller). An authorization code is returned by the Authorization Server via the Client's redirect URI. The Client can then exchange this code for a time-limited access token, which can be renewed with the refresh token.
3844

3945
For public clients, there is a risk of an attacker hijacking the authorization code. To prevent this Proof Key for Code Exchange (PKCE) is used to further secure the Authorization Code flow.
4046

@@ -48,7 +54,7 @@ Step 2. Convert the ``code_verifier`` to ``code_challenge`` with the following l
4854
code_challenge=BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))
4955
```
5056

51-
Step 3. Includes the ``code_challege`` and the hashing method used to generate the ``code_challenge`` in the authorization code request.
57+
Step 3. Includes the ``code_challenge`` and the hashing method used to generate the ``code_challenge`` in the authorization code request.
5258

5359
Step 4. Send the ``code_verifier`` and the ``authorization code`` in exchange for the token. The Authorization Server uses the ``code_verifier`` to recreate the matching ``code_challenge`` to verify the client.
5460

@@ -64,43 +70,45 @@ For extra security the Node uses ``Private Key JWT`` to authenticate with the Au
6470

6571
## Authorization Server Public Keys
6672

67-
The public keys are used by the Resource(s) Server for validating the access token before giving access right to it's protected APIs. The client must periodically poll the Authorization Server's ``public keys``, typically once every hour. In the event, that the Authorization Server is no longer available, the last fetched public keys will be kept in use until the Authorization Server connection is restored.
73+
Public keys are used by the Node for validating the access token before allowing access to its protected APIs. The Client must periodically poll the Authorization Server for its public keys, typically once every hour. In the event that the Authorization Server is no longer available, the last fetched public keys will be kept in use until the Authorization Server connection is restored.
6874

69-
The token validation is done by re-generating the matching token signature by signing the token header and the token payload.
75+
Token validation is done by regenerating the matching token signature. This is done by signing the token header and the token payload.
7076

7177
![Public-Keys](images/Authorization-Public-Keys.png)
7278

73-
## Authorization behaviour
79+
## Authorization Behaviour
7480

7581
> [nmos/authorization_behaviour.cpp](../../Development/nmos/authorization_behaviour.cpp)
7682
7783
The required Authorization behaviour includes:
7884

79-
- discovery of the Authorization Server
80-
- fetch Authorization Server metadata for Authorization Server endpoints and supported features
81-
- Authorization client registration
82-
- fetch Authorization Server public keys
83-
- fetch Bearer token for accessing protected endpoints
85+
- Discovery of the Authorization Server.
86+
- Fetch Authorization Server metadata for Authorization Server endpoints and supported features.
87+
- Authorization Client registration.
88+
- Fetch Authorization Server public keys.
89+
- Fetch Bearer token for accessing protected endpoints.
8490

8591
The state machine implemented by the ```nmos::experimental::authorization_behaviour_thread``` is shown below:
8692

8793
![Authorization-behaviour](images/Authorization-behaviour.png)
8894

89-
## Missing public keys to validate the access token
95+
## Validating Access Tokens When Public Keys Are Missing
9096

9197
> [nmos/authorization_handlers.cpp](../../Development/nmos/authorization_handlers.cpp)
9298
> [nmos/authorization_behaviour.cpp](../../Development/nmos/authorization_behaviour.cpp)
9399
94-
If no matching public key is available to validate the incoming access token. The validation handler will trigger the authorization token issuer thread to fetch and cache the public keys from this token's issuer, which will then be possible to validate any token issued by this issuer.
100+
If no matching public key is available to validate the incoming access token the validation handler will trigger the authorization token issuer thread to fetch and cache the public keys from this token's issuer, which can then be used to validate any token issued by this issuer.
95101

96102
The state machine implemented by the ```nmos::experimental::validate_authorization_handler``` and the ```nmos::experimental::authorization_token_issuer_thread``` are shown below:
97103

98104
![missing-public-keys](images/Authorization-Missing-Public-Keys.png)
99105

100-
In addition, if the Authorization behaviour thread is excluded, the NMOS Node/Registry can easily be configured as a headless ``OAuth 2.0`` enabled device. Where the access token will be fed in externally via the ```nmos::experimental::get_authorization_bearer_token_handler``` callback and the access token validation will be happening on the ```nmos::experimental::validate_authorization_token_handler``` callback.
106+
In addition, if the Authorization behaviour thread is excluded, the Node/Registry can easily be configured as a headless OAuth 2.0 enabled device.
107+
108+
In this case the access token will be fed in externally via the ```nmos::experimental::get_authorization_bearer_token_handler``` callback and the access token validation will be happening on the ```nmos::experimental::validate_authorization_token_handler``` callback.
101109

102110
## OAuth 2.0 Node Registration Example
103111

104-
Following is an overview of how an ``OAuth 2.0`` NMOS Node registers to an ``OAuth 2.0`` enabled NMOS Registry.
112+
The following is an overview of how an OAuth 2.0 Node registers to an OAuth 2.0 enabled Registry.
105113

106114
![Node-Registration](images/Authorization-Node-Registration.png)

0 commit comments

Comments
 (0)