Add support for configmap of headers to be sent to external auth service

This commit is contained in:
A Gardner 2019-09-24 10:53:23 -04:00
parent cb2889b87b
commit 786a3b6862
10 changed files with 186 additions and 27 deletions

View file

@ -291,6 +291,27 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
})
})
It(`should set "proxy_set_header 'My-Custom-Header' '42';" when auth-headers are set`, func() {
host := "auth"
annotations := map[string]string{
"nginx.ingress.kubernetes.io/auth-url": "http://foo.bar/basic-auth/user/password",
"nginx.ingress.kubernetes.io/auth-proxy-set-headers": f.Namespace + "/auth-headers",
}
f.CreateConfigMap("auth-headers", map[string]string{
"My-Custom-Header": "42",
})
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring(`proxy_set_header 'My-Custom-Header' '42';`))
})
})
It(`should set cache_key when external auth cache is configured`, func() {
host := "auth"