Skip to content

Commit 0a81122

Browse files
authored
oidc: native oauth2 per-route config (#8703)
native oauth2 per-route config Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
1 parent 1595743 commit 0a81122

25 files changed

Lines changed: 583 additions & 477 deletions

examples/extension-server/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ go 1.26.2
44

55
require (
66
github.com/envoyproxy/gateway v1.3.1
7-
github.com/envoyproxy/go-control-plane v0.14.0
8-
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260304210048-a81710db7097
7+
github.com/envoyproxy/go-control-plane v0.14.1-0.20260409050421-3f47accd6e14
8+
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260409050421-3f47accd6e14
99
github.com/urfave/cli/v2 v2.27.7
1010
google.golang.org/grpc v1.80.0
1111
google.golang.org/protobuf v1.36.11

examples/extension-server/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
2222
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2323
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
2424
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
25-
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
26-
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
27-
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260304210048-a81710db7097 h1:Ou9X6qsPOiDOsQgaboj3jlCE5ZYngdYeSVDKBcT95QE=
28-
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260304210048-a81710db7097/go.mod h1:237/ZQHepDd4v5BjpRNFI2mMG7WEBd+mQnt8jwbqrnk=
25+
github.com/envoyproxy/go-control-plane v0.14.1-0.20260409050421-3f47accd6e14 h1:7g8SJv4OrVcLT4yfkzIbsTcwLBwyLu8gKb/yCf3Loxk=
26+
github.com/envoyproxy/go-control-plane v0.14.1-0.20260409050421-3f47accd6e14/go.mod h1:18SVzvkoF8AL2O7baVikhojMZ+7rFPh3o8tOOsBVyok=
27+
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260409050421-3f47accd6e14 h1:zEzMNlk4Kb4GpwKt2pmEc2B5+iM9rcmUYoB0mGHhXyU=
28+
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260409050421-3f47accd6e14/go.mod h1:5yRfenlmRH8sxKrhXyiFtK8BDz3syDWcFm81rkCcATM=
2929
github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds=
3030
github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0=
3131
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ require (
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
1212
github.com/docker/cli v29.4.0+incompatible
1313
github.com/dominikbraun/graph v0.23.0
14-
github.com/envoyproxy/go-control-plane v0.14.0
15-
github.com/envoyproxy/go-control-plane/contrib v1.36.1-0.20260115164926-066cbd5b3989
16-
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260304210048-a81710db7097
17-
github.com/envoyproxy/go-control-plane/ratelimit v0.1.1-0.20260115164926-066cbd5b3989
14+
github.com/envoyproxy/go-control-plane v0.14.1-0.20260409050421-3f47accd6e14
15+
github.com/envoyproxy/go-control-plane/contrib v1.36.1-0.20260409050421-3f47accd6e14
16+
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260409050421-3f47accd6e14
17+
github.com/envoyproxy/go-control-plane/ratelimit v0.1.1-0.20260409050421-3f47accd6e14
1818
github.com/envoyproxy/ratelimit v1.4.1-0.20260122083618-3fb702589d36
1919
github.com/evanphx/json-patch v5.9.11+incompatible
2020
github.com/evanphx/json-patch/v5 v5.9.11

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/
164164
github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
165165
github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes=
166166
github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
167-
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
168-
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
169-
github.com/envoyproxy/go-control-plane/contrib v1.36.1-0.20260115164926-066cbd5b3989 h1:KTd1TJym7dgV1L1XlxXeJNct7rJI3xTV+iuArq40wm0=
170-
github.com/envoyproxy/go-control-plane/contrib v1.36.1-0.20260115164926-066cbd5b3989/go.mod h1:+fG/snSdlOxU+5RWuuKSYxF9zusT3Duy1MDbETA44Bo=
171-
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260304210048-a81710db7097 h1:Ou9X6qsPOiDOsQgaboj3jlCE5ZYngdYeSVDKBcT95QE=
172-
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260304210048-a81710db7097/go.mod h1:237/ZQHepDd4v5BjpRNFI2mMG7WEBd+mQnt8jwbqrnk=
173-
github.com/envoyproxy/go-control-plane/ratelimit v0.1.1-0.20260115164926-066cbd5b3989 h1:8tBwE+GI3IWMywGVrJjc2grm7SCpPMydVu+HiBYb4+E=
174-
github.com/envoyproxy/go-control-plane/ratelimit v0.1.1-0.20260115164926-066cbd5b3989/go.mod h1:buWyXJdrI6ayYbeGm3upu3Qf/qHHrdWfUHKnVrTD+vM=
167+
github.com/envoyproxy/go-control-plane v0.14.1-0.20260409050421-3f47accd6e14 h1:7g8SJv4OrVcLT4yfkzIbsTcwLBwyLu8gKb/yCf3Loxk=
168+
github.com/envoyproxy/go-control-plane v0.14.1-0.20260409050421-3f47accd6e14/go.mod h1:18SVzvkoF8AL2O7baVikhojMZ+7rFPh3o8tOOsBVyok=
169+
github.com/envoyproxy/go-control-plane/contrib v1.36.1-0.20260409050421-3f47accd6e14 h1:VszH+75Lfplgo/ZDOe79HOGnLHAgPHWqFjMl7AdQEWw=
170+
github.com/envoyproxy/go-control-plane/contrib v1.36.1-0.20260409050421-3f47accd6e14/go.mod h1:29VWPXU81Y5hg3S89D3zXhbOgqgh93Os+W911d6SxP8=
171+
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260409050421-3f47accd6e14 h1:zEzMNlk4Kb4GpwKt2pmEc2B5+iM9rcmUYoB0mGHhXyU=
172+
github.com/envoyproxy/go-control-plane/envoy v1.37.1-0.20260409050421-3f47accd6e14/go.mod h1:5yRfenlmRH8sxKrhXyiFtK8BDz3syDWcFm81rkCcATM=
173+
github.com/envoyproxy/go-control-plane/ratelimit v0.1.1-0.20260409050421-3f47accd6e14 h1:128xSbKG9xp2W6JAyfb2Q2pDrEC5bhtUcfYpJZf6OdA=
174+
github.com/envoyproxy/go-control-plane/ratelimit v0.1.1-0.20260409050421-3f47accd6e14/go.mod h1://utHaGoDyMdS6rB87A76UIaRn+Ss9dS2ZJ5rM2psGU=
175175
github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds=
176176
github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0=
177177
github.com/envoyproxy/ratelimit v1.4.1-0.20260122083618-3fb702589d36 h1:nEi1OH2qhE8NtcuBgO/uKpTw/P0nVu4i8mZvL6oD9CQ=

internal/xds/extensions/extensions.gen.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/kafka_mesh/v3alpha"
3030
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/metadata_exchange/v3"
3131
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/mysql_proxy/v3"
32+
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/peer_metadata/v3"
3233
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/postgres_proxy/v3alpha"
3334
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/rocketmq_proxy/v3"
3435
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/sip_proxy/router/v3alpha"
@@ -42,6 +43,7 @@ import (
4243
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/private_key_providers/qat/v3alpha"
4344
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/regex_engines/hyperscan/v3alpha"
4445
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/router/cluster_specifier/golang/v3alpha"
46+
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/stat_sinks/kafka/v3"
4547
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/tap_sinks/udp_sink/v3alpha"
4648
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha"
4749
_ "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/vcl/v3alpha"
@@ -185,6 +187,7 @@ import (
185187
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/original_dst/v3"
186188
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/original_src/v3"
187189
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/proxy_protocol/v3"
190+
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/set_filter_state/v3"
188191
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/listener/tls_inspector/v3"
189192
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/connection_limit/v3"
190193
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/direct_response/v3"
@@ -225,6 +228,8 @@ import (
225228
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/udp/udp_proxy/session/http_capsule/v3"
226229
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/udp/udp_proxy/v3"
227230
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/cel/v3"
231+
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/file_content/v3"
232+
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/generic_secret/v3"
228233
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/metadata/v3"
229234
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/req_without_query/v3"
230235
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/geoip_providers/common/v3"
@@ -296,6 +301,7 @@ import (
296301
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/apple/v3"
297302
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/cares/v3"
298303
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/getaddrinfo/v3"
304+
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/hickory/v3"
299305
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/network/socket_interface/v3"
300306
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/outlier_detection_monitors/common/v3"
301307
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/outlier_detection_monitors/consecutive_errors/v3"
@@ -330,6 +336,7 @@ import (
330336
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/stat_sinks/open_telemetry/v3"
331337
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/stat_sinks/wasm/v3"
332338
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/string_matcher/lua/v3"
339+
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/tracers/dynamic_modules/v3"
333340
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/tracers/fluentd/v3"
334341
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/tracers/opentelemetry/resource_detectors/v3"
335342
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/tracers/opentelemetry/samplers/v3"
@@ -350,6 +357,7 @@ import (
350357
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/cert_validator/dynamic_modules/v3"
351358
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
352359
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/udp_packet_writer/v3"
360+
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/dynamic_modules/v3"
353361
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/generic/v3"
354362
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/http/v3"
355363
_ "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/http/tcp/v3"

internal/xds/translator/oidc.go

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ var _ httpFilter = &oidc{}
3636

3737
// patchHCM builds and appends the oauth2 Filters to the HTTP Connection Manager
3838
// if applicable, and it does not already exist.
39-
// Note: this method creates an oauth2 filter for each route that contains an OIDC config.
40-
// the filter is disabled by default. It is enabled on the route level.
4139
func (*oidc) patchHCM(mgr *hcmv3.HttpConnectionManager, irListener *ir.HTTPListener) error {
42-
var errs error
43-
4440
if mgr == nil {
4541
return errors.New("hcm is nil")
4642
}
@@ -49,56 +45,43 @@ func (*oidc) patchHCM(mgr *hcmv3.HttpConnectionManager, irListener *ir.HTTPListe
4945
return errors.New("ir listener is nil")
5046
}
5147

48+
if hcmContainsFilter(mgr, string(egv1a1.EnvoyFilterOAuth2)) {
49+
return nil
50+
}
51+
5252
for _, route := range irListener.Routes {
5353
if !routeContainsOIDC(route) {
5454
continue
5555
}
5656

57-
// Only generates one OAuth2 Envoy filter for each unique name.
58-
// For example, if there are two routes under the same gateway with the
59-
// same OAuth2 config, only one OAuth2 filter will be generated.
60-
if hcmContainsFilter(mgr, oauth2FilterName(route.Security.OIDC)) {
61-
continue
62-
}
63-
64-
filter, err := buildHCMOAuth2Filter(route.Security)
57+
filter, err := buildHCMOAuth2Filter()
6558
if err != nil {
66-
errs = errors.Join(errs, err)
67-
continue
59+
return err
6860
}
69-
7061
mgr.HttpFilters = append(mgr.HttpFilters, filter)
62+
return nil
7163
}
7264

73-
return errs
65+
return nil
7466
}
7567

76-
// buildHCMOAuth2Filter returns an OAuth2 HTTP filter from the provided IR HTTPRoute.
77-
func buildHCMOAuth2Filter(securityFeatures *ir.SecurityFeatures) (*hcmv3.HttpFilter, error) {
78-
oauth2Proto, err := oauth2Config(securityFeatures)
79-
if err != nil {
80-
return nil, err
81-
}
82-
68+
// buildHCMOAuth2Filter returns the listener-level OAuth2 HTTP filter.
69+
func buildHCMOAuth2Filter() (*hcmv3.HttpFilter, error) {
70+
oauth2Proto := &oauth2v3.OAuth2{}
8371
OAuth2Any, err := proto.ToAnyWithValidation(oauth2Proto)
8472
if err != nil {
8573
return nil, err
8674
}
8775

8876
return &hcmv3.HttpFilter{
89-
Name: oauth2FilterName(securityFeatures.OIDC),
90-
Disabled: true,
77+
Name: string(egv1a1.EnvoyFilterOAuth2),
9178
ConfigType: &hcmv3.HttpFilter_TypedConfig{
9279
TypedConfig: OAuth2Any,
9380
},
9481
}, nil
9582
}
9683

97-
func oauth2FilterName(oidc *ir.OIDC) string {
98-
return perRouteFilterName(egv1a1.EnvoyFilterOAuth2, oidc.Name)
99-
}
100-
101-
func oauth2Config(securityFeatures *ir.SecurityFeatures) (*oauth2v3.OAuth2, error) {
84+
func oauth2Config(securityFeatures *ir.SecurityFeatures) (*oauth2v3.OAuth2PerRoute, error) {
10285
var (
10386
tokenEndpointCluster string
10487
err error
@@ -135,7 +118,7 @@ func oauth2Config(securityFeatures *ir.SecurityFeatures) (*oauth2v3.OAuth2, erro
135118
// If the user wants to forward the oauth2 access token to the upstream service,
136119
// we should not preserve the original authorization header.
137120
preserveAuthorizationHeader := !oidc.ForwardAccessToken
138-
oauth2 := &oauth2v3.OAuth2{
121+
oauth2 := &oauth2v3.OAuth2PerRoute{
139122
Config: &oauth2v3.OAuth2Config{
140123
StatPrefix: oidc.Name,
141124
TokenEndpoint: &corev3.HttpUri{
@@ -589,11 +572,19 @@ func (*oidc) patchRoute(route *routev3.Route, irRoute *ir.HTTPRoute, _ *ir.HTTPL
589572
if irRoute.Security == nil || irRoute.Security.OIDC == nil {
590573
return nil
591574
}
592-
filterName := oauth2FilterName(irRoute.Security.OIDC)
593-
if err := enableFilterOnRoute(route, filterName, &routev3.FilterConfig{
594-
Config: &anypb.Any{},
595-
}); err != nil {
575+
oauth2Proto, err := oauth2Config(irRoute.Security)
576+
if err != nil {
596577
return err
597578
}
579+
if route.TypedPerFilterConfig == nil {
580+
route.TypedPerFilterConfig = make(map[string]*anypb.Any)
581+
}
582+
583+
oauth2Any, err := proto.ToAnyWithValidation(oauth2Proto)
584+
if err != nil {
585+
return err
586+
}
587+
588+
route.TypedPerFilterConfig[string(egv1a1.EnvoyFilterOAuth2)] = oauth2Any
598589
return nil
599590
}

internal/xds/translator/testdata/out/xds-ir/multiple-listeners-same-port-with-different-filters.listeners.yaml

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,9 @@
3939
'@type': type.googleapis.com/envoy.extensions.filters.http.basic_auth.v3.BasicAuth
4040
users:
4141
inlineBytes: dXNlcjE6e1NIQX10RVNzQm1FL3lOWTNsYjZhMEw2dlZRRVpOcXc9CnVzZXIyOntTSEF9RUo5TFBGRFhzTjl5blNtYnh2anA3NUJtbHg4PQo=
42-
- disabled: true
43-
name: envoy.filters.http.oauth2/securitypolicy/default/policy-for-gateway-2
42+
- name: envoy.filters.http.oauth2
4443
typedConfig:
4544
'@type': type.googleapis.com/envoy.extensions.filters.http.oauth2.v3.OAuth2
46-
config:
47-
authScopes:
48-
- openid
49-
- email
50-
- profile
51-
authType: BASIC_AUTH
52-
authorizationEndpoint: https://oauth.foo.com/oauth2/v2/auth
53-
credentials:
54-
clientId: client.oauth.foo.com
55-
cookieNames:
56-
bearerToken: AccessToken-5F93C2E4
57-
idToken: IdToken-5F93C2E4
58-
oauthExpires: OauthExpires-5F93C2E4
59-
oauthHmac: OauthHMAC-5F93C2E4
60-
oauthNonce: OauthNonce-5F93C2E4
61-
refreshToken: RefreshToken-5F93C2E4
62-
hmacSecret:
63-
name: oauth2/hmac_secret/securitypolicy/default/policy-for-gateway-2
64-
sdsConfig:
65-
ads: {}
66-
resourceApiVersion: V3
67-
tokenSecret:
68-
name: oauth2/client_secret/securitypolicy/default/policy-for-gateway-2
69-
sdsConfig:
70-
ads: {}
71-
resourceApiVersion: V3
72-
preserveAuthorizationHeader: true
73-
redirectPathMatcher:
74-
path:
75-
exact: /foo/oauth2/callback
76-
redirectUri: https://www.example.com/foo/oauth2/callback
77-
signoutPath:
78-
path:
79-
exact: /foo/logout
80-
statPrefix: securitypolicy/default/policy-for-gateway-2
81-
tokenEndpoint:
82-
cluster: oauth_foo_com_443
83-
timeout: 10s
84-
uri: https://oauth.foo.com/token
85-
useRefreshToken: true
8645
- name: envoy.filters.http.router
8746
typedConfig:
8847
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

internal/xds/translator/testdata/out/xds-ir/multiple-listeners-same-port-with-different-filters.routes.yaml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,45 @@
4040
upgradeConfigs:
4141
- upgradeType: websocket
4242
typedPerFilterConfig:
43-
envoy.filters.http.oauth2/securitypolicy/default/policy-for-gateway-2:
44-
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
45-
config: {}
43+
envoy.filters.http.oauth2:
44+
'@type': type.googleapis.com/envoy.extensions.filters.http.oauth2.v3.OAuth2PerRoute
45+
config:
46+
authScopes:
47+
- openid
48+
- email
49+
- profile
50+
authType: BASIC_AUTH
51+
authorizationEndpoint: https://oauth.foo.com/oauth2/v2/auth
52+
credentials:
53+
clientId: client.oauth.foo.com
54+
cookieNames:
55+
bearerToken: AccessToken-5F93C2E4
56+
idToken: IdToken-5F93C2E4
57+
oauthExpires: OauthExpires-5F93C2E4
58+
oauthHmac: OauthHMAC-5F93C2E4
59+
oauthNonce: OauthNonce-5F93C2E4
60+
refreshToken: RefreshToken-5F93C2E4
61+
hmacSecret:
62+
name: oauth2/hmac_secret/securitypolicy/default/policy-for-gateway-2
63+
sdsConfig:
64+
ads: {}
65+
resourceApiVersion: V3
66+
tokenSecret:
67+
name: oauth2/client_secret/securitypolicy/default/policy-for-gateway-2
68+
sdsConfig:
69+
ads: {}
70+
resourceApiVersion: V3
71+
preserveAuthorizationHeader: true
72+
redirectPathMatcher:
73+
path:
74+
exact: /foo/oauth2/callback
75+
redirectUri: https://www.example.com/foo/oauth2/callback
76+
signoutPath:
77+
path:
78+
exact: /foo/logout
79+
statPrefix: securitypolicy/default/policy-for-gateway-2
80+
tokenEndpoint:
81+
cluster: oauth_foo_com_443
82+
timeout: 10s
83+
uri: https://oauth.foo.com/token
84+
useRefreshToken: true

0 commit comments

Comments
 (0)