Hey,
in my roles.yaml file (usage of this file is configured in the property mgmtp.a12.uaa.authentication.user.access-rights-resource) I would like to be able to define a global permission for a role to be able to e.g. read all models. When I simply define a new role, I would expect everything to work out of the box, when I apply this new role to users:
roles.yaml
roles:
...
- name: applicant
description: applicant role
accessRights:
- DOCUMENT_READ
- DOCUMENT_WRITE
- MODEL_READ
The role gets applied to the user in my implementation of SamlAssertionExtractor:
extractAssertion() {
...
return ExtendedUser(...,listOf(SimpleGrantedAuthority("applicant")),...)
}
But it turns out not to be the case. The rule ‘User Right Model Read’ in the default authorizationDefinition.json prohibits this:
Checking permission [Model Load Permissions] in context[1079403850]
...Level 0 for expression containsAnyRole(#resource.objectRoles) && hasAccessRight('MODEL_READ') context[1079403850]
...Executed expression[containsAnyRole(#resource.objectRoles) && hasAccessRight('MODEL_READ')] => [false] in context[1079403850]
...Level 0 for expression (false) context[1079403850]
...Executed expression[(false)] => [false] in context[1079403850]
Permission [Model Load Permissions] result is [false] in context[1079403850]
Policies [User Right Model Read] in Permission {Model Load Permissions} have failed
I assumed hasAccessRight() checks the access rights in the roles.yaml, so I overwrote the main authorization definition to only check for hasAccessRight, but I still get an error:
Checking permission [Model Load Permissions] in context[2052741148]
...Level 0 for expression hasAccessRight('MODEL_READ') context[2052741148]
Missing property [accessRights] on object [org.springframework.security.core.authority.SimpleGrantedAuthority]
...Executed expression[hasAccessRight('MODEL_READ')] => [false] in context[2052741148]
...Level 0 for expression (false) context[2052741148]
...Executed expression[(false)] => [false] in context[2052741148]
Permission [Model Load Permissions] result is [false] in context[2052741148]
Where I am going wrong with this?