Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new policy in authorization to support powerflex Pre-approved g… #170

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion operatorconfig/moduleconfig/authorization/v1.6.0/policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ data:
"GET /api/instances/StoragePool::[a-f0-9]+/relationships/Statistics/",
"POST /api/instances/Volume::[a-f0-9]+/action/addMappedSdc/",
"POST /api/instances/Volume::[a-f0-9]+/action/removeMappedSdc/",
"POST /api/instances/Volume::[a-f0-9]+/action/removeVolume/"
"POST /api/instances/Volume::[a-f0-9]+/action/removeVolume/",
"POST /api/instances/Sdc::[a-f0-9]+/action/setSdcName/",
"POST /api/instances/System::[a-f0-9]/action/approveSdc/"
]

default allow = true
Expand Down Expand Up @@ -343,6 +345,40 @@ data:
msg := sprintf("no role data found", [])
}

default claims = {}
claims = input.claims
deny[msg] {
claims == {}
msg := sprintf("missing claims", [])
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: sdc-approve
namespace: <NAMESPACE>
data:
sdc-approve.rego: |
package karavi.sdc.approve

import data.karavi.common

# Allow requests by default.
default allow = true

default response = {
"allowed": true
}
response = {
"allowed": false,
"status": {
"reason": reason,
},
} {
reason = concat(", ", deny)
reason != ""
}

default claims = {}
claims = input.claims
deny[msg] {
Expand Down