I am new to the Keycloak framework and after writing my own solution painfully we are hoping to convert to KeyCloak. It seems to be a promising solution but unfortunately lacking self describing documentation. I have gone through the tutorials and the terminology, however, I can not seem to mold a suitable model for my authorization use case through Keycloak concepts. I posted my question! in Keycloak mailing list without any response so I decided to reach out here.
Please consider this use scenario:
- You provide a SaaS solution for Car Dealerships.
- Every dealership inherits a set of default roles upon creation e.g. admin, manager, sales, accountant,..)
- Dealership could add/remove permissions to the default roles.
- Dealership can define their own custom roles.
- A dealership has multiple vendors and each vendor has a couple of roles (admin, accountant, vendor)
- A dealership has numerous departments and each department may have their own roles for that department.
- Basically you have different roles in different contexts.
In my built-in model, I have a table that connects a Role to a Principal (an entity) and the ACLs (or permissions) are assigned to the roles. The Principal could be any of "DealershipA", "DealershipB", "Vendor1" "Department0".
Now my questions is: What is the best practice to implement this scenario in Keycloak.
- How would you add/assign a role to an entity?
- Would you consider a Dealership, Vendor or a Department a Resource?
Thank you in advance for all your help,