|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.security.support.AbstractSecurityController
public abstract class AbstractSecurityController
Abstract implementation of a security controller. Derived classes are responsible for
providing the ConfigAttributeDefinition
and any secured object that will be
used by the decision manager to make the decision to authorize the controlled objects.
This class uses weak references to track the the controlled objects, so they can be GCed as needed.
If a subclass provides a new post-processor action, then it needs to call
registerPostProcessorAction(String)
during construction and it must override
doPostProcessorAction(String, Object, boolean)
. It is critical that
the overridden doPostProcessorAction method call
super.doPostProcessorAction
for any action id it does not directly
handle.
This base class provides the following post-processor actions:
visibleTracksAuthorized - if the controlled object has a
setVisible(boolean)
method then it is called with the authorized value.
Thus, if the object is not authorized, it will have setVisible(false)
called on it.
getSecuredObject()
,
getConfigAttributeDefinition(Object)
Field Summary | |
---|---|
static String |
VISIBLE_TRACKS_AUTHORIZED_ACTION
|
Constructor Summary | |
---|---|
protected |
AbstractSecurityController()
Constructor. |
Method Summary | |
---|---|
void |
addControlledObject(Authorizable object)
Add an object to our controlled set. |
void |
afterPropertiesSet()
Validate our configuration. |
protected void |
doPostProcessorAction(String actionId,
Object controlledObject,
boolean authorized)
Post-process a controlled object after its authorization state has been updated. |
org.acegisecurity.AccessDecisionManager |
getAccessDecisionManager()
Get the access decision manager in use |
protected abstract org.acegisecurity.ConfigAttributeDefinition |
getConfigAttributeDefinition(Object securedObject)
Get the ConfigAttributeDefinition for the secured object. |
protected org.acegisecurity.Authentication |
getLastAuthentication()
|
String |
getPostProcessorActionsToRun()
Get the list of post-processor actions to run. |
protected abstract Object |
getSecuredObject()
Get the secured object on which we are making the authorization decision. |
protected void |
registerPostProcessorAction(String actionId)
Register a post-processor action. |
Object |
removeControlledObject(Authorizable object)
Remove an object from our controlled set. |
protected void |
runAuthorization()
Update the authorization of all controlled objects. |
protected void |
runPostProcessorActions(Object controlledObject,
boolean authorized)
Run all the requested post-processor actions. |
void |
setAccessDecisionManager(org.acegisecurity.AccessDecisionManager accessDecisionManager)
Set the access decision manager to use |
void |
setAuthenticationToken(org.acegisecurity.Authentication authentication)
The authentication token for the current user has changed. |
void |
setControlledObjects(List secured)
Set the objects that are to be controlled. |
protected void |
setLastAuthentication(org.acegisecurity.Authentication authentication)
|
void |
setPostProcessorActionsToRun(String actions)
Set the list of post-processor actions to be run. |
protected boolean |
shouldAuthorize(org.acegisecurity.Authentication authentication)
Determine if our controlled objects should be authorized based on the provided authentication token. |
protected void |
updateControlledObject(Authorizable controlledObject,
boolean authorized)
Update a controlled object based on the given authorization state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VISIBLE_TRACKS_AUTHORIZED_ACTION
Constructor Detail |
---|
protected AbstractSecurityController()
Method Detail |
---|
protected abstract Object getSecuredObject()
protected abstract org.acegisecurity.ConfigAttributeDefinition getConfigAttributeDefinition(Object securedObject)
securedObject
- Secured object for whom the config attribute definition is to
be rretrieved. This may be null.
public void setPostProcessorActionsToRun(String actions)
actions
- Comma-separated list of post-processor action namespublic String getPostProcessorActionsToRun()
protected void registerPostProcessorAction(String actionId)
actionId
- Id of post-processor action to registerpublic void setAuthenticationToken(org.acegisecurity.Authentication authentication)
setAuthenticationToken
in interface AuthenticationAware
authentication
- now in effect, may be nullprotected void runAuthorization()
protected void updateControlledObject(Authorizable controlledObject, boolean authorized)
controlledObject
- Object being controlledauthorized
- state that has been installed on controlledObjectprotected void runPostProcessorActions(Object controlledObject, boolean authorized)
controlledObject
- Object being controlledauthorized
- state that has been installed on controlledObjectprotected void doPostProcessorAction(String actionId, Object controlledObject, boolean authorized)
actionId
- Id of the post-processor action to runcontrolledObject
- Object being controlledauthorized
- state that has been installed on controlledObjectprotected boolean shouldAuthorize(org.acegisecurity.Authentication authentication)
authentication
- token
public void setAccessDecisionManager(org.acegisecurity.AccessDecisionManager accessDecisionManager)
setAccessDecisionManager
in interface SecurityController
accessDecisionManager
- public org.acegisecurity.AccessDecisionManager getAccessDecisionManager()
getAccessDecisionManager
in interface SecurityController
public void setControlledObjects(List secured)
Authorized
interface are processed.
setControlledObjects
in interface SecurityController
secured
- List of objects to controlpublic void addControlledObject(Authorizable object)
addControlledObject
in interface SecurityController
object
- to controlpublic Object removeControlledObject(Authorizable object)
removeControlledObject
in interface SecurityController
object
- to remove
protected void setLastAuthentication(org.acegisecurity.Authentication authentication)
protected org.acegisecurity.Authentication getLastAuthentication()
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |