envoyproxy / envoyproxy/gateway
How to match JWT claims with a header using dynamically?
- Vorherrschende Sprache
- Go
- Sterne
- 3k
- Forks
- 864
- Ø Merge
- 2 T. 2 Std.
- Gemergte PRs (30 T.)
- 140
Beschreibung
I am working with envoygateway. And I am trying to authorize a request using the claims mentioned in the JWT token. https://gateway.envoyproxy.io/docs/tasks/security/jwt-claim-authorization/
The incoming request has a header called tenant-id.
And the claim can contain a list of values under a claim called tenants.
The request should be allowed only if the the header x-scope-org-id contains a value that is part of the tenant claim.
Currently I don't find a way to dynamically access the
```
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata:
name: authorization-jwt-claim
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: backend
jwt:
providers:
- name: example
issuer: https://foo.bar.com
remoteJWKS:
uri: https://raw.githubusercontent.com/envoyproxy/gateway/refs/heads/main/examples/kubernetes/jwt/jwks.json
authorization:
defaultAction: Deny
rules:
- name: "allow"
action: Allow
principal:
jwt:
provider: example
claims:
- name: tenants
values: ["ABC"]
- name: "allow"
action: Allow
principal:
jwt:
provider: example
claims:
- name: tenants
values: ["DEF"]
```
And in this way the security policy will explode.
What I am looking for is to achieve something like following than string literal.
```
- name: "allow"
action: Allow
principal:
jwt:
provider: example
claims:
- name: tenants
values: ["%REQ(tenant-id)%"] << Error: not working
```
So how can I evaluate a header and compare with a claim.
I am open to ideas.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.