public class SwarmStrategy extends AbstractSwarmStrategy
ClassAuthorizationStrategy
. It allows for both simple logins as well
as multi level logins.loginContainer
MESSAGE_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 |
isResourceAuthorized(org.apache.wicket.request.resource.IResource resource,
org.apache.wicket.request.mapper.parameter.PageParameters parameters) |
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, isModelAuthorized
destroy, getClassChecks, getClassChecks, getExceptionMessage, isInstantiationAuthorized
createMessageSource, get, getActionFactory, getMessageSource, getMessageSource, getSecurityCheck, isActionAuthorized, logMessage, logMessage, logMessage, logMessages, removeMessageSource, setStrategyResolver
public SwarmStrategy(Object hiveQueen)
hiveQueen
- A key to retrieve the Hive
public 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 Hive
protected final Hive getHive()
SecurityException
- if no hive is registered.public boolean hasPermission(Permission permission, Subject subject)
Hive
.hasPermission
in class AbstractSwarmStrategy
permission
- 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 WaspAction
s 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 WaspAuthorizationStrategy
context
- 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 WaspAuthorizationStrategy
context
- 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()
WaspAuthorizationStrategy
WaspAuthorizationStrategy.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 WaspAuthorizationStrategy
WaspAuthorizationStrategy.isUserAuthenticated()
public boolean isResourceAuthorized(org.apache.wicket.request.resource.IResource resource, org.apache.wicket.request.mapper.parameter.PageParameters parameters)
Copyright © 2015. All rights reserved.