public class SwarmStrategy extends AbstractSwarmStrategy
ClassAuthorizationStrategy. It allows for both simple logins as well
as multi level logins.loginContainerMESSAGE_KEY| Constructor and Description |
|---|
SwarmStrategy(Class<? extends ISecureComponent> secureClass,
Object hiveQueen)
Constructs a new strategy linked to the specified hive.
|
SwarmStrategy(Object hiveQueen)
Constructs a new strategy linked to the specified hive.
|
| Modifier and Type | Method and Description |
|---|---|
protected Hive |
getHive()
Returns the hive.
|
protected LoginContainer |
getLoginContainer()
The
LoginContainer keeps track of all Subjects for this session.. |
boolean |
hasPermission(Permission permission,
Subject subject)
Performs the actual permission check at the
Hive. |
boolean |
isUserAuthenticated()
Checks if there is a user logged in at all.
|
void |
login(Object context)
Logs a user in.
|
boolean |
logoff(Object context)
Loggs a user off.
|
protected void |
logPermissionDenied(Permission permission,
Subject subject)
Logs (if logging is enabled) which permission was denied for a subject.
|
getSubject, hasPermission, isClassAuthenticated, isClassAuthorized, isComponentAuthenticated, isComponentAuthorized, isModelAuthenticated, isModelAuthorizeddestroy, getClassChecks, getClassChecks, getExceptionMessage, isInstantiationAuthorizedcreateMessageSource, get, getActionFactory, getMessageSource, getMessageSource, getSecurityCheck, isActionAuthorized, logMessage, logMessage, logMessage, logMessages, removeMessageSource, setStrategyResolverpublic SwarmStrategy(Object hiveQueen)
hiveQueen - A key to retrieve the Hivepublic SwarmStrategy(Class<? extends ISecureComponent> secureClass, Object hiveQueen)
secureClass - instances of this class will be required to have access authorization.hiveQueen - A key to retrieve the Hiveprotected final Hive getHive()
SecurityException - if no hive is registered.public boolean hasPermission(Permission permission, Subject subject)
Hive.hasPermission in class AbstractSwarmStrategypermission - the permission to verifysubject - optional subject to test against the permissionSecurityException - if the permission is nullprotected void logPermissionDenied(Permission permission, Subject subject)
IAuthorizationMessageSource for later retrieval. The
following variables are stored: "permission","actions", "subject" and "principals" where
principals is a collection of principals that contain the permission and actions is a
String representing all the WaspActions required. Note that the subject
variable might be null.permission - permission that was denied.subject - optional subjectWaspAuthorizationStrategy.logMessages(),
WaspAuthorizationStrategy.getMessageSource()public void login(Object context) throws LoginException
LoginContext.login in class WaspAuthorizationStrategycontext - a not further specified object that provides all the information to log the user
onLoginException - if the login is unsuccessfulWaspAuthorizationStrategy.login(java.lang.Object)public boolean logoff(Object context)
LoginContext and must
be the same (or equal) to the logincontext used to log in.logoff in class WaspAuthorizationStrategycontext - a not further specified object, might be nullWaspAuthorizationStrategy.logoff(Object)protected final LoginContainer getLoginContainer()
LoginContainer keeps track of all Subjects for this session..public boolean isUserAuthenticated()
WaspAuthorizationStrategyWaspAuthorizationStrategy.login(Object) and false after a successful WaspAuthorizationStrategy.logoff(Object). Note that in a
multi-login scenario this method returns true until all successful logins are countered with
a successful logoff.isUserAuthenticated in class WaspAuthorizationStrategyWaspAuthorizationStrategy.isUserAuthenticated()Copyright © 2015. All rights reserved.