I read the spring security docs and found out that I can use the following annotation to check if the object had edit access to the user.
@PreAuthorize("hasPermission('USER_EDIT')") public String editUSer(User user);
What I would like to do is write my MyAutorizationCheck annotation and use it as shown below.
@MyAuthorizationCheck(Application.USER_MANAGEMENT, AccessLevel.EDIT) public String editUSer(User user);
Where Application and AccessLevel are an enumeration.
enum Application{ USER_MANAGEMENT, ORDER_MANAGEMENT } enum AccessLevel{ READ, CREATE, UPDATE, DELETE }
The handler of this annotation should be able to decide if the user has permission.
Any pointers on how to achieve this?
Thanks.
spring security
Murali
source share