envoyproxy / envoyproxy/gateway

How to match JWT claims with a header using dynamically?

Abierto
#5,978 8 comentarios 0 reacciones 0 asignados Ver en GitHub
kind/feature stale
Lenguaje dominante
Go
Estrellas
3k
Forks
864
Merge medio
2 d 2 h
PR fusionados (30 d)
140

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.