Skip to content

Commit eaf8ed9

Browse files
committed
Removed stac-auth-proxy charts patch.
1 parent fd4f359 commit eaf8ed9

File tree

9 files changed

+41
-162
lines changed

9 files changed

+41
-162
lines changed

charts/eoapi/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ dependencies:
7878
repository: https://grafana.github.io/helm-charts
7979
condition: observability.grafana.enabled
8080
- name: stac-auth-proxy
81-
version: "0.1.0"
81+
version: "0.1.1"
8282
repository: "oci://ghcr.io/developmentseed/stac-auth-proxy/charts"
8383
condition: stac-auth-proxy.enabled

charts/eoapi/templates/core/stac-auth-proxy-patch-rbac.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.

charts/eoapi/templates/core/stac-auth-proxy-patch.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

charts/eoapi/templates/mock-oidc/ingress.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

charts/eoapi/templates/networking/ingress.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ spec:
7878
number: {{ $.Values.service.port }}
7979
{{- end }}
8080

81+
{{- if and $.Values.mockOidcServer.enabled $.Values.mockOidcServer.ingress.enabled }}
82+
- pathType: {{ if eq $.Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
83+
path: {{ $.Values.mockOidcServer.ingress.path }}{{ if eq $.Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
84+
backend:
85+
service:
86+
name: {{ $.Release.Name }}-mock-oidc-server
87+
port:
88+
number: {{ $.Values.mockOidcServer.service.port | default 8080 }}
89+
{{- end }}
90+
8191
{{- if $.Values.docServer.enabled }}
8292
- pathType: Prefix
8393
path: "/{{ $.Values.ingress.rootPath | default "" }}"
@@ -138,6 +148,16 @@ spec:
138148
number: {{ .Values.service.port }}
139149
{{- end }}
140150

151+
{{- if and .Values.mockOidcServer.enabled .Values.mockOidcServer.ingress.enabled }}
152+
- pathType: {{ if eq .Values.ingress.className "nginx" }}ImplementationSpecific{{ else }}Prefix{{ end }}
153+
path: {{ .Values.mockOidcServer.ingress.path }}{{ if eq .Values.ingress.className "nginx" }}(/|$)(.*){{ end }}
154+
backend:
155+
service:
156+
name: {{ .Release.Name }}-mock-oidc-server
157+
port:
158+
number: {{ .Values.mockOidcServer.service.port | default 8080 }}
159+
{{- end }}
160+
141161
{{- if .Values.docServer.enabled }}
142162
- pathType: Prefix
143163
path: "/{{ $.Values.ingress.rootPath | default "" }}"

charts/eoapi/templates/networking/traefik-middleware.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ spec:
1919
{{- if .Values.multidim.enabled }}
2020
- {{ .Values.multidim.ingress.path }}
2121
{{- end }}
22+
{{- if and .Values.mockOidcServer.enabled .Values.mockOidcServer.ingress.enabled }}
23+
- {{ .Values.mockOidcServer.ingress.path }}
24+
{{- end }}
2225
{{- end }}

tests/conftest.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_mock_token(mock_oidc_endpoint: Optional[str] = None) -> str:
3737
)
3838

3939
response = requests.post(
40-
mock_oidc_endpoint,
40+
f"{mock_oidc_endpoint}/",
4141
data={
4242
"username": "test-user",
4343
"scopes": "openid profile stac:read stac:write",
@@ -47,9 +47,16 @@ def get_mock_token(mock_oidc_endpoint: Optional[str] = None) -> str:
4747

4848
if response.status_code == 200:
4949
html = response.text
50-
if 'value="' in html:
51-
token = html.split('value="')[1].split('"')[0]
52-
return f"Bearer {token}"
50+
# Extract token from textarea element
51+
if "<textarea" in html and ">" in html:
52+
# Find the textarea content between > and </textarea>
53+
start_marker = html.find("<textarea")
54+
if start_marker != -1:
55+
content_start = html.find(">", start_marker) + 1
56+
content_end = html.find("</textarea>", content_start)
57+
if content_start != -1 and content_end != -1:
58+
token = html[content_start:content_end].strip()
59+
return f"Bearer {token}"
5360

5461
raise Exception(
5562
f"Could not get token from mock OIDC server at {mock_oidc_endpoint}"

tests/integration/test_stac_auth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test STAC API with auth proxy authentication."""
22

33
import os
4+
import time
45

56
import httpx
67
import pytest
@@ -24,7 +25,7 @@ def test_stac_auth_without_token(stac_endpoint: str) -> None:
2425
f"{stac_endpoint}/collections/noaa-emergency-response/items",
2526
headers={"Content-Type": "application/json"},
2627
json={
27-
"id": "test-no-token",
28+
"id": f"test-no-token-{int(time.time() * 1000)}",
2829
"type": "Feature",
2930
"stac_version": "1.0.0",
3031
"properties": {"datetime": "2024-01-01T00:00:00Z"},
@@ -52,7 +53,7 @@ def test_stac_auth_with_invalid_token(stac_endpoint: str) -> None:
5253
"Content-Type": "application/json",
5354
},
5455
json={
55-
"id": "test-invalid-token",
56+
"id": f"test-invalid-token-{int(time.time() * 1000)}",
5657
"type": "Feature",
5758
"stac_version": "1.0.0",
5859
"properties": {"datetime": "2024-01-01T00:00:00Z"},
@@ -80,7 +81,7 @@ def test_stac_auth_with_valid_token(
8081
"Content-Type": "application/json",
8182
},
8283
json={
83-
"id": "test-valid-token",
84+
"id": f"test-valid-token-{int(time.time() * 1000)}",
8485
"type": "Feature",
8586
"stac_version": "1.0.0",
8687
"properties": {"datetime": "2024-01-01T00:00:00Z"},

tests/notification/test_pgstac_notifications.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -239,31 +239,17 @@ def test_update_notification(
239239

240240
before_time = time.time()
241241

242-
updated_item["properties"]["description"] = "Updated for notification test"
243-
244-
response = requests.put(
245-
f"{stac_client['base_url']}/collections/noaa-emergency-response/items/{test_item['id']}",
246-
json=updated_item,
247-
headers=stac_client["headers"],
248-
timeout=stac_client["timeout"],
249-
)
250-
251-
assert response.status_code in [200, 201], (
252-
f"Failed to create item: {response.text}"
253-
)
254-
242+
test_item["properties"]["description"] = "Updated for notification test"
255243
test_item["properties"]["test_version"] = "v2"
256244

257-
before_time = time.time()
258-
259245
response = requests.put(
260246
f"{stac_client['base_url']}/collections/noaa-emergency-response/items/{test_item_id}",
261247
json=test_item,
262248
headers=stac_client["headers"],
263249
timeout=stac_client["timeout"],
264250
)
265251

266-
assert response.status_code in [200, 204], (
252+
assert response.status_code in [200, 201], (
267253
f"Failed to update item: {response.text}"
268254
)
269255

@@ -317,18 +303,6 @@ def test_delete_notification(
317303

318304
before_time = time.time()
319305

320-
response = requests.delete(
321-
f"{stac_client['base_url']}/collections/noaa-emergency-response/items/{test_item['id']}",
322-
headers=stac_client["headers"],
323-
timeout=stac_client["timeout"],
324-
)
325-
326-
assert response.status_code in [200, 201], (
327-
f"Failed to create item: {response.text}"
328-
)
329-
330-
before_time = time.time()
331-
332306
response = requests.delete(
333307
f"{stac_client['base_url']}/collections/noaa-emergency-response/items/{test_item_id}",
334308
headers=stac_client["headers"],

0 commit comments

Comments
 (0)