mirror of
https://github.com/alibaba/higress.git
synced 2026-05-25 21:28:17 +08:00
feat: add key-auth plugin (#586)
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
This commit is contained in:
62
plugins/wasm-go/extensions/key-auth/keyauth.yaml
Normal file
62
plugins/wasm-go/extensions/key-auth/keyauth.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
apiVersion: networking.higress.io/v1
|
||||
kind: McpBridge
|
||||
metadata:
|
||||
name: mcp-keyauth-httpbin
|
||||
namespace: higress-system
|
||||
spec:
|
||||
registries:
|
||||
- domain: httpbin.org
|
||||
name: httpbin
|
||||
port: 80
|
||||
type: dns
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
higress.io/destination: httpbin.dns
|
||||
higress.io/upstream-vhost: "httpbin.org"
|
||||
higress.io/backend-protocol: HTTP
|
||||
name: ingress-keyauth-httpbin
|
||||
namespace: higress-system
|
||||
spec:
|
||||
ingressClassName: higress
|
||||
rules:
|
||||
- host: httpbin.example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
resource:
|
||||
apiGroup: networking.higress.io
|
||||
kind: McpBridge
|
||||
name: mcp-keyauth-httpbin
|
||||
path: /
|
||||
pathType: Prefix
|
||||
---
|
||||
apiVersion: extensions.higress.io/v1alpha1
|
||||
kind: WasmPlugin
|
||||
metadata:
|
||||
name: wasm-keyauth-httpbin
|
||||
namespace: higress-system
|
||||
spec:
|
||||
defaultConfig:
|
||||
consumers:
|
||||
- credential: 2bda943c-ba2b-11ec-ba07-00163e1250b5
|
||||
name: consumer1
|
||||
- credential: c8c8e9ca-558e-4a2d-bb62-e700dcc40e35
|
||||
name: consumer2
|
||||
global_auth: false
|
||||
keys:
|
||||
- x-api-key
|
||||
- apikey
|
||||
in_header: true
|
||||
defaultConfigDisable: false
|
||||
matchRules:
|
||||
- config:
|
||||
allow:
|
||||
- consumer1
|
||||
configDisable: false
|
||||
ingress:
|
||||
- ingress-keyauth-httpbin
|
||||
url: oci://docker.io/dongjiang1989/keyauth:1.0.0
|
||||
imagePullPolicy: Always
|
||||
Reference in New Issue
Block a user