add support for auth-snippet annotation
add test for new auth-snippet annotation document auth-snippet annotation add e2e test for auth-snippet annotation add log warning and update documentation
This commit is contained in:
parent
38f5df26cb
commit
b511333130
5 changed files with 80 additions and 11 deletions
|
|
@ -25,7 +25,6 @@ import (
|
|||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/parnurzeal/gorequest"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
|
@ -234,6 +233,41 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
|||
Expect(resp.StatusCode).Should(Equal(http.StatusInternalServerError))
|
||||
})
|
||||
|
||||
It(`should set snippet "proxy_set_header My-Custom-Header 42;" when external auth is configured`, 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-snippet": `
|
||||
proxy_set_header My-Custom-Header 42;`,
|
||||
}
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 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 not set snippet "proxy_set_header My-Custom-Header 42;" when external auth is not configured`, func() {
|
||||
host := "auth"
|
||||
|
||||
annotations := map[string]string{
|
||||
"nginx.ingress.kubernetes.io/auth-snippet": `
|
||||
proxy_set_header My-Custom-Header 42;`,
|
||||
}
|
||||
|
||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
||||
f.EnsureIngress(ing)
|
||||
|
||||
f.WaitForNginxServer(host,
|
||||
func(server string) bool {
|
||||
return Expect(server).ShouldNot(ContainSubstring(`proxy_set_header My-Custom-Header 42;`))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when external authentication is configured", func() {
|
||||
host := "auth"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue