Spring Security
Integrate Big ACL with Spring Security
1. Overview
By using the Big ACL Spring Security Connector, you can:
Keep your application logic simpler by externalizing access control.
Use Spring Security annotations for method- and endpoint-level security.
Rely on Big ACL to evaluate access decisions without having to implement custom logic in your application.
This integration is particularly helpful when you have multiple services or microservices that need consistent security policies enforced by a single authorization engine.
2. Prerequisites
Spring Boot (version 3.x) and Spring Security already set up in your application.
A Big ACL account or instance running that you can connect to.
Basic knowledge of how to secure methods or endpoints in Spring (e.g.,
@PreAuthorize
annotations).
3. Installation
Add the connector dependency to your
pom.xml
orbuild.gradle
.Maven:
Gradle:
Enable annotation-based security in your application. Ensure you have
@EnableGlobalMethodSecurity(prePostEnabled = true)
(for Spring Security 5.x) or@EnableMethodSecurity
(for Spring Security 6.x) in your configuration class. For example:or, if you’re using Spring Security 6+:
4. Configuration
Application Properties Provide the necessary connection parameters so that your application can communicate with Big ACL. For example, in
application.properties
(orapplication.yml
):Adjust property names according to how your connector is configured to read them (these might differ based on your internal naming conventions).
Bean Registration
BigAclPermissionEvaluator
is the core component that delegates permission checks to the Big ACL platform.
5. Usage in Code
Once everything is configured, you can use standard Spring Security annotations (e.g., @PreAuthorize
) to guard your controller methods. For example:
How hasPermission
Works
hasPermission
WorksThe
hasPermission(#id, 'Folder', 'read')
expression tells Spring Security to call the BigAclPermissionEvaluator to check whether the current user has the'read'
permission on a'Folder'
resource identified by#id
.The
#id
is an argument from the method’s parameters (in this case, the folder ID from the path).You can adapt the arguments to match your resource naming or your domain model in Big ACL (e.g.,
'File'
vs'Folder'
, etc.).
Last updated
Was this helpful?