Open
Description
When using ACL, we were able to filter out parts of the returned object in a method invocation based on permissions.
Now on spring-security 5.8.x there's a bunch of deprecated APIs.
I have a MethodSecurityInterceptor which was delegating to AclEntryAfterInvocationCollectionFilteringProvider the decision to filter out parts of the response:
AfterInvocationProviderManager afterInvocationProviderManager = new AfterInvocationProviderManager();
afterInvocationProviderManager.setProviders(List.of(new MyAclEntryAfterInvocationCollectionFilteringProvider()));
MethodSecurityInterceptor interceptor = new MethodSecurityInterceptor();
interceptor.setAuthenticationManager(authenticationManager);
interceptor.setAccessDecisionManager(accessDecisionManager);
interceptor.setAfterInvocationManager(afterInvocationManager);
interceptor.setSecurityMetadataSource(new MapBasedMethodSecurityMetadataSource(Map.of("com.packagea.MyClass.readAll*", new SecurityConfig("AFTER_ACL_COLLECTION_READ")));
In the javadoc and documentation it says to use AuthorizationManagerBeforeMethodInterceptor
or AuthorizationManagerAfterMethodInterceptor
, but these classes won't allow me to change the returned object, filtering my returned collection.
What would be the supported way in spring-security 5.8.x or 6.x to filter returned objects based on permissions like AclEntryAfterInvocationCollectionFilteringProvider
?