Description
Hello,
so I am creating a bunch of services with methods inside them and on each method I add the @PreAuthorize
annotation like so:
@Override
@PreAuthorize("hasAccess()")
public Page<DepartmentDtoDefinition> getAllDepartments(@NonNull final Pageable pageable) {
}
All of these services are packaged in a JAR file and shipped to the customer. What I really want is to resolve the expression in the @PreAuthorize
annotation from the database or from an external file (I will cache it) so that the customer can specify their own expression and disallow access to some of the services.
I think what I need is here:
would it be possible to provide a protected method in the GlobalMethodSecurityConfiguration
which will construct the ExpressionBasedAnnotationAttributeFactory
? This way I would be able to override this method and provide my own implementation that reads the expressions from the db or the file.
Thank you.