Skip to content

Commit

Permalink
Merge pull request #59 from AMWA-TV/validating-access-token
Browse files Browse the repository at this point in the history
Clarify process for retrieving a missing issuer public key.
  • Loading branch information
TheSaneWonko authored May 22, 2024
2 parents d6f403b + 230032a commit db79752
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/Validating Access Tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ _(c) AMWA 2021, CC Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)_
There are a number of steps that need to be considered while [validating the access token](https://specs.amwa.tv/is-10/releases/v1.0.0/docs/4.5._Behaviour_-_Resource_Servers.html#validation-of-access-token).

- Check that the JWT is well-formed, such as JWT contains three segments, Header, Payload and Signature, separated by period ('.') characters. Each segment is Base64url encoded.
- Verify the Signature, using the issuer's public key, to ensure the token has not been tampered with. In event the issuer [public key](https://specs.amwa.tv/is-10/releases/v1.0.0/docs/4.5._Behaviour_-_Resource_Servers.html#public-keys) is not known, fetch the missing public key via the token `iss` claim as specified in [RFC 8414](https://tools.ietf.org/html/rfc8414 "OAuth 2.0 Authorization Server Metadata") section 3, and temporarily respond with an HTTP 503 code in order to avoid blocking the incoming authorized request.
- Verify the Signature, using the issuer's public key, to ensure the token has not been tampered with.
- In event the issuer [public key](https://specs.amwa.tv/is-10/releases/v1.0.0/docs/4.5._Behaviour_-_Resource_Servers.html#public-keys) is not known, respond with an HTTP `503` (Service Unavailable) code in order to avoid blocking the incoming authorized request, and fetch the missing public key from the server metadata's `jwks_uri` endpoint. The server metadata can be retrieved via the token `iss` claim as specified in [RFC 8414](https://tools.ietf.org/html/rfc8414 "OAuth 2.0 Authorization Server Metadata") section 3.
- Check the registered claims, such as token expiration `exp` and token audience `aud`.
- Check the private claims, to verify whether it has permission for accessing the API.

Expand Down

0 comments on commit db79752

Please sign in to comment.