envoyproxy / envoyproxy/gateway
How to match JWT claims with a header using dynamically?
- Lingua principale
- Go
- Stelle
- 3k
- Fork
- 864
- Merge medio
- 2g 2h
- PR unite (30g)
- 140
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.