-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Huabing Zhao <[email protected]>
- Loading branch information
1 parent
b65eb93
commit 0f7096f
Showing
3 changed files
with
289 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: remote-jwks-server-secret | ||
namespace: gateway-conformance-infra | ||
type: kubernetes.io/tls | ||
data: | ||
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURmekNDQW1lZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREJETVNBd0hnWURWUVFLREJkeVpXMXYKZEdVdGFuZHJjeTF6WlhKMlpYSWdTVzVqTGpFZk1CMEdBMVVFQXd3V2NtVnRiM1JsTFdwM2EzTXRjMlZ5ZG1WeQpMbU52YlRBZUZ3MHlOVEF4TURjd056UXhNamxhRncwek5UQXhNRFV3TnpReE1qbGFNRHd4R3pBWkJnTlZCQU1NCkVuSmxiVzkwWlMxcWQydHpMWE5sY25abGNqRWRNQnNHQTFVRUNnd1VaWGhoYlhCc1pTQnZjbWRoYm1sNllYUnAKYjI0d2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUM5STk4bjZwMmZNYTZwRkRPTgpneDFzNkMvUmI2SU1leGZBQTR5T1VkL0EvaU1mN0haRGMzR3Q4T29oYmhQY0F5MmF0QS9mbEJ2Z1RNdHNJZ2JMCjVGUXFvQ1U1bW92OStMYW41dGp4bCttUnY4RzVqSFltWklYS29yMTg2Ly8yOFdXWVp4Rm53ZGlRMlR3SGIzSzYKaUROOWllVysrck5LOUVWVW54R2dRdEN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WtneSs2a1lzTExUT2NXOGxHMHlyRXZ0WVA5Ujk0aStqaCtzd3NPUEUvb0FsMG9EbklldE1WUmpQaXYKWEVJRWNrSUdMbHhQTmtwZmNBMEp2UU09Ci0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: remote-jwks-server-ca | ||
namespace: gateway-conformance-infra | ||
data: | ||
ca.crt: | | ||
-----BEGIN CERTIFICATE----- | ||
MIIDZzCCAk+gAwIBAgIUdKqpVkYMQWraGhwBrL26NPO2ocYwDQYJKoZIhvcNAQEL | ||
BQAwQzEgMB4GA1UECgwXcmVtb3RlLWp3a3Mtc2VydmVyIEluYy4xHzAdBgNVBAMM | ||
FnJlbW90ZS1qd2tzLXNlcnZlci5jb20wHhcNMjUwMTA3MDc0MTI5WhcNMzUwMTA1 | ||
MDc0MTI5WjBDMSAwHgYDVQQKDBdyZW1vdGUtandrcy1zZXJ2ZXIgSW5jLjEfMB0G | ||
A1UEAwwWcmVtb3RlLWp3a3Mtc2VydmVyLmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD | ||
ggEPADCCAQoCggEBAMA7NXKfnnEthULdenoA+AJzSRuPZaiHyrwGqVGm8gEKJ02U | ||
8IIj5ztcurooBtuDZQvuKRjMFOFPGuG3UGdzR+rRQ7Wenp9qy0E7C0q6WXxS9B/W | ||
mGJ/JcttZO0JvNTWm1fByKrvM4OmokFkEKQX7pnwQyRV2gkckOuAwyWUsD1eHp/b | ||
/ke4uZB0M9M1Ll+TBw8l1qG7GclcjOE41kW2Y1S6h5umGBn/g2SqN47sWj4G0ork | ||
No4JICik4FXO3h1UBnnEgbsgHplnyT3i9OZydfgToOEXjW+w8EE8JwRVNpIiYLTE | ||
lwrq7FhrhvnVZ+hQ9u0Pu+8p9CmdA91dKuqGq8kCAwEAAaNTMFEwHQYDVR0OBBYE | ||
FGZ0tY2IEVa+V7PnarTHsRuAOpFZMB8GA1UdIwQYMBaAFGZ0tY2IEVa+V7PnarTH | ||
sRuAOpFZMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAB3aGMrx | ||
7aAmUEuEcYibbUbMYKXis94hh2rOqREZDTWsH91JAdqfDpoIkjjgpTusK67Jgr7z | ||
YV1v2f5qFMSoRHd7aKJr5zsBpl616kdya4a3hv7iqBypldXekNo8zteJHjC9ryyZ | ||
znDcuxPKGkib2Nitck/rWhq+T1ncKTz2QU1oI/EqUwPe4IBThdMnHIPxa4EvABv0 | ||
d1EPZUtZdOr8/fet4Z4KF9zIHrJiBwApw6AFs6x84XyRKCQwpwMZdxDNWa/tZ7A3 | ||
x82ma7q4/PV/IuP+wOJx1B1JNO1vqlM/STbQf0JFw1/C7KHLDQjZGMV53Fcrj4J8 | ||
POACnSGEb+8C9Sw= | ||
-----END CERTIFICATE----- | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: remote-jwks-server | ||
namespace: gateway-conformance-infra | ||
spec: | ||
selector: | ||
app: remote-jwks-server | ||
ports: | ||
- protocol: TCP | ||
port: 443 | ||
targetPort: 8443 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: remote-jwks-server | ||
namespace: gateway-conformance-infra | ||
labels: | ||
app: remote-jwks-server | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: remote-jwks-server | ||
template: | ||
metadata: | ||
labels: | ||
app: remote-jwks-server | ||
spec: | ||
containers: | ||
- name: remote-jwks-server | ||
image: envoyproxy/gateway-static-file-server | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- --port=8443 | ||
- --certPath=/etc/certs | ||
volumeMounts: | ||
- name: remote-jwks-server-secret | ||
mountPath: /etc/certs | ||
volumes: | ||
- name: remote-jwks-server-secret | ||
secret: | ||
secretName: remote-jwks-server-secret | ||
items: | ||
- key: tls.crt | ||
path: server.crt | ||
- key: tls.key | ||
path: server.key | ||
--- | ||
apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: Backend | ||
metadata: | ||
name: remote-jwks | ||
namespace: gateway-conformance-infra | ||
spec: | ||
endpoints: | ||
- fqdn: | ||
hostname: 'remote-jwks-server' | ||
port: 443 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1alpha3 | ||
kind: BackendTLSPolicy | ||
metadata: | ||
name: remote-jwks-btls | ||
namespace: gateway-conformance-infra | ||
spec: | ||
targetRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: Backend | ||
name: remote-jwks | ||
sectionName: 443 | ||
validation: | ||
caCertificateRefs: | ||
- name: remote-jwks-server-ca | ||
group: '' | ||
kind: ConfigMap | ||
hostname: remote-jwks-server | ||
--- | ||
apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
name: jwt-example | ||
namespace: gateway-conformance-infra | ||
spec: | ||
targetRef: | ||
group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: jwt-claim-routing | ||
jwt: | ||
providers: | ||
- name: example | ||
recomputeRoute: true | ||
claimToHeaders: | ||
- claim: sub | ||
header: x-sub | ||
- claim: admin | ||
header: x-admin | ||
- claim: name | ||
header: x-name | ||
remoteJWKS: | ||
backendRefs: | ||
- group: gateway.envoyproxy.io | ||
kind: Backend | ||
name: remote-jwks | ||
port: 443 | ||
backendSettings: | ||
retry: | ||
numRetries: 3 | ||
perRetry: | ||
backOff: | ||
baseInterval: 1s | ||
maxInterval: 5s | ||
retryOn: | ||
triggers: ["5xx", "gateway-error", "reset"] | ||
uri: https://remote-jwks-server/jwt/jwks.json | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: jwt-claim-routing | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: same-namespace | ||
rules: | ||
- backendRefs: | ||
- kind: Service | ||
name: infra-backend-v1 | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- headers: | ||
- name: x-name | ||
value: John Doe | ||
- backendRefs: | ||
- kind: Service | ||
name: infra-backend-v2 | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- headers: | ||
- name: x-name | ||
value: Tom | ||
# catch all | ||
- backendRefs: | ||
- kind: Service | ||
name: infra-backend-invalid | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
//go:build e2e | ||
|
||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
) | ||
|
||
func init() { | ||
ConformanceTests = append(ConformanceTests, JWTBackendRemoteJWKSTest) | ||
} | ||
|
||
var JWTBackendRemoteJWKSTest = suite.ConformanceTest{ | ||
ShortName: "JWTBackendRemoteJWKS", | ||
Description: "JWT with Backend as remote JWKS", | ||
Manifests: []string{"testdata/jwt-backend-remote-jwks.yaml"}, | ||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { | ||
t.Run("jwt claim base routing", func(t *testing.T) { | ||
testClaimBasedRouting(t, suite) | ||
}) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters