Spring Boot Security: One user with multiple roles which has multiple permissions

874 Views Asked by At

Good day.

I am working on Spring Boot Security. I am stuck with a problem, and can't figure out how to implement UserDetails to grant authorities of a user with multiple roles, and each roles have different set of permissions.

For Example: Let's say Mr. Keanu Reeves has two roles with different set of permissions.

ID ----- ROLES ----------------- PERMISSIONS
1 ------ ROLE_JOHNWICK------ LOVE, SURVIVE, KILL
2 ------ ROLE_NEO------------- LOVE, SURVIVE

How can I grant authorities in UserDetails, so that Mr. Keanu Reeves can perform his role ROLE_JOHNWICK with permissions like LOVE, SURVIVE, KILL in one section, and in separate section he should perform LOVE, SURVIVE with the role ROLE_NEO.

Thanks in advance for your help.

0

There are 0 best solutions below