Richard Nemeth
3 years ago
5 changed files with 110 additions and 13 deletions
-
12src/keycloak/authorization/permission.py
-
20src/keycloak/authorization/policy.py
-
8tests/conftest.py
-
45tests/data/authz_settings.json
-
38tests/test_keycloak_openid.py
@ -0,0 +1,45 @@ |
|||||
|
{ |
||||
|
"allowRemoteResourceManagement": true, |
||||
|
"policyEnforcementMode": "ENFORCING", |
||||
|
"policies": [ |
||||
|
{ |
||||
|
"name": "Default Policy", |
||||
|
"type": "js", |
||||
|
"logic": "POSITIVE", |
||||
|
"decisionStrategy": "AFFIRMATIVE", |
||||
|
"config": { |
||||
|
"code": "// by default, grants any permission associated with this policy\n$evaluation.grant();\n" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"name": "test-authz-rb-policy", |
||||
|
"type": "role", |
||||
|
"logic": "POSITIVE", |
||||
|
"decisionStrategy": "UNANIMOUS", |
||||
|
"config": { |
||||
|
"roles": "[{\"id\":\"offline_access\",\"required\":false}]" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"name": "Default Permission", |
||||
|
"type": "resource", |
||||
|
"logic": "POSITIVE", |
||||
|
"decisionStrategy": "UNANIMOUS", |
||||
|
"config": { |
||||
|
"applyPolicies": "[\"test-authz-rb-policy\"]" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"name": "Test scope", |
||||
|
"type": "scope", |
||||
|
"logic": "POSITIVE", |
||||
|
"decisionStrategy": "UNANIMOUS", |
||||
|
"config": { |
||||
|
"scopes": "[]", |
||||
|
"applyPolicies": "[\"test-authz-rb-policy\"]" |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"scopes": [], |
||||
|
"decisionStrategy": "UNANIMOUS" |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue