forked from envoyproxy/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basic auth impl (envoyproxy#2224)
* basic auth impl Signed-off-by: huabing zhao <zhaohuabing@gmail.com> add referenced secrets to resource Signed-off-by: huabing zhao <zhaohuabing@gmail.com> change string to []byte Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * e2e test Signed-off-by: huabing zhao <zhaohuabing@gmail.com> --------- Signed-off-by: huabing zhao <zhaohuabing@gmail.com>
- Loading branch information
1 parent
77656f8
commit f4f45be
Showing
24 changed files
with
1,023 additions
and
119 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
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
58 changes: 58 additions & 0 deletions
58
internal/gatewayapi/testdata/securitypolicy-with-basic-auth.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,58 @@ | ||
secrets: | ||
- apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
namespace: default | ||
name: users-secret | ||
data: | ||
.htpasswd: "dXNlcjE6e1NIQX10RVNzQm1FL3lOWTNsYjZhMEw2dlZRRVpOcXc9CnVzZXIyOntTSEF9RUo5TFBGRFhzTjl5blNtYnh2anA3NUJtbHg4PQo=" | ||
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 | ||
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-1 | ||
sectionName: http | ||
rules: | ||
- matches: | ||
- path: | ||
value: "/foo" | ||
backendRefs: | ||
- name: service-1 | ||
port: 8080 | ||
securityPolicies: | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
namespace: default | ||
name: policy-for-http-route | ||
spec: | ||
targetRef: | ||
group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: httproute-1 | ||
namespace: default | ||
basicAuth: | ||
users: | ||
name: "users-secret" |
152 changes: 152 additions & 0 deletions
152
internal/gatewayapi/testdata/securitypolicy-with-basic-auth.out.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,152 @@ | ||
gateways: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
creationTimestamp: null | ||
name: gateway-1 | ||
namespace: envoy-gateway | ||
spec: | ||
gatewayClassName: envoy-gateway-class | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: All | ||
name: http | ||
port: 80 | ||
protocol: HTTP | ||
status: | ||
listeners: | ||
- attachedRoutes: 1 | ||
conditions: | ||
- lastTransitionTime: null | ||
message: Sending translated listener configuration to the data plane | ||
reason: Programmed | ||
status: "True" | ||
type: Programmed | ||
- lastTransitionTime: null | ||
message: Listener has been successfully translated | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- lastTransitionTime: null | ||
message: Listener references have been resolved | ||
reason: ResolvedRefs | ||
status: "True" | ||
type: ResolvedRefs | ||
name: http | ||
supportedKinds: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
- group: gateway.networking.k8s.io | ||
kind: GRPCRoute | ||
httpRoutes: | ||
- apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
creationTimestamp: null | ||
name: httproute-1 | ||
namespace: default | ||
spec: | ||
hostnames: | ||
- gateway.envoyproxy.io | ||
parentRefs: | ||
- name: gateway-1 | ||
namespace: envoy-gateway | ||
sectionName: http | ||
rules: | ||
- backendRefs: | ||
- name: service-1 | ||
port: 8080 | ||
matches: | ||
- path: | ||
value: /foo | ||
status: | ||
parents: | ||
- conditions: | ||
- lastTransitionTime: null | ||
message: Route is accepted | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
- lastTransitionTime: null | ||
message: Resolved all the Object references for the Route | ||
reason: ResolvedRefs | ||
status: "True" | ||
type: ResolvedRefs | ||
controllerName: gateway.envoyproxy.io/gatewayclass-controller | ||
parentRef: | ||
name: gateway-1 | ||
namespace: envoy-gateway | ||
sectionName: http | ||
infraIR: | ||
envoy-gateway/gateway-1: | ||
proxy: | ||
listeners: | ||
- address: "" | ||
ports: | ||
- containerPort: 10080 | ||
name: http | ||
protocol: HTTP | ||
servicePort: 80 | ||
metadata: | ||
labels: | ||
gateway.envoyproxy.io/owning-gateway-name: gateway-1 | ||
gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
name: envoy-gateway/gateway-1 | ||
securityPolicies: | ||
- apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
creationTimestamp: null | ||
name: policy-for-http-route | ||
namespace: default | ||
spec: | ||
basicAuth: | ||
users: | ||
group: null | ||
kind: null | ||
name: users-secret | ||
targetRef: | ||
group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: httproute-1 | ||
namespace: default | ||
status: | ||
conditions: | ||
- lastTransitionTime: null | ||
message: SecurityPolicy has been accepted. | ||
reason: Accepted | ||
status: "True" | ||
type: Accepted | ||
xdsIR: | ||
envoy-gateway/gateway-1: | ||
accessLog: | ||
text: | ||
- path: /dev/stdout | ||
http: | ||
- address: 0.0.0.0 | ||
hostnames: | ||
- '*' | ||
isHTTP2: false | ||
name: envoy-gateway/gateway-1/http | ||
port: 10080 | ||
routes: | ||
- backendWeights: | ||
invalid: 0 | ||
valid: 0 | ||
basicAuth: | ||
users: dXNlcjE6e1NIQX10RVNzQm1FL3lOWTNsYjZhMEw2dlZRRVpOcXc9CnVzZXIyOntTSEF9RUo5TFBGRFhzTjl5blNtYnh2anA3NUJtbHg4PQo= | ||
destination: | ||
name: httproute/default/httproute-1/rule/0 | ||
settings: | ||
- endpoints: | ||
- host: 7.7.7.7 | ||
port: 8080 | ||
protocol: HTTP | ||
weight: 1 | ||
hostname: gateway.envoyproxy.io | ||
name: httproute/default/httproute-1/rule/0/match/0/gateway_envoyproxy_io | ||
pathMatch: | ||
distinct: false | ||
name: "" | ||
prefix: /foo |
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
Oops, something went wrong.