Skip to content

Commit 8e9baf0

Browse files
committed
In progress
1 parent 60ac08f commit 8e9baf0

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

examples/opa/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/developmentseed/stac-auth-proxy:latest
1+
FROM ghcr.io/developmentseed/stac-auth-proxy:0.1.2
22

33
ADD . /opa
44

examples/opa/docker-compose.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ services:
22
proxy:
33
depends_on:
44
- stac
5+
- opa
56
build:
67
context: examples/opa
78
environment:
@@ -17,3 +18,13 @@ services:
1718
- "8000:8000"
1819
volumes:
1920
- ./src:/app/src
21+
22+
opa:
23+
image: openpolicyagent/opa:latest
24+
command: "run --server --addr=:8181 --watch /policies"
25+
ports:
26+
- "8181:8181"
27+
volumes:
28+
- ./examples/opa/policies:/policies
29+
depends_on:
30+
- stac

examples/opa/policies/example.rego

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package example
2+
3+
# Helper function to check if user is authenticated
4+
is_authenticated if {
5+
input.payload != null
6+
}
7+
8+
# Return the list of permitted collections
9+
collections = ["naip"] if {
10+
input.payload != null
11+
} else = [] if {
12+
true
13+
}
14+
15+
# Allow access to collections list - authenticated users see their permitted collections
16+
allow if {
17+
input.method == "GET"
18+
input.path = ["collections"]
19+
}

0 commit comments

Comments
 (0)