@RequiresAuthentication
Verify that the user is logged in, equivalent to when the method subject.isAuthenticated () returns true .
@RequiresUser
Verify whether the user is memorized, user has two meanings:
One is successfully logged in ( subject.isAuthenticated () result is true );
The other is remembered ( subject.isRemembered () is true ).
@RequiresGuest
Validate if a request is a guest , the exact opposite of @RequiresUser .
In other words, RequiresUser == ! RequiresGuest .
At this point subject.getPrincipal () results in null.
@RequiresRoles
For example: @RequiresRoles ( " aRoleName ");
void someMethod();
The method someMethod can only be accessed if the subject has aRoleName . If this permission is not present, an AuthorizationException will be thrown .
@RequiresPermissions
例如: @RequiresPermissions({"file:read", "write:aFile.txt"} )
void someMethod();
It is required that the subject must have both file:read and write:aFile.txt permissions to execute the method someMethod () . Otherwise an exception AuthorizationException is thrown .