File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
resources/fixtures/issue69 Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1212
1313public class OpaTest {
1414 static Path wasmFile ;
15+ static Path issue69WasmFile ;
1516
1617 @ BeforeAll
1718 public static void beforeAll () throws Exception {
1819 wasmFile = OpaCli .compile ("base" , "opa/wasm/test/allowed" ).resolve ("policy.wasm" );
20+ issue69WasmFile = OpaCli .compile ("issue69" , "authz/allow" ).resolve ("policy.wasm" );
1921 }
2022
2123 @ Test
@@ -92,4 +94,16 @@ public void highLevelAPI() throws Exception {
9294 policy .input ("{\" user\" : \" alice\" }" );
9395 Assertions .assertFalse (Utils .getResult (policy .evaluate ()).asBoolean ());
9496 }
97+
98+ @ Test
99+ public void issue69 () throws Exception {
100+ var policy = OpaPolicy .builder ().withPolicy (issue69WasmFile ).build ();
101+ policy .data ("" );
102+
103+ policy .input ("{\" method\" :\" GET\" }" );
104+ Assertions .assertTrue (Utils .getResult (policy .evaluate ()).asBoolean ());
105+
106+ policy .input ("{\" method\" :\" POST\" }" );
107+ Assertions .assertFalse (Utils .getResult (policy .evaluate ()).asBoolean ());
108+ }
95109}
Original file line number Diff line number Diff line change 1+ package authz
2+
3+ import rego.v1
4+
5+ default allow := false
6+
7+ allow if {
8+ input.method == " GET"
9+ }
You can’t perform that action at this time.
0 commit comments