I use scopes with attributes as described here. Do you know how to implement the security configuration in a spring boot app to achieve that only the corresponding data regarding the scope attribute will be served.
I think there are two approaches you can use to accomplish this result depending on your concrete requirements. However, first of all there is no such thing like a parametrized scope with XSUAA.
It is possible to model additional attributes into the role templates of XSUAA, for example, a Country
attribute like this in xs-security.json
"attributes": [
{
"name" : "Country",
"description" : "Country parameter for the Role",
"valueType" : "string"
}],
"role-templates": [
{
"name": "BusinessPartnerViewer",
"description": "Role to view business addresses",
"scope-references" : [
"$XSAPPNAME.ViewAddresses"
],
"attribute-references": [
"Country"
]
}
Then you need to recreate your XSUAA instance in CloudFoundry with cf create-service xsuaa application <serviceinstance> -c xs-security.json
. Note: You cannot update the binding when you had other role template definitions previously.
Based on this, a subscriber of the application may instantiate roles at runtime providing an attribute along with the OAuth scope.
This approach has the downside that the consumer of the application may have to create many roles depending on the possible permutations of scopes and attributes.