gateway icon indicating copy to clipboard operation
gateway copied to clipboard

How to add context_extensions for ext-auth grpc

Open quyenhoang96 opened this issue 1 year ago • 3 comments

I use the ext-auth grpc to auth + authz for my service. But it need to some custom data. How can I push that data into ext-auth via header or context_extensions

Example.

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata:
  name: ext-auth-example
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: myapp
  extAuth:
    grpc:
      backendRef:
        name: grpc-ext-auth
        port: 9002
     headersForAuth:
       - x-user: abc
       - x-product-id: 123
       - x-provider: um

or

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata:
  name: ext-auth-example
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: myapp
  extAuth:
    grpc:
      backendRef:
        name: grpc-ext-auth
        port: 9002
     contextExtensions:
       - x-user: abc
       - x-product-id: 123
       - x-provider: um

quyenhoang96 avatar May 23 '24 06:05 quyenhoang96

in the above example is x-user part of the request header ?

arkodg avatar May 23 '24 22:05 arkodg

in the above example is x-user part of the request header ? @arkodg It is not part of the header. It's just a custom field that I want the envoy to send to the ext-auth as additional information.

quyenhoang96 avatar May 24 '24 02:05 quyenhoang96

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] avatar Jun 23 '24 16:06 github-actions[bot]

@quyenhoang96 this should be possible with earlyRequestHeaders https://gateway.envoyproxy.io/latest/tasks/traffic/http-request-headers/#early-header-modification dup of https://github.com/envoyproxy/gateway/issues/4267

arkodg avatar Sep 20 '24 00:09 arkodg