Skip to content

Commit

Permalink
use tls config from BTP to fetch oidc provider endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Huabing Zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Dec 9, 2024
1 parent 8cba958 commit d9dc4eb
Show file tree
Hide file tree
Showing 9 changed files with 262 additions and 24 deletions.
2 changes: 1 addition & 1 deletion internal/crypto/cert_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func LoadTLSConfig(tlsCrt, tlsKey, caCrt string) (*tls.Config, error) {
return &tls.Config{
Certificates: []tls.Certificate{cert},
NextProtos: []string{"h2"},
ClientAuth: tls.RequireAndVerifyClientCert,
ClientAuth: tls.RequireAndVerifyClientCert ,
ClientCAs: certPool,
MinVersion: tls.VersionTLS13,
}, nil
Expand Down
55 changes: 46 additions & 9 deletions internal/gatewayapi/securitypolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package gatewayapi

import (
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -672,13 +674,28 @@ func (t *Translator) buildOIDCProvider(policy *egv1a1.SecurityPolicy, resources
protocol ir.AppProtocol
rd *ir.RouteDestination
traffic *ir.TrafficFeatures
providerTLS *ir.TLSUpstreamConfig
err error
)
if len(provider.BackendRefs) > 0 {
if rd, err = t.translateExtServiceBackendRefs(policy, provider.BackendRefs, protocol, resources, envoyProxy, "oidc", 0); err != nil {
return nil, err
}
}

if rd != nil {
for _, st := range rd.Settings {
if st.TLS != nil {
providerTLS = st.TLS
break
}
}
}

// Discover the token and authorization endpoints from the issuer's
// well-known url if not explicitly specified
if provider.TokenEndpoint == nil || provider.AuthorizationEndpoint == nil {
tokenEndpoint, authorizationEndpoint, err = fetchEndpointsFromIssuer(provider.Issuer)
tokenEndpoint, authorizationEndpoint, err = fetchEndpointsFromIssuer(provider.Issuer, providerTLS)
if err != nil {
return nil, fmt.Errorf("error fetching endpoints from issuer: %w", err)
}
Expand All @@ -702,12 +719,6 @@ func (t *Translator) buildOIDCProvider(policy *egv1a1.SecurityPolicy, resources
protocol = ir.HTTP

Check failure on line 719 in internal/gatewayapi/securitypolicy.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to protocol (ineffassign)
}

if len(provider.BackendRefs) > 0 {
if rd, err = t.translateExtServiceBackendRefs(policy, provider.BackendRefs, protocol, resources, envoyProxy, "oidc", 0); err != nil {
return nil, err
}
}

if traffic, err = translateTrafficFeatures(provider.BackendSettings); err != nil {
return nil, err
}
Expand Down Expand Up @@ -764,9 +775,35 @@ type OpenIDConfig struct {
AuthorizationEndpoint string `json:"authorization_endpoint"`
}

func fetchEndpointsFromIssuer(issuerURL string) (string, string, error) {
func fetchEndpointsFromIssuer(issuerURL string, providerTLS *ir.TLSUpstreamConfig) (string, string, error) {
var tlsConfig *tls.Config

if providerTLS != nil {
tlsConfig := &tls.Config{

Check failure on line 782 in internal/gatewayapi/securitypolicy.go

View workflow job for this annotation

GitHub Actions / lint

G402: TLS MinVersion too low. (gosec)
ServerName: providerTLS.SNI,

Check failure on line 783 in internal/gatewayapi/securitypolicy.go

View workflow job for this annotation

GitHub Actions / lint

unusedwrite: unused write to field ServerName (govet)
}
if providerTLS.CACertificate != nil {
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(providerTLS.CACertificate.Certificate)
tlsConfig.RootCAs = caCertPool

Check failure on line 788 in internal/gatewayapi/securitypolicy.go

View workflow job for this annotation

GitHub Actions / lint

unusedwrite: unused write to field RootCAs (govet)
}
for _, cert := range providerTLS.ClientCertificates {
cert, err := tls.X509KeyPair(cert.Certificate, cert.PrivateKey)
if err != nil {
return "", "", err
}
tlsConfig.Certificates = append(tlsConfig.Certificates, cert)
}
}

// Fetch the OpenID configuration from the issuer URL
resp, err := http.Get(fmt.Sprintf("%s/.well-known/openid-configuration", issuerURL))
client := &http.Client{}
if tlsConfig != nil {

Check failure on line 801 in internal/gatewayapi/securitypolicy.go

View workflow job for this annotation

GitHub Actions / lint

nilness: impossible condition: nil != nil (govet)
client.Transport = &http.Transport{
TLSClientConfig: tlsConfig,
}
}
resp, err := client.Get(fmt.Sprintf("%s/.well-known/openid-configuration", issuerURL))
if err != nil {
return "", "", err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,47 @@ securityPolicies:
defaultTokenTTL: 30m
refreshToken: true
defaultRefreshTokenTTL: 24h
configMaps:
- apiVersion: v1

Check failure on line 103 in internal/gatewayapi/testdata/securitypolicy-with-oidc-backendcluster.in.yaml

View workflow job for this annotation

GitHub Actions / lint

103:3 [indentation] wrong indentation: expected 0 but found 2
kind: ConfigMap
metadata:
name: ca-cmap
namespace: envoy-gateway
data:
ca.crt: |
-----BEGIN CERTIFICATE-----
MIIDJzCCAg+gAwIBAgIUAl6UKIuKmzte81cllz5PfdN2IlIwDQYJKoZIhvcNAQEL
BQAwIzEQMA4GA1UEAwwHbXljaWVudDEPMA0GA1UECgwGa3ViZWRiMB4XDTIzMTAw
MjA1NDE1N1oXDTI0MTAwMTA1NDE1N1owIzEQMA4GA1UEAwwHbXljaWVudDEPMA0G
A1UECgwGa3ViZWRiMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwSTc
1yj8HW62nynkFbXo4VXKv2jC0PM7dPVky87FweZcTKLoWQVPQE2p2kLDK6OEszmM
yyr+xxWtyiveremrWqnKkNTYhLfYPhgQkczib7eUalmFjUbhWdLvHakbEgCodn3b
kz57mInX2VpiDOKg4kyHfiuXWpiBqrCx0KNLpxo3DEQcFcsQTeTHzh4752GV04RU
Ti/GEWyzIsl4Rg7tGtAwmcIPgUNUfY2Q390FGqdH4ahn+mw/6aFbW31W63d9YJVq
ioyOVcaMIpM5B/c7Qc8SuhCI1YGhUyg4cRHLEw5VtikioyE3X04kna3jQAj54YbR
bpEhc35apKLB21HOUQIDAQABo1MwUTAdBgNVHQ4EFgQUyvl0VI5vJVSuYFXu7B48
6PbMEAowHwYDVR0jBBgwFoAUyvl0VI5vJVSuYFXu7B486PbMEAowDwYDVR0TAQH/
BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAMLxrgFVMuNRq2wAwcBt7SnNR5Cfz
2MvXq5EUmuawIUi9kaYjwdViDREGSjk7JW17vl576HjDkdfRwi4E28SydRInZf6J
i8HZcZ7caH6DxR335fgHVzLi5NiTce/OjNBQzQ2MJXVDd8DBmG5fyatJiOJQ4bWE
A7FlP0RdP3CO3GWE0M5iXOB2m1qWkE2eyO4UHvwTqNQLdrdAXgDQlbam9e4BG3Gg
d/6thAkWDbt/QNT+EJHDCvhDRKh1RuGHyg+Y+/nebTWWrFWsktRrbOoHCZiCpXI1
3eXE6nt0YkgtDxG22KqnhpAg9gUSs2hlhoxyvkzyF0mu6NhPlwAgnq7+/Q==
-----END CERTIFICATE-----
backendTLSPolicies:
- apiVersion: gateway.networking.k8s.io/v1alpha2

Check failure on line 130 in internal/gatewayapi/testdata/securitypolicy-with-oidc-backendcluster.in.yaml

View workflow job for this annotation

GitHub Actions / lint

130:3 [indentation] wrong indentation: expected 0 but found 2
kind: BackendTLSPolicy
metadata:
name: policy-btls-backend-fqdn
namespace: envoy-gateway
spec:
targetRefs:
- group: gateway.envoyproxy.io
kind: Backend
name: backend-fqdn
validation:
caCertificateRefs:
- name: ca-cmap
group: ''
kind: ConfigMap
hostname: oauth.foo.com
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
backendTLSPolicies:
- apiVersion: gateway.networking.k8s.io/v1alpha2
kind: BackendTLSPolicy
metadata:
creationTimestamp: null
name: policy-btls-backend-fqdn
namespace: envoy-gateway
spec:
targetRefs:
- group: gateway.envoyproxy.io
kind: Backend
name: backend-fqdn
validation:
caCertificateRefs:
- group: ""
kind: ConfigMap
name: ca-cmap
hostname: oauth.foo.com
status:
ancestors:
- ancestorRef:
group: gateway.envoyproxy.io
kind: SecurityPolicy
name: policy-for-gateway
namespace: envoy-gateway
conditions:
- lastTransitionTime: null
message: Policy has been accepted.
reason: Accepted
status: "True"
type: Accepted
controllerName: gateway.envoyproxy.io/gatewayclass-controller
backends:
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: Backend
Expand Down Expand Up @@ -235,6 +267,12 @@ xdsIR:
- host: oauth.foo.com
port: 443
protocol: HTTPS
tls:
alpnProtocols: null
caCertificate:
certificate: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURKekNDQWcrZ0F3SUJBZ0lVQWw2VUtJdUttenRlODFjbGx6NVBmZE4ySWxJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHQTFVRUNnd0dhM1ZpWldSaU1CNFhEVEl6TVRBdwpNakExTkRFMU4xb1hEVEkwTVRBd01UQTFOREUxTjFvd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHCkExVUVDZ3dHYTNWaVpXUmlNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXdTVGMKMXlqOEhXNjJueW5rRmJYbzRWWEt2MmpDMFBNN2RQVmt5ODdGd2VaY1RLTG9XUVZQUUUycDJrTERLNk9Fc3ptTQp5eXIreHhXdHlpdmVyZW1yV3FuS2tOVFloTGZZUGhnUWtjemliN2VVYWxtRmpVYmhXZEx2SGFrYkVnQ29kbjNiCmt6NTdtSW5YMlZwaURPS2c0a3lIZml1WFdwaUJxckN4MEtOTHB4bzNERVFjRmNzUVRlVEh6aDQ3NTJHVjA0UlUKVGkvR0VXeXpJc2w0Umc3dEd0QXdtY0lQZ1VOVWZZMlEzOTBGR3FkSDRhaG4rbXcvNmFGYlczMVc2M2Q5WUpWcQppb3lPVmNhTUlwTTVCL2M3UWM4U3VoQ0kxWUdoVXlnNGNSSExFdzVWdGlraW95RTNYMDRrbmEzalFBajU0WWJSCmJwRWhjMzVhcEtMQjIxSE9VUUlEQVFBQm8xTXdVVEFkQmdOVkhRNEVGZ1FVeXZsMFZJNXZKVlN1WUZYdTdCNDgKNlBiTUVBb3dId1lEVlIwakJCZ3dGb0FVeXZsMFZJNXZKVlN1WUZYdTdCNDg2UGJNRUFvd0R3WURWUjBUQVFILwpCQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFNTHhyZ0ZWTXVOUnEyd0F3Y0J0N1NuTlI1Q2Z6CjJNdlhxNUVVbXVhd0lVaTlrYVlqd2RWaURSRUdTams3SlcxN3ZsNTc2SGpEa2RmUndpNEUyOFN5ZFJJblpmNkoKaThIWmNaN2NhSDZEeFIzMzVmZ0hWekxpNU5pVGNlL09qTkJRelEyTUpYVkRkOERCbUc1ZnlhdEppT0pRNGJXRQpBN0ZsUDBSZFAzQ08zR1dFME01aVhPQjJtMXFXa0UyZXlPNFVIdndUcU5RTGRyZEFYZ0RRbGJhbTllNEJHM0dnCmQvNnRoQWtXRGJ0L1FOVCtFSkhEQ3ZoRFJLaDFSdUdIeWcrWSsvbmViVFdXckZXc2t0UnJiT29IQ1ppQ3BYSTEKM2VYRTZudDBZa2d0RHhHMjJLcW5ocEFnOWdVU3MyaGxob3h5dmt6eUYwbXU2TmhQbHdBZ25xNysvUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
name: policy-btls-backend-fqdn/envoy-gateway-ca
sni: oauth.foo.com
weight: 1
tokenEndpoint: https://oauth.foo.com/token
traffic:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ http:
port: 443
protocol: HTTPS
weight: 1
tls:
alpnProtocols: null
caCertificate:
certificate: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURKekNDQWcrZ0F3SUJBZ0lVQWw2VUtJdUttenRlODFjbGx6NVBmZE4ySWxJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0l6RVFNQTRHQTFVRUF3d0hiWGxqYVdWdWRERVBNQTBHQTFVRUNnd0dhM1ZpWldSaU1CNFhEVEl6TVRBdwp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UDBSZFAzQ08zR1dFME01aVhPQjJtMXFXa0UyZXlPNFVIdndUcU5RTGRyZEFYZ0RRbGJhbTllNEJHM0dnCmQvNnRoQWtXRGJ0L1FOVCtFSkhEQ3ZoRFJLaDFSdUdIeWcrWSsvbmViVFdXckZXc2t0UnJiT29IQ1ppQ3BYSTEKM2VYRTZudDBZa2d0RHhHMjJLcW5ocEFnOWdVU3MyaGxob3h5dmt6eUYwbXU2TmhQbHdBZ25xNysvUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
name: policy-btls-backend-fqdn/envoy-gateway-ca
sni: oauth.foo.com
tokenEndpoint: https://oauth.foo.com/token
traffic:
retry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,36 @@
address: oauth.foo.com
portValue: 443
loadBalancingWeight: 1
metadata:
filterMetadata:
envoy.transport_socket_match:
name: securitypolicy/envoy-gateway/policy-for-gateway/0/tls/0
loadBalancingWeight: 1
locality:
region: securitypolicy/envoy-gateway/policy-for-gateway/0/backend/0
name: securitypolicy/envoy-gateway/policy-for-gateway/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
respectDnsTtl: true
transportSocketMatches:
- match:
name: securitypolicy/envoy-gateway/policy-for-gateway/0/tls/0
name: securitypolicy/envoy-gateway/policy-for-gateway/0/tls/0
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
commonTlsContext:
combinedValidationContext:
defaultValidationContext:
matchTypedSubjectAltNames:
- matcher:
exact: oauth.foo.com
sanType: DNS
validationContextSdsSecretConfig:
name: policy-btls-backend-fqdn/envoy-gateway-ca
sdsConfig:
ads: {}
resourceApiVersion: V3
sni: oauth.foo.com
type: STRICT_DNS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
- name: policy-btls-backend-fqdn/envoy-gateway-ca
validationContext:
trustedCa:
inlineBytes: LS0tLS1CRUdJTiBDRVJUSUZJQ0F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q2Z6CjJNdlhxNUVVbXVhd0lVaTlrYVlqd2RWaURSRUdTams3SlcxN3ZsNTc2SGpEa2RmUndpNEUyOFN5ZFJJblpmNkoKaThIWmNaN2NhSDZEeFIzMzVmZ0hWekxpNU5pVGNlL09qTkJRelEyTUpYVkRkOERCbUc1ZnlhdEppT0pRNGJXRQpBN0ZsUDBSZFAzQ08zR1dFME01aVhPQjJtMXFXa0UyZXlPNFVIdndUcU5RTGRyZEFYZ0RRbGJhbTllNEJHM0dnCmQvNnRoQWtXRGJ0L1FOVCtFSkhEQ3ZoRFJLaDFSdUdIeWcrWSsvbmViVFdXckZXc2t0UnJiT29IQ1ppQ3BYSTEKM2VYRTZudDBZa2d0RHhHMjJLcW5ocEFnOWdVU3MyaGxob3h5dmt6eUYwbXU2TmhQbHdBZ25xNysvUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
- genericSecret:
secret:
inlineBytes: Y2xpZW50MTpzZWNyZXQK
Expand Down
58 changes: 49 additions & 9 deletions test/e2e/testdata/oidc-keycloak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ spec:
ports:
- port: 80
targetPort: 8080
name: http-keycloak
name: http
protocol: TCP
selector:
app: keycloak
---
apiVersion: v1
kind: ServiceAccount
kind: Service
metadata:
name: keycloak
name: keycloak-https
namespace: gateway-conformance-infra
labels:
app: keycloak
spec:
type: LoadBalancer
ports:
- port: 443
targetPort: 8443
name: https
protocol: TCP
selector:
app: keycloak
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -40,27 +49,57 @@ spec:
app: keycloak
version: v1
spec:
serviceAccountName: keycloak
containers:
- name: keycloak
image: quay.io/keycloak/keycloak:26.0.4
imagePullPolicy: IfNotPresent
args:
- "start-dev"
ports:
- name: keycloak
- name: http
containerPort: 8080
protocol: TCP
- name: https
containerPort: 8443
protocol: TCP
env:
- name: KEYCLOAK_ADMIN
- name: KC_BOOTSTRAP_ADMIN_USERNAME
value: admin
- name: KEYCLOAK_ADMIN_PASSWORD
- name: KC_BOOTSTRAP_ADMIN_PASSWORD
value: admin
- name: KC_HOSTNAME
value: "keycloak.gateway-conformance-infra"
- name: KC_HTTPS_CERTIFICATE_FILE
value: "/etc/tls/tls.crt"
- name: KC_HTTPS_CERTIFICATE_KEY_FILE
value: "/etc/tls/tls.key"
- name: KC_HTTP_PORT
value: "8080"
- name: KC_HTTPS_PORT
value: "8443"
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 5
tcpSocket:
port: 8080
volumeMounts:
- name: tls-volume
mountPath: /etc/tls
readOnly: true
volumes:
- name: tls-volume
secret:
secretName: keycloak-tls
---
apiVersion: v1
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4VENDQWRrQ0FRQXdEUVlKS29aSWh2Y05BUUVMQlFBd0xURVZNQk1HQTFVRUNnd01aWGhoYlhCc1pTQkoKYm1NdU1SUXdFZ1lEVlFRRERBdGxlR0Z0Y0d4bExtTnZiVEFlRncweU5ERXlNRGt3TnpVd05EbGFGdzB5TlRFeQpNRGt3TnpVd05EbGFNRkF4THpBdEJnTlZCQU1NSm10bGVXTnNiMkZyTFhSc2N5NW5ZWFJsZDJGNUxXTnZibVp2CmNtMWhibU5sTFdsdVpuSmhNUjB3R3dZRFZRUUtEQlJsZUdGdGNHeGxJRzl5WjJGdWFYcGhkR2x2YmpDQ0FTSXcKRFFZSktvWklodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUtvbGNsMlNWa3pIRlRhZjNXMUxWclJ3UkhQQwpVQWJBU0hHUmE3cVNUNng4RDl6TDVnOFhZbG5HdmZodWs5YVlQWHlOc1JTNlovb3NtNmxTVEdOQ2xqNkJoaC9tCjB0YTQ0ODBmcGtpNlBvUThkT1N0Z25lbWs3OUxySnZXM21zMll1TUpaVFNKdDdYS3l5M0NydXBMb3VGSFd6cWsKMVJOQWtFa3N3SmFwSjFSaXlWY0JOZ1dpakZmRnRSWEFEWElHUC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2lsCnFFRDlvM2FDVytYR2FJblEvcmNIMkhlTHZQajRTRkYvSGp0a2h3U0w4SGV5bUhLV2hyN0tZczcxNnMrbXRvM2IKSlUzcC93cXlrMWZOMURkdVdjRkpISGRrR21FdmN5OEFjMm5sLzNsUmRqRzNQeVFDK0lQYlVkNjlscS9NejV5OApsbjNxbjZwQWJ3S0JnRXB4b25kK3pMUzNPN2tWemtIVXJPWDlnSFN3Q01YaFQwNGo1WER6T3R0MFdSRkoyek5NCk4vWlRaelp6WFNwS0dXT09RWWEzUUhCY0xRKys0S0FBVE94K0w5dVNZUEYwNlhrR2N1T09LQTMxallPZzd6VFIKb0JKaUlXc0dtZjVWemhtT2FVRDZvbWgwKzlaaDhMdTgrVzg2WGUwTGxPL0ZrdEpPTmtWSUlwY1hBb0dBSlVIcgpHK2FjUUlEZmRWVUgydFJlTzlxSTh6RUFhOGQ3MVAzTjF1THdDV0tQSWxMZHZXTTZNT1E2ZWQ2ZHdIcFpRcWRYCmRsbG5iUkRvTE9zbU5vc2JYQklrU0VGbkJDZGZ0SW9Kb1pRbm8zV3J5M0g5aUFOdmJjT3Nkb3JNY3V3OEY2SGMKR0hJaXhURjFGNVVGNjFWU200WC9mc0o5dVlROERrRDdUM0pySUI4Q2dZRUFuWGI2TzJSWjZzYU51eGxhbldISApUdDA3UDFRUEl6WUQrUzdKVUN3Y0RvZEVZQVBuYUVpNk5aTWg2bnI4a2Y2VDdjdUFDVkFiY1RLZjcwY2c4VkxaCmwyMEhSa2VFSk9oRmQ5dHJ2N1oyc2IvYUxyL3ZqYVg2Ymt6N1l4NlkvV2IyckVxdktiQ0dRN241UU9XWXJ1akoKT092Qm4xcENqemVkYlJlalVSVzFabVE9Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
kind: Secret
metadata:
name: keycloak-tls
namespace: gateway-conformance-infra
type: kubernetes.io/tls
---
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -106,7 +145,8 @@ data:
PASSWORD=oidcpassword # This is the user password that will be used for user authentication in Authorization Code Flow
CLIENT_ID=oidctest
CLIENT_SECRET=oidctest-client-secret
REDIRECT_URL=http://www.example.com/myapp/oauth2/callback
HTTP_REDIRECT_URL=http://www.example.com/myapp/oauth2/callback
HTTPS_REDIRECT_URL=https://www.example.com/myapp/oauth2/callback
set -ex
Expand All @@ -129,7 +169,7 @@ data:
/opt/keycloak/bin/kcreg.sh create \
-s clientId="${CLIENT_ID}" \
-s secret="${CLIENT_SECRET}" \
-s "redirectUris=[\"${REDIRECT_URL}\"]" \
-s "redirectUris=[\"${HTTP_REDIRECT_URL}\", \"${HTTPS_REDIRECT_URL}\"]" \
-s consentRequired=false \
--server "${KEYCLOAK_SERVER}" \
--realm "${REALM}" \
Expand Down
Loading

0 comments on commit d9dc4eb

Please sign in to comment.