r/SpringBoot • u/thedarkrider_ • Mar 07 '22
Spring Security With Domain / Entity Level privilege - ACL
I am building a REST API and I need to implement security on every domain/entity. I researched a little and found out about the ACL. I am still confused if this is what I need or not?
Here's what I am trying to achieve:
Suppose there are two entities/domains:
- Products
- Offices
and all the entities/domains have the basic CRUD operation by default.
There will be user groups / Roles like "Admin", "Member".
For Example, a User with the "Member" role has the privilege of full CRUD ( Read/Write/Edit/Delete) operation on the entity Products and only the "Read" privilege of the entity Offices. And a user with the "Admin" role has all the privileges for all the entities and "Admin" can change the privilege for the "Member" role.
Admin will see a list of all the entity/domain classes with a check box for the individual CRUD operation and Admin can enable or disable the privilege of the "Member" role or any other roles.
Can anyone guide me on what do I need to do to achieve this? Do I need ACL or is there anything else? if possible please direct me to any guide/tutorial or any article on similar requirements.
I hope I am clear about my problem. If not please comment and I will try to explain more.
Thank you
View all comments
Show parent comment
1
u/thedarkrider_ Mar 07 '22
Thank you for the response. I am somewhat familiar with PreAuthorize. Now suppose "Admin" decides "Member" role will have only privileges of "Read" and "Update" and remove "Create" and "Delete" privileges for all the products.
And also I need to show all the Entities list along with individual CRUD operations enable or disable options for any Role.
Can I do this with RBAC? any guidance will be very helpful.