Skip to content

Commit 97e5213

Browse files
committed
Added auth for stac browser.
1 parent d0bbe96 commit 97e5213

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Added support for annotations on the PgSTAC bootstrap job via `pgstacBootstrap.jobAnnotations` in values.yaml [#381](https://github.com/developmentseed/eoapi-k8s/pull/381)
13+
- Added auth support to STAC Browser [#376](https://github.com/developmentseed/eoapi-k8s/pull/376)
1314

1415
### Fixed
1516

charts/eoapi/templates/services/browser/deployment.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
app: {{ .Release.Name }}-browser
88
gitsha: {{ .Values.gitSha }}
99
spec:
10-
replicas: {{.Values.browser.replicaCount}}
10+
replicas: {{ .Values.browser.replicaCount }}
1111
selector:
1212
matchLabels:
1313
app: {{ .Release.Name }}-browser
@@ -23,5 +23,16 @@ spec:
2323
- containerPort: 8080
2424
env:
2525
- name: SB_catalogUrl
26-
value: "{{ .Values.stac.ingress.path }}"
26+
value: "http://{{ .Values.ingress.host }}{{ .Values.stac.ingress.path }}"
27+
{{- if index .Values "stac-auth-proxy" "enabled" }}
28+
- name: SB_authConfig
29+
value: |
30+
{
31+
"type": "openIdConnect",
32+
"openIdConnectUrl": "http://{{ .Values.ingress.host }}{{ .Values.mockOidcServer.ingress.path }}/.well-known/openid-configuration",
33+
"oidcOptions": {
34+
"client_id": "{{ .Values.browser.oidcClientId | default "test-client" }}"
35+
}
36+
}
37+
{{- end }}
2738
{{- end }}

charts/eoapi/tests/stac_browser_tests.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,61 @@ tests:
5151
- equal:
5252
path: metadata.annotations.annotation2
5353
value: world
54+
- it: "stac browser deployment with auth enabled"
55+
set:
56+
raster.enabled: false
57+
stac.enabled: true
58+
vector.enabled: false
59+
multidim.enabled: false
60+
browser.enabled: true
61+
stac-auth-proxy.enabled: true
62+
ingress.host: "localhost"
63+
stac.ingress.path: "/stac"
64+
mockOidcServer.ingress.path: "/mock-oidc"
65+
browser.oidcClientId: "test-client"
66+
gitSha: "ABC123"
67+
template: templates/services/browser/deployment.yaml
68+
asserts:
69+
- isKind:
70+
of: Deployment
71+
- contains:
72+
path: spec.template.spec.containers[0].env
73+
content:
74+
name: SB_catalogUrl
75+
value: "http://localhost/stac"
76+
- contains:
77+
path: spec.template.spec.containers[0].env
78+
content:
79+
name: SB_authConfig
80+
value: |
81+
{
82+
"type": "openIdConnect",
83+
"openIdConnectUrl": "http://localhost/mock-oidc/.well-known/openid-configuration",
84+
"oidcOptions": {
85+
"client_id": "test-client"
86+
}
87+
}
88+
- it: "stac browser deployment without auth"
89+
set:
90+
raster.enabled: false
91+
stac.enabled: true
92+
vector.enabled: false
93+
multidim.enabled: false
94+
browser.enabled: true
95+
stac-auth-proxy.enabled: false
96+
ingress.host: "localhost"
97+
stac.ingress.path: "/stac"
98+
gitSha: "ABC123"
99+
template: templates/services/browser/deployment.yaml
100+
asserts:
101+
- isKind:
102+
of: Deployment
103+
- contains:
104+
path: spec.template.spec.containers[0].env
105+
content:
106+
name: SB_catalogUrl
107+
value: "http://localhost/stac"
108+
- notContains:
109+
path: spec.template.spec.containers[0].env
110+
content:
111+
name: SB_authConfig

charts/eoapi/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,11 @@ stac:
415415
# STAC Auth Proxy - authentication layer for STAC API
416416
stac-auth-proxy:
417417
enabled: false
418+
image:
419+
tag: "v0.10.2-rc2"
418420
env:
421+
ROOT_PATH: "/stac"
422+
OVERRIDE_HOST: "false"
419423
DEFAULT_PUBLIC: "true"
420424
# UPSTREAM_URL will be set dynamically in template to point to stac service
421425
# OIDC_DISCOVERY_URL must be configured when enabling auth
@@ -492,6 +496,7 @@ browser:
492496
tag: 3.3.4
493497
ingress:
494498
enabled: true # Control ingress specifically for browser service
499+
oidcClientId: "some-client-id"
495500

496501
docServer:
497502
enabled: true

0 commit comments

Comments
 (0)