Add support for configmap of headers to be sent to external auth service
This commit is contained in:
parent
cb2889b87b
commit
786a3b6862
10 changed files with 186 additions and 27 deletions
|
|
@ -141,6 +141,7 @@ var (
|
|||
"buildAuthLocation": buildAuthLocation,
|
||||
"shouldApplyGlobalAuth": shouldApplyGlobalAuth,
|
||||
"buildAuthResponseHeaders": buildAuthResponseHeaders,
|
||||
"buildAuthProxySetHeaders": buildAuthProxySetHeaders,
|
||||
"buildProxyPass": buildProxyPass,
|
||||
"filterRateLimits": filterRateLimits,
|
||||
"buildRateLimitZones": buildRateLimitZones,
|
||||
|
|
@ -463,6 +464,19 @@ func buildAuthResponseHeaders(headers []string) []string {
|
|||
return res
|
||||
}
|
||||
|
||||
func buildAuthProxySetHeaders(headers map[string]string) []string {
|
||||
res := []string{}
|
||||
|
||||
if len(headers) == 0 {
|
||||
return res
|
||||
}
|
||||
|
||||
for name, value := range headers {
|
||||
res = append(res, fmt.Sprintf("proxy_set_header '%v' '%v';", name, value))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// buildProxyPass produces the proxy pass string, if the ingress has redirects
|
||||
// (specified through the nginx.ingress.kubernetes.io/rewrite-target annotation)
|
||||
// If the annotation nginx.ingress.kubernetes.io/add-base-url:"true" is specified it will
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue