You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: acl/src/main/java/org/springframework/security/acls/afterinvocation/AclEntryAfterInvocationCollectionFilteringProvider.java
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/servlet/authorization/acls.adoc
+134-6Lines changed: 134 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -202,11 +202,139 @@ Instead, you need to write code similar to that shown in the preceding example f
202
202
You should consider using AOP on your services layer to automatically integrate the ACL information with your services layer operations.
203
203
We have found this approach to be effective.
204
204
205
+
== Using the PermissionEvaluator
206
+
205
207
Once you have used the techniques described here to store some ACL information in the database, the next step is to actually use the ACL information as part of authorization decision logic.
206
-
You have a number of choices here.
207
-
You could write your own `AccessDecisionVoter` or `AfterInvocationProvider` that (respectively) fires before or after a method invocation.
208
-
Such classes would use `AclService` to retrieve the relevant ACL and then call `Acl.isGranted(Permission[] permission, Sid[] sids, boolean administrativeMode)` to decide whether permission is granted or denied.
209
-
Alternately, you could use our `AclEntryVoter`, `AclEntryAfterInvocationProvider` or `AclEntryAfterInvocationCollectionFilteringProvider` classes.
210
-
All of these classes provide a declarative-based approach to evaluating ACL information at runtime, freeing you from needing to write any code.
211
208
212
-
See the https://github.com/spring-projects/spring-security-samples[sample applications] to learn how to use these classes.
209
+
You have a number of choices here with the primary one being using `AclPermissionEvaluator` in your `@PreAuthorize`, `@PostAuthorize`, `@PreFilter`, and `@PostFilter` annotation expressions.
210
+
211
+
This is a sample listing of the components needed to wire an `AclPersmissionEvaluator` into your authorization logic:
Then using xref:servlet/authorization/method-security.adoc#authorizing-with-annotations[method-based security] you can use `hasPermission` in your annotation expressions like so:
0 commit comments