目前我们正在使用 EnvoyFilter 来添加身份验证检查。这个过滤器使用了 envoyext_authz
过滤器。
我们有一个用于匿名和授权调用的 GraphQL 端点。由于公共呼叫不需要身份验证检查/过滤器,我希望能够基于 cookie 跳过此过滤器。我尝试在网上搜索解决方案,但找不到。
请参阅下面的过滤器配置:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: oathkeeper
namespace: istio-system
spec:
workloadSelector:
labels:
istio: ingressgateway
configPatches:
- applyTo: HTTP_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
subFilter:
name: "envoy.filters.http.router"
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.ext_authz
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
failure_mode_allow: false
http_service:
path_prefix: /decisions
server_uri:
uri: http://oathkeeper-api.default.svc.cluster.local:4456
cluster: outbound|4456||oathkeeper-api.default.svc.cluster.local
timeout: 10s
authorization_request:
allowed_headers:
patterns:
- exact: accept
- exact: authorization
- exact: cookie
- exact: content-type
- exact: x-forwarded-for
- exact: x-forwarded-proto
- exact: x-forwarded-host
authorization_response:
allowed_upstream_headers:
patterns:
- exact: authorization