Skip to content

Commit ab48fbd

Browse files
xaijfaltermeier
andauthored
theia-cloud: Make OAuth2 Proxy's allowed redirect domains configurable (#89)
- Make whitelist_domains and cookie_domains configurable - Default is the previous behaviour: landing page and session host - Removes google.com from the default allowed redirects because there is no indication that this is necessary Fixes eclipse-theia/theia-cloud#357 Signed-off-by: Olaf Lessenich <[email protected]> Co-authored-by: Johannes Faltermeier <[email protected]>
1 parent a66683b commit ab48fbd

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

charts/theia-cloud/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.1.0-next.2
18+
version: 1.1.0-next.3
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/theia-cloud/templates/oauth2-configmap-oauth2proxy-keycloak.yaml

+20-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,29 @@ data:
3232
skip_provider_button="true"
3333
reverse_proxy="true"
3434
# email_domains=["*"]
35+
{{- $cookieDomains := .Values.oauth2Proxy.cookieDomains | default (list) }}
36+
{{- $whitelistDomains := .Values.oauth2Proxy.whitelistDomains | default (list) }}
3537
{{- if .Values.hosts.usePaths }}
38+
{{- if gt (len $cookieDomains) 0 }}
39+
cookie_domains={{ toJson $cookieDomains }}
40+
{{- else }}
3641
cookie_domains=["{{ tpl (.Values.hosts.configuration.baseHost | toString) . }}"]
37-
whitelist_domains=["{{ tpl (.Values.hosts.configuration.baseHost | toString) . }}:*","{{ $keycloakHost }}:*",".google.com:*"]
42+
{{- end }}
43+
{{- if gt (len $whitelistDomains) 0 }}
44+
whitelist_domains={{ toJson $whitelistDomains }}
45+
{{- else }}
46+
whitelist_domains=["{{ tpl (.Values.hosts.configuration.baseHost | toString) . }}:*","{{ $keycloakHost }}:*"]
47+
{{- end }}
3848
{{- else }}
49+
{{- if gt (len $cookieDomains) 0 }}
50+
cookie_domains={{ toJson $cookieDomains }}
51+
{{- else }}
3952
cookie_domains=["{{ tpl (.Values.hosts.configuration.instance | toString) . }}.{{ tpl (.Values.hosts.configuration.baseHost | toString) . }}"]
40-
whitelist_domains=["{{ tpl (.Values.hosts.configuration.instance | toString) . }}:*","{{ $keycloakHost }}:*",".google.com:*"]
53+
{{- end }}
54+
{{- if gt (len $whitelistDomains) 0 }}
55+
whitelist_domains={{ toJson $whitelistDomains }}
56+
{{- else }}
57+
whitelist_domains=["{{ tpl (.Values.hosts.configuration.instance | toString) . }}:*","{{ $keycloakHost }}:*"]
58+
{{- end }}
4159
{{- end }}
4260
custom_templates_dir="/templates"

charts/theia-cloud/values.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,20 @@ keycloak:
185185
# for how to generate a strong cookie secret.
186186
cookieSecret: "OQINaROshtE9TcZkNAm5Zs2Pv3xaWytBmc5W7sPX7ws="
187187

188+
# -- Values related to OAuth2 Proxy configuration
189+
oauth2Proxy:
190+
# Allowed redirect domains for OAuth2 Proxy (controls whitelist_domains).
191+
# When empty, defaults are used:
192+
# if hosts.usePaths: [ "<baseHost>:*", "<keycloak host>:*" ]
193+
# else: [ "<instance>:*", "<keycloak host>:*" ]
194+
whitelistDomains: []
195+
196+
# Cookie domains for OAuth2 Proxy.
197+
# When empty, defaults are used:
198+
# if hosts.usePaths: [ "<baseHost>" ]
199+
# else: [ "<instance>.<baseHost>" ]
200+
cookieDomains: []
201+
188202
# -- Values related to the operator
189203
# @default -- (see details below)
190204
operator:

0 commit comments

Comments
 (0)