【问题标题】:How to configure public access web api in envoyproxy?如何在 envoyproxy 中配置公共访问 web api?
【发布时间】:2021-11-29 23:08:27
【问题描述】:

我是 envoyproxy 的新手,在不提供授权标头的情况下尝试访问端点时出现“jwt is missing”错误。 如何在没有 auth 标头的情况下访问公共 api IE http://hostaddress/v1/fares/locations/location?searchTerm=ABC

下面的代码显示了已经添加的使用 Jwt auth 的现有集群。

 http_filters:
              - name: envoy.filters.http.grpc_http1_bridge
                typed_config: {}
              - name: envoy.filters.http.cors
                typed_config: {}
              - name: envoy.filters.http.jwt_authn
                typed_config:
                  "@type": type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication
                  providers:
                    identity_api:
                      issuer: 'null'
                      audiences:
                      - apigw
                      forward: true
                      remote_jwks:
                        http_uri:
                          uri: http://abc.identity.api/.well-known/openid-configuration/jwks
                          cluster: identity_api
                          timeout: 1s   
                        cache_duration:
                          seconds: 30
                      from_headers:
                      - name: Authorization
                        value_prefix: "Bearer "
                  rules:
                  - match: { prefix: /v1/newhubs/ }
                  - match: { prefix: / }
                    requires:
                      provider_name: identity_api
              - name: envoy.filters.http.ext_authz
                typed_config:
                  "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
                  transport_api_version: V3
                  grpc_service:
                    envoy_grpc:
                      cluster_name: permissions_api_grpc
                    timeout: 3s
                  with_request_body:
                    max_request_bytes: 819200
                    allow_partial_message: true
              - name: envoy.filters.http.router
                typed_config: {}

【问题讨论】:

  • 有人可以帮忙吗?

标签: kubernetes microservices envoyproxy


【解决方案1】:

您的jwt_authn 通过根路径匹配所有路径:match: { prefix: / }

删除match: { prefix: / } 条目以仅使您的jwt_authn 过滤器匹配/v1/newhubs/

【讨论】:

  • 感谢您回答这个问题。是否可以过滤掉我们需要匹配的单个路径:{前缀:/}对于该路径以外的其他路径。
  • @Khaan 我认为您不能配置例外,因为规则是基于路径的。一种解决方案可能是将任何受保护的内容移动到 /secure 并将过滤器更改为该路径。
猜你喜欢
  • 2015-11-20
  • 1970-01-01
  • 1970-01-01
  • 2022-01-27
  • 2016-05-23
  • 2020-07-01
  • 1970-01-01
  • 2020-09-24
  • 2011-07-31
相关资源
最近更新 更多