Support for "host" lookup key passed as context extension #229
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.
Adds support for the "host" AuthConfig lookup key to be provided in the payload to the /Check request as Envoy ext-authz per-route "context extension".
Authorino will favor the "host" lookup key whenever passed in the context extensions before the actual "host" HTTP attribute.
This is an alternative approach for enhanced AuthConfig lookups, without changing the lookup structure too much, although relying more on Envoy to set the right payload.
This should be enough to cover use cases such as of path-based AuthConfig lookup and wildcard subdomains AuthConfig lookup.
Closes #222
Closes #171
Verification steps
Path-based AuthConfig lookup use case
In this use case, 2 different APIs are behind the same base domain and differentiated by the path prefix:
pets.com/dogs
→ Dogs APIpets.com/cats
→ Cats APIBuild and deploy this branch:
Edit the sample Envoy config to include the required 'host' context extension that will make Authorino to favour this as lookup key before the actual host of the request:
In the above, we've used the same upstream API (i.e.
talker-api
) for both routes only for demo purposes. In a real-life scenario, "dogs" and "cats" would be 2 different upstream APIs.Restart Envoy:
Forward the requests:
kubectl -n authorino port-forward deployment/envoy 8000:8000 &
Apply the AuthConfigs:
Create the API keys:
Consume the APIs under same base domain:
Wildcard subdomain AuthConfig lookup use case
In this use case, a single Pets API serves requests for any subdomain that matches
*.pets.com
, e.g.:dogs.pets.com
→ Pets APIcats.pets.com
→ Pets APIBuild and deploy this branch:
Edit the sample Envoy config to include the required 'host' context extension that will make Authorino to favour this as lookup key before the actual host of the request:
The "host" context extension above is any key that matches one of the hosts listed in the targeted AuthConfig.
Restart Envoy:
Forward the requests:
kubectl -n authorino port-forward deployment/envoy 8000:8000 &
Apply the AuthConfig:
Create an API key:
Consume the API under different subdomains: