-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for optional JWT authentication
Signed-off-by: Ardika Bagus <me@ardikabs.com>
- Loading branch information
Showing
14 changed files
with
836 additions
and
111 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
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
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
127 changes: 127 additions & 0 deletions
127
internal/gatewayapi/testdata/securitypolicy-with-jwt-optional.in.yaml
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,127 @@ | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
namespace: envoy-gateway | ||
name: gateway-1 | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
allowedRoutes: | ||
namespaces: | ||
from: All | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
namespace: envoy-gateway | ||
name: gateway-2 | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- name: http | ||
protocol: HTTP | ||
port: 80 | ||
allowedRoutes: | ||
namespaces: | ||
from: All | ||
grpcRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: GRPCRoute | ||
metadata: | ||
namespace: default | ||
name: grpcroute-1 | ||
spec: | ||
parentRefs: | ||
- namespace: envoy-gateway | ||
name: gateway-1 | ||
sectionName: http | ||
rules: | ||
- backendRefs: | ||
- name: service-1 | ||
port: 8080 | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
namespace: default | ||
name: httproute-1 | ||
spec: | ||
hostnames: | ||
- gateway.envoyproxy.io | ||
parentRefs: | ||
- namespace: envoy-gateway | ||
name: gateway-2 | ||
sectionName: http | ||
rules: | ||
- matches: | ||
- path: | ||
value: "/" | ||
backendRefs: | ||
- name: service-1 | ||
port: 8080 | ||
securityPolicies: | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
namespace: envoy-gateway | ||
name: policy-for-gateway | ||
spec: | ||
targetRef: | ||
group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: gateway-1 | ||
namespace: envoy-gateway | ||
jwt: | ||
providers: | ||
- name: example1 | ||
issuer: https://one.example.com | ||
audiences: | ||
- one.foo.com | ||
remoteJWKS: | ||
uri: https://one.example.com/jwt/public-key/jwks.json | ||
claimToHeaders: | ||
- header: one-route-example-key | ||
claim: claim1 | ||
- name: example2 | ||
issuer: https://two.example.com | ||
audiences: | ||
- two.foo.com | ||
remoteJWKS: | ||
uri: https://two.example.com/jwt/public-key/jwks.json | ||
claimToHeaders: | ||
- header: two-route-example-key | ||
claim: claim2 | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
namespace: default | ||
name: policy-for-route | ||
spec: | ||
targetRef: | ||
group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: httproute-1 | ||
namespace: default | ||
jwt: | ||
providers: | ||
- name: example3 | ||
issuer: https://three.example.com | ||
audiences: | ||
- three.foo.com | ||
remoteJWKS: | ||
uri: https://three.example.com/jwt/public-key/jwks.json | ||
claimToHeaders: | ||
- header: three-route-example-key | ||
claim: claim3 | ||
extractFrom: | ||
headers: | ||
- name: Authorization | ||
valuePrefix: 'Bearer ' | ||
cookies: | ||
- session_access_token | ||
params: | ||
- token | ||
allowMissing: true |
Oops, something went wrong.