Skip to content

Commit

Permalink
relax https for jwks
Browse files Browse the repository at this point in the history
Signed-off-by: huabing zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Dec 20, 2023
1 parent d13c329 commit fac185f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/xds/translator/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func buildJWTAuthn(irListener *ir.HTTPListener) (*jwtauthnv3.JwtAuthentication,
for i := range route.JWT.Providers {
irProvider := route.JWT.Providers[i]
// Create the cluster for the remote jwks, if it doesn't exist.
jwksCluster, err := url2Cluster(irProvider.RemoteJWKS.URI)
jwksCluster, err := url2Cluster(irProvider.RemoteJWKS.URI, false)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/xds/translator/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func oauth2FilterName(route *ir.HTTPRoute) string {
}

func oauth2Config(route *ir.HTTPRoute) (*oauth2v3.OAuth2, error) {
cluster, err := url2Cluster(route.OIDC.Provider.TokenEndpoint)
cluster, err := url2Cluster(route.OIDC.Provider.TokenEndpoint, true)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -218,7 +218,7 @@ func createOAuth2TokenEndpointClusters(tCtx *types.ResourceVersionTable,
err error
)

cluster, err = url2Cluster(route.OIDC.Provider.TokenEndpoint)
cluster, err = url2Cluster(route.OIDC.Provider.TokenEndpoint, true)
if err != nil {
errs = multierror.Append(errs, err)
continue
Expand Down
4 changes: 2 additions & 2 deletions internal/xds/translator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type urlCluster struct {
}

// url2Cluster returns a urlCluster from the provided url.
func url2Cluster(strURL string) (*urlCluster, error) {
func url2Cluster(strURL string, secure bool) (*urlCluster, error) {
epType := EndpointTypeDNS

// The URL should have already been validated in the gateway API translator.
Expand All @@ -41,7 +41,7 @@ func url2Cluster(strURL string) (*urlCluster, error) {
return nil, err
}

if u.Scheme != "https" {
if secure && u.Scheme != "https" {
return nil, fmt.Errorf("unsupported URI scheme %s", u.Scheme)
}

Expand Down

0 comments on commit fac185f

Please sign in to comment.