Spring Security ACL looks very powerful, and easy to implement when you can stick to their database implementation. However it appears to become much more complicated when you have to implement your own Acl
and AclService
(see for example this (old) very basic tutorial of only ~26 pages) and it seems difficult to find references and examples for it (that tutorial was from 2008).
In our application for example, users have roles and belong to departments. Most of the time, they are allowed to perform some operations on objects that belong to their department based on their roles. In all cases, department + role is sufficient to decide whether a user should be granted a specific operation on a specific object.
Users, roles and departments are managed by an external application from which we retrieve them when the user connects (we are using REST services but it could as well be an LDAP server).
We would like to rely on @PreAuthorize('hasPermission(…)')
for implementing domain object security. 2 solutions are thus in sight:
- Implement a custom
PermissionEvaluator
that does the whole checks; or - Implement ACL with a custom
AclService
that builds the object structure necessary for ACL's to work properly.
It seems that implementing the whole AclService
would be more difficult and more complex than implementing a PermissionEvaluator
, but ACL's seem to be more standard.
Based on which criteria should you implement one or the other?