Quick revision
The short answer
The spring-security-acl module stores per-object permissions in database tables, covering object identities, permission entries and security identities (SIDs), and checks them through an AclPermissionEvaluator. It suits applications where permissions are granted per object to users or groups, like document sharing, but it adds a schema, caching and real complexity. When access can be decided from data we already have, such as ownership, a small custom PermissionEvaluator is simpler, and expressions like @PreAuthorize("hasPermission(#id, 'Invoice', 'read')") work with either.
What to remember
In this answer, we saw that spring-security-acl stores explicit per-object grants in tables for SIDs, classes, object identities and entries, and checks them through an AclPermissionEvaluator, which suits sharing features but brings a schema, caching, lifecycle code and awkward list queries. A custom PermissionEvaluator computes permissions from data we already have, such as ownership, with plain Java. Both serve the same hasPermission() expressions, so we can start simple and switch later.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The spring-security-acl module stores per-object permissions in database tables, covering object identities, permission entries and security identities (SIDs), and checks them through an AclPermissionEvaluator. It suits applications where permissions are granted per object to users or groups, like document sharing, but it adds a schema, caching and real complexity. When access can be decided from data we already have, such as ownership, a small custom PermissionEvaluator is simpler, and expressions like @PreAuthorize("hasPermission(#id, 'Invoice', 'read')") work with either.
Why this question is asked
Sooner or later every application needs rules about individual objects: this user may edit this document, that user may only read it. Spring Security offers two ways to plug such rules into hasPermission() expressions, and choosing the wrong one costs either months of complexity or a rewrite later. Interviewers ask this question to see whether we know what the ACL module really is and when it is worth it. In this answer, we will recap domain object security, look at the ACL module's tables and how a check runs, see what it costs, write a simple PermissionEvaluator, and compare the two.
1A Quick Recap: Domain Object Security
URL rules and roles answer questions about kinds of things: may a support agent open invoices? Domain object security answers questions about one specific thing: may this agent open invoice 42? Spring Security connects such questions to method security through the hasPermission() expression. Whatever we write there is handed to a PermissionEvaluator, an interface with two methods: one receives the object itself, the other receives an id and a type name.
So the expression is the same; what changes is the evaluator behind it. The ACL module provides one evaluator backed by tables of explicit grants, and we can write our own backed by our own logic.
2What the ACL Module Stores
An access control list (ACL) is a list of grants attached to one object. The ACL module keeps them in four tables, created from a schema script shipped with the module: acl_sid for security identities, acl_class for domain classes, acl_object_identity for each protected object and acl_entry for the grants themselves.
Object identities have an owner and an optional parent, and they can inherit entries from that parent, so sharing a folder can share every document in it. Permissions are bit masks such as READ and WRITE. Granting access is done in code through a MutableAclService, as below.
| Table | One row per | Example |
|---|---|---|
| acl_sid | security identity: user or authority | principal bob; authority ROLE_EDITOR |
| acl_class | domain class | com.example.Document |
| acl_object_identity | domain object, with owner and parent | Document 42, owner anne, parent folder 7 |
| acl_entry | grant on an object to a SID | Document 42: bob READ granted |
Notice that bob gets READ on document 42 only. The grant is a row in acl_entry pointing at his SID and the document's object identity, and nothing else about bob or the document had to change.
3How an ACL Check Runs, and What It Costs
When the expression is evaluated, the AclPermissionEvaluator builds an object identity from the id and type, collects the SIDs of the current user (their principal and every granted authority), asks the AclService to load the ACL for the object and its parents, and checks whether any entry grants the permission to any of those SIDs.
- Build ObjectIdentityDocument, 42
- Collect user's SIDs
PrincipalSidbob,GrantedAuthoritySidROLE_EDITOR - ACL in cache?YesUse cached ACLNoLoad from 4 tables, cache it
- Entry grants READ to a SID?checks parents tooYesAllowNoAccessDeniedException
4 steps in order. Play them, or step through them one at a time.
The costs are real. We add four tables, a lookup strategy, an ACL cache (without one, every check is several joins), an authorization strategy for who may change ACLs, and code that creates and deletes ACL rows whenever domain objects are created or deleted, in the same transaction. Lists are the hardest part: ACLs answer is this object allowed, not which objects are allowed, so a page of 50 documents means 50 checks or a custom query against the ACL tables. For an application whose model really is explicit sharing, that cost buys exactly the right feature.
4A Custom PermissionEvaluator for Rules We Already Know
Many applications do not grant permissions per object at all. An invoice is readable by its customer and by support staff, full stop. All the information is already in the invoice row, so storing ACL entries would just duplicate it. A custom evaluator expresses the rule in plain Java.
Notice that the default is deny: an unknown type or permission returns false. The annotation is exactly the one we would use with the ACL module, so if the application later needs real sharing, we can swap the evaluator, or delegate from ours to an AclPermissionEvaluator for some types, without touching any service method. How the evaluator is registered has become simpler in recent versions; check your version, but the expression handler bean shown here works throughout 6.x.
5Choosing Between Them
The deciding question is where the permission comes from. If it can be computed from existing data, such as ownership, department, status or tenant, a PermissionEvaluator, or even a plain query filter, is simpler and faster. If it comes from explicit grants that users make to each other, such as share this document with Bob for editing, the information must be stored somewhere, and the ACL module is a ready-made, tested way to store and check it. Many applications mix both: computed rules for most objects and explicit grants only for the shareable ones.
6Follow-up questions
Is the ACL module still maintained?
It is part of Spring Security and still shipped, but it is a mature module that changes rarely, and its design predates newer approaches such as relationship-based authorization services. For a new product built around sharing, it is worth comparing it with those options too.
Why does the permission parameter accept 'read' as a string?
The AclPermissionEvaluator uses a PermissionFactory to turn names like read or numbers like 1 into Permission objects. Our custom evaluator receives whatever we write and interprets it itself, so we should define a small fixed set of permission names.
Can hasPermission check an object returned by the method?
Yes, with @PostAuthorize("hasPermission(returnObject, 'read')"), which calls the evaluator method that receives the object, avoiding a second database load.
7Conclusion
In this answer, we saw that spring-security-acl stores explicit per-object grants in tables for SIDs, classes, object identities and entries, and checks them through an AclPermissionEvaluator, which suits sharing features but brings a schema, caching, lifecycle code and awkward list queries. A custom PermissionEvaluator computes permissions from data we already have, such as ownership, with plain Java. Both serve the same hasPermission() expressions, so we can start simple and switch later.
Open with
The ACL module gives us per-object permissions stored in the database. It has four tables: acl_sid for security identities, which are users or authorities, acl_class for domain types, acl_object_identity for each object with its owner and optional parent for inheritance, and acl_entry for grants such as bob has READ on document 42.
Then, if they want more
An AclPermissionEvaluator answers hasPermission expressions by collecting the user's SIDs, loading the object's ACL, ideally from a cache, and checking the entries. It is the right tool when permissions are granted per object to users or groups, like sharing documents or folders.
But it adds a schema, an ACL cache, code to create and delete ACL rows alongside domain objects, and it is awkward for lists, because it checks one object at a time.
If the rule can be computed from data we already have, like the invoice's customer id or the user's support role, I would write a custom PermissionEvaluator instead: plain Java, deny by default, registered on the method security expression handler.
The nice part is that the annotation, for example @PreAuthorize("hasPermission(#id, 'Invoice', 'read')"), is the same with either evaluator, so we can start with the simple one and move to ACLs or a sharing service only if the product needs explicit grants.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Security reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What does Spring Security's ACL module provide, and when would a PermissionEvaluator...": https://scrivio-interview-library.netlify.app/spring-boot/authorization/ba3d7a010f/