Class SecurityServiceImpl
- All Implemented Interfaces:
SecurityService
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.shiro.subject.SubjectbooleanhasAllPermissions(String permissions) booleanhasAllRoles(String roles) booleanhasAnyPermissions(String permissions) booleanhasAnyRoles(String roles) Return true if the current user has any of the roles specified.booleanhasPermission(String permission) boolean<T> TinvokeWithSecurityDisabled(Callable<T> callable) Temporarily disable security before invocation of Callable.booleanReturn true only if the current user has executed a successful authentication attempt during their current session.booleanisGuest()Return true if the current user is not known to the system, either because they haven't logged in yet, or because they have no 'RememberMe' identity.booleanisLacksPermission(String permission) booleanisLacksRole(String role) booleanReturn true only if the current user has not executed a successful authentication attempt during their current session.booleanisUser()Return true if the current user known to the system, either from a successful login attempt (not necessarily during the current session) or from 'RememberMe' services.
-
Constructor Details
-
SecurityServiceImpl
public SecurityServiceImpl()
-
-
Method Details
-
getSubject
public org.apache.shiro.subject.Subject getSubject()- Specified by:
getSubjectin interfaceSecurityService
-
isAuthenticated
public boolean isAuthenticated()Description copied from interface:SecurityServiceReturn true only if the current user has executed a successful authentication attempt during their current session.This is more restrictive than the
SecurityService.isUser(), which only ensures the current user is known to the system, either via a current login or from Remember Me services, which only makes the assumption that the current user is who they say they are, and does not guarantee it like this method does.- Specified by:
isAuthenticatedin interfaceSecurityService
-
isNotAuthenticated
public boolean isNotAuthenticated()Description copied from interface:SecurityServiceReturn true only if the current user has not executed a successful authentication attempt during their current session.The logically opposite tag of this one is the
SecurityService.isAuthenticated().- Specified by:
isNotAuthenticatedin interfaceSecurityService
-
isUser
public boolean isUser()Description copied from interface:SecurityServiceReturn true if the current user known to the system, either from a successful login attempt (not necessarily during the current session) or from 'RememberMe' services.Note: This is less restrictive than the
SecurityService.isAuthenticated()since it only assumes the user is who they say they are, either via a current session login or via Remember Me services, which makes no guarantee the user is who they say they are. TheSecurityService.isAuthenticated()however guarantees that the current user has logged in during their current session, proving they really are who they say they are.The logically opposite method of this one is the
SecurityService.isGuest().- Specified by:
isUserin interfaceSecurityService
-
isGuest
public boolean isGuest()Description copied from interface:SecurityServiceReturn true if the current user is not known to the system, either because they haven't logged in yet, or because they have no 'RememberMe' identity.The logically opposite method of this one is the
SecurityService.isUser(). Please read that class's JavaDoc as it explains more about the differences between Authenticated/Unauthenticated and User/Guest semantic differences.- Specified by:
isGuestin interfaceSecurityService
-
hasAnyRoles
Description copied from interface:SecurityServiceReturn true if the current user has any of the roles specified.- Specified by:
hasAnyRolesin interfaceSecurityService
-
hasAllRoles
- Specified by:
hasAllRolesin interfaceSecurityService
-
hasAllPermissions
- Specified by:
hasAllPermissionsin interfaceSecurityService
-
hasAnyPermissions
- Specified by:
hasAnyPermissionsin interfaceSecurityService
-
hasPermission
- Specified by:
hasPermissionin interfaceSecurityService
-
hasRole
- Specified by:
hasRolein interfaceSecurityService
-
isLacksPermission
- Specified by:
isLacksPermissionin interfaceSecurityService
-
isLacksRole
- Specified by:
isLacksRolein interfaceSecurityService
-
invokeWithSecurityDisabled
Description copied from interface:SecurityServiceTemporarily disable security before invocation of Callable.- Specified by:
invokeWithSecurityDisabledin interfaceSecurityService- Parameters:
callable- A callable that will be invoked with security disabled- Returns:
- Throws:
Exception
-