feat(server): add JWT-based authorization mode #817
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #812
This PR implements the proposal issue for JSON Web Token based authorization in the notary server. I tried my best to keep the addition of JWT validation mechanism the least invasive and thus the extraction logic is handled in existing
AuthorizationMiddleware
struct where we guide the extractor which header and token/API key to look for based on the server's config.Server's config is now expecting an enum
This way, only one mode is possible and this is enforced at config parsing level.
I have also added an integration test which mirrors that for the whitelist authorization but where we use JWT token for authorization.
Finally, I've updated the README and openapi spec to reflect the proposed changes.
Lemme know what you think! Hopefully this PR will make reading and deciding on the proposal in #812 a little easier since it outlines the number of required changes to make it a reality.