We have a SpringBoot based module, we have REST APIs which allow creating resources with Params like
Request
POST /resources
{
"resourceName": "Res1",
"admins": ["john.doe@company.com", "jane.doe@company.com"]
}
Response
{
"id": "R1"
"resourceName": "Res1",
"admins": ["john.doe@company.com", "jane.doe@company.com"]
}
Request
POST /resources
{
"resourceName": "Res2",
"admins": ["alice@company.com", "bob@company.com"]
}
Response
{
"id": "R2"
"resourceName": "Res2",
"admins": ["alice@company.com", "bob@company.com"]
}
For R1
update API should only be accesible by John/Jane
Request
PUT /resources/R1
{
"resourceName": "Resource1",
"admins": ["john.doe@company.com", "jane.doe@company.com", "jacob@company.com"]
}
Response
For John / Jane the response should be:
{
"id": "R1"
"resourceName": "Resource1",
"admins": ["john.doe@company.com", "jane.doe@company.com", "jacob@company.com"]
}
When Alice / Bob user are updating R1
this response should be 403 Forbidden
Similarly For R2
update API should only be accesible by Alice / Bob.
When John / Jane are updating R2
this response should be 403 Forbidden
Please suggest which framework can be used to achieve this, preferably with less boiler plate
Currently we have a system where resource access is in for of RoleBasedAccessControl. We achieve restriction by storing permissions. The RBAC config is saved in DB.
But now we need more fine grained control per resource which can be managed directly by existing admins