Skip to content

Commit

Permalink
Consistent JWTProviderKey support in provision and samples create com…
Browse files Browse the repository at this point in the history
…mands (#111)
  • Loading branch information
rockspore authored Nov 19, 2020
1 parent dbea0ba commit 4b1a5af
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 15 deletions.
3 changes: 3 additions & 0 deletions cmd/provision/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func (p *provision) createConfig(cred *keySecret) *server.Config {
EnvName: p.Env,
AllowUnverifiedSSLCert: p.InsecureSkipVerify,
},
Auth: server.AuthConfig{
JWTProviderKey: fmt.Sprintf(tokenURLFormat, p.RemoteServiceProxyURL),
},
}

if cred != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/provision/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
productsURLFormat = "%s/products" // RemoteServiceProxyURL
verifyAPIKeyURLFormat = "%s/verifyApiKey" // RemoteServiceProxyURL
quotasURLFormat = "%s/quotas" // RemoteServiceProxyURL
tokenURLFormat = "%s/token" // RemoteServiceProxyURL
)

// default durations for the proxy verification retry
Expand Down
3 changes: 3 additions & 0 deletions cmd/samples/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var (
"istio-1.5": "istio-1.6",
"istio-1.6": "istio-1.6",
"istio-1.7": "istio-1.7",
"istio-1.8": "istio-1.7",
}
)

Expand All @@ -50,6 +51,7 @@ type samples struct {
templateDir string
outDir string
overwrite bool
JWTProviderKey string
RuntimeHost string
RuntimePort string
RuntimeTLS bool
Expand Down Expand Up @@ -218,6 +220,7 @@ func (s *samples) parseConfig() error {
s.Org = s.ServerConfig.Tenant.OrgName
s.Env = s.ServerConfig.Tenant.EnvName
s.Namespace = s.ServerConfig.Global.Namespace
s.JWTProviderKey = s.ServerConfig.Auth.JWTProviderKey

// handle configs for analytics-related credential
if s.ServerConfig.IsGCPManaged() {
Expand Down
1 change: 1 addition & 0 deletions cmd/samples/samples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func TestTemplatesListing(t *testing.T) {
" istio-1.5",
" istio-1.6",
" istio-1.7",
" istio-1.8",
" native",
}

Expand Down
2 changes: 1 addition & 1 deletion templates/envoy-1.16/envoy-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static_resources:
timeout: 5s
cache_duration:
seconds: 300
payload_in_metadata: apigee
payload_in_metadata: {{.JWTProviderKey}}
rules:
- match:
prefix: /
Expand Down
2 changes: 1 addition & 1 deletion templates/istio-1.6/request-authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
matchLabels:
managed-by: apigee
jwtRules:
- issuer: https://{{.RuntimeHost}}/remote-service/token
- issuer: {{.JWTProviderKey}}
jwksUri: https://{{.RuntimeHost}}/remote-service/certs
# ---
# apiVersion: security.istio.io/v1beta1
Expand Down
2 changes: 1 addition & 1 deletion templates/istio-1.7/request-authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
matchLabels:
managed-by: apigee
jwtRules:
- issuer: https://{{.RuntimeHost}}/remote-service/token
- issuer: {{.JWTProviderKey}}
jwksUri: https://{{.RuntimeHost}}/remote-service/certs
# ---
# apiVersion: security.istio.io/v1beta1
Expand Down
24 changes: 12 additions & 12 deletions templates/templates.go

Large diffs are not rendered by default.

0 comments on commit 4b1a5af

Please sign in to comment.