Extends CrudApiPlugin to support Entra auth. Closes #556 #574
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.
Extends CrudApiPlugin to support Entra auth. Closes #556
To test, you can use the northwind db sample
Update orders-api.json for example to:
Call the API from curl by passing a valid Entra token:
curl -ix http://127.0.0.1:8000 -H "authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbG...." https://api.northwind.com/orders
In
entraAuthConfig
you can specify several options as to what parts of the token you want the API to validate:audience
: set to the audience string from the token to validate the audience, eg.https://manage.office.com
issuer
: set to the ID of the IdP that issued the token, eg.https://sts.windows.net/06fde681-d710-4b73-8bc6-90585c5630e9/
scopes
: set to define the list of scopes for all actions. The token must have at least one of the scopesroles
: set to define the list of roles for all actions. The token must have at least of the rolesvalidateLifetime
: set totrue
for the API to validate if the token hasn't expiredvalidateSigningKey
: set totrue
for the API to validate if the token signature is valid. Requires you to specify a valid and untempered with token issued by EntraAll these properties can be overriden on each action, which allows you to for example specify unique scopes/roles for each action: