Add Basic Authentication to a service or a route with username and password protection. The plugin checks for valid credentials in the Proxy-Authorization
and Authorization
headers (in that order).
To proxy requests, you need an upstream application to send a request to. Deploying hashicorp/vault service:
kubectl apply -f vault-deployment.yml
kubectl apply -f vault-service.yml
kubectl apply -f kong-gateway.yml
kubectl apply -f user-basic-auth-secret.yml
Username is: mohammad
, Password is: lets-learn-kong-ingress
kubectl apply -f kong-plugin.yml
kubectl apply -f kong-consumer.yml
There is a field named credentials
in kong-consumer.yml
which refer to the secret that we created
kubectl apply -f vault-http-route.yml
- If you type
curl https://vault.isc -k
, You'll receiveUnauthorized
message - If you type
curl https://vault.isc -k -u mohammad:SOMETHINGWRONG
, You'll receiveInvalid authentication credentials
message - If you type
curl https://vault.isc -k -u mohammad:lets-learn-kong-ingress
, It shows that you authorized successfully