Skip to content

Commit

Permalink
fix: missing headers set by oauth2_proxy (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeyheath authored Sep 13, 2024
1 parent c619a7e commit 36e1444
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,5 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- define "oidcProxy.nginxAuthAnnotations" -}}
nginx.ingress.kubernetes.io/auth-url: "http://{{ include "oidcProxy.name" . }}.{{ .Release.Namespace }}.svc.cluster.local:4180/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://{{- include "oidcProxy.authDomain" . }}/oauth2/start?rd=https://$host$escaped_request_uri"
nginx.ingress.kubernetes.io/auth-response-headers: Authorization
nginx.ingress.kubernetes.io/auth-response-headers: {{join "," (concat (list "Authorization" "X-Forwarded-Email") .Values.global.oidcProxy.additionalHeaders) }}
{{- end -}}
23 changes: 22 additions & 1 deletion stack/tests/ingress_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,25 @@ tests:
- documentIndex: 0
equal:
path: metadata.annotations["nginx.ingress.kubernetes.io/auth-response-headers"]
value: "Authorization"
value: "Authorization,X-Forwarded-Email"
- it: adds additional nginx auth headers when using additionalHeaders
set:
global:
ingress:
host: "stack.play.dev.czi.team"
oidcProxy:
enabled: true
additionalHeaders:
- X-Forwarded-User
- blahblahblah
services:
service1:
ingress:
oidcProtected: true
asserts:
- isKind:
of: Ingress
- documentIndex: 0
equal:
path: metadata.annotations["nginx.ingress.kubernetes.io/auth-response-headers"]
value: "Authorization,X-Forwarded-Email,X-Forwarded-User,blahblahblah"
1 change: 1 addition & 0 deletions stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ global:
tag: v7.6.0
replicaCount: 2
additionalSecrets: []
additionalHeaders: []
extraArgs: []
# extraArgs:
# - --flag
Expand Down

0 comments on commit 36e1444

Please sign in to comment.