Skip to content

Commit

Permalink
add path checking
Browse files Browse the repository at this point in the history
  • Loading branch information
wistefan committed Jan 21, 2025
1 parent 4349325 commit bf6e176
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/resources/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
}
},
"operator": {
"http": {
"isInPath": {
"regoPackage": "http.operator as http_operator",
"regoMethod": "http_operator.is_in_path_operator(%s,%s)"
}
},
"odrl": {
"eq": {
"regoPackage": "odrl.operator as odrl_operator",
Expand Down Expand Up @@ -136,6 +142,12 @@
}
},
"leftOperand": {
"http": {
"path": {
"regoPackage": "http.leftOperand as http_lo",
"regoMethod": "http_lo.path(helper.http_part)"
}
},
"vc": {
"role": {
"regoPackage": "vc.leftOperand as vc_lo",
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/rego/http/leftOperand.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package http.leftOperand

import rego.v1

## http:path
# returns the currently requested path
path(http_part) := http_part.path
7 changes: 7 additions & 0 deletions src/main/resources/rego/http/operator.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package http.operator

import rego.v1

## http:isInPath
# check that left operand is in the path of the right operand
is_in_path_operator(leftOperand, rightOperand) if startswith(leftOperand, rightOperand)

0 comments on commit bf6e176

Please sign in to comment.