Skip to content

Commit

Permalink
Forward X-Auth-Request-Id-Token header in oauth (#1126)
Browse files Browse the repository at this point in the history
* forward X-Auth-Request-Id-Token header in oauth
* Use appscode/oauth2_proxy:2.3.0
* Delete dockerfiles for appscode/oauth2_proxy
  • Loading branch information
diptadas authored and tamalsaha committed Jun 20, 2018
1 parent 01c20d0 commit b11f9f8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docs/guides/ingress/security/oauth-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
- name: OAUTH2_PROXY_CLIENT_SECRET
value: ...
- OAUTH2_PROXY_COOKIE_SECRET = ...
image: appscode/oauth2_proxy:2.2.0
image: appscode/oauth2_proxy:2.3.0
imagePullPolicy: Always
name: oauth2-proxy
ports:
Expand Down
7 changes: 4 additions & 3 deletions docs/guides/ingress/security/oauth-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
- --upstream=file:///dev/null
- --http-address=0.0.0.0:4180
- --cookie-secure=false
- --pass-id-token=true
- --set-xauthrequest=true
env:
- name: OAUTH2_PROXY_CLIENT_ID
Expand All @@ -67,7 +68,7 @@ spec:
value: ...
- name: OAUTH2_PROXY_COOKIE_SECRET
value: ...
image: appscode/oauth2_proxy:2.2.0
image: appscode/oauth2_proxy:2.3.0
imagePullPolicy: Always
name: oauth2-proxy
ports:
Expand All @@ -90,7 +91,7 @@ spec:
k8s-app: oauth2-proxy
```
Here, `--set-xauthrequest` flag sets `X-Auth-Request-User` and `X-Auth-Request-User` headers, which will be forwarded to backend.
Here, `--set-xauthrequest` flag sets `X-Auth-Request-User` and `X-Auth-Request-Email` headers, which will be forwarded to backend. It also sets `X-Auth-Request-Id-Token` header when `--pass-id-token` flag is `true`.

Finally create the ingress:

Expand Down Expand Up @@ -193,7 +194,7 @@ spec:
- name: OAUTH2_PROXY_CLIENT_SECRET
value: ...
- OAUTH2_PROXY_COOKIE_SECRET = ...
image: appscode/oauth2_proxy:2.2.0
image: appscode/oauth2_proxy:2.3.0
imagePullPolicy: Always
name: oauth2-proxy
ports:
Expand Down
7 changes: 4 additions & 3 deletions docs/guides/ingress/security/oauth-google.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
- --upstream=file:///dev/null
- --http-address=0.0.0.0:4180
- --cookie-secure=false
- --pass-id-token=true
- --set-xauthrequest=true
env:
- name: OAUTH2_PROXY_CLIENT_ID
Expand All @@ -67,7 +68,7 @@ spec:
value: ...
- name: OAUTH2_PROXY_COOKIE_SECRET
value: ...
image: appscode/oauth2_proxy:2.2.0
image: appscode/oauth2_proxy:2.3.0
imagePullPolicy: Always
name: oauth2-proxy
ports:
Expand All @@ -90,7 +91,7 @@ spec:
k8s-app: oauth2-proxy
```
Here, `--set-xauthrequest` flag sets `X-Auth-Request-User` and `X-Auth-Request-User` headers, which will be forwarded to backend.
Here, `--set-xauthrequest` flag sets `X-Auth-Request-User` and `X-Auth-Request-Email` headers, which will be forwarded to backend. It also sets `X-Auth-Request-Id-Token` header when `--pass-id-token` flag is `true`.

Finally create the ingress:

Expand Down Expand Up @@ -193,7 +194,7 @@ spec:
- name: OAUTH2_PROXY_CLIENT_SECRET
value: ...
- OAUTH2_PROXY_COOKIE_SECRET = ...
image: appscode/oauth2_proxy:2.2.0
image: appscode/oauth2_proxy:2.3.0
imagePullPolicy: Always
name: oauth2-proxy
ports:
Expand Down
8 changes: 0 additions & 8 deletions hack/docker/oauth2-proxy/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions hack/docker/oauth2-proxy/build.sh

This file was deleted.

1 change: 1 addition & 0 deletions hack/docker/voyager/templates/http-frontend.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ frontend {{ .FrontendName }}
http-request redirect location {{ $host.ExternalAuth.SigninPath }}?rd=%[path] if acl_{{ $host.Host | acl_name }} ! acl_{{ $host.Host | acl_name }}_auth_backend_path acl_{{ $host.Host | acl_name }}_secure_paths ! { var(txn.auth_response_successful) -m bool }
http-request set-header X-Auth-Request-Email %[var(txn.auth_response_email)] if acl_{{ $host.Host | acl_name }} ! acl_{{ $host.Host | acl_name }}_auth_backend_path acl_{{ $host.Host | acl_name }}_secure_paths { var(txn.auth_response_email) -m found }
http-request set-header X-Auth-Request-User %[var(txn.auth_response_user)] if acl_{{ $host.Host | acl_name }} ! acl_{{ $host.Host | acl_name }}_auth_backend_path acl_{{ $host.Host | acl_name }}_secure_paths { var(txn.auth_response_user) -m found }
http-request set-header X-Auth-Request-Id-Token %[var(txn.auth_response_id_token)] if acl_{{ $host.Host | acl_name }} ! acl_{{ $host.Host | acl_name }}_auth_backend_path acl_{{ $host.Host | acl_name }}_secure_paths { var(txn.auth_response_id_token) -m found }
{{ end }}

{{ range $path := $host.Paths }}
Expand Down

0 comments on commit b11f9f8

Please sign in to comment.