org.springframework.richclient.security.support
Class DefaultSecurityControllerManager

java.lang.Object
  extended by org.springframework.richclient.security.support.DefaultSecurityControllerManager
All Implemented Interfaces:
SecurityControllerManager

public class DefaultSecurityControllerManager
extends Object
implements SecurityControllerManager

Default implementation of the SecurityControllerManager. The controller map can be set during bean initialization. Also, if the map is not set, or does not contain an entry for a requested security controller Id, then an attempt to retrieve a bean instance with the given id will be made. Thus, no map entries are required for security controllers that are referenced by their application context bean id.

This implementation also provides for a fallback security controller. The fallback controller is registered with the setFallbackSecurityController(SecurityController) method. Once registered, any call to getSecurityController(String) that would have normally resulted in not finding a controller will instead return the fallback controller.

Here's an example configuration:

   <bean id="securityControllerManager" class="org.springframework.richclient.security.support.DefaultSecurityControllerManager">
       <property name="fallbackSecurityController" ref="writeController" />
       <property name="securityControllerMap">
           <map>
               <entry key="contact.newContactCommand" value-ref="adminController"/>
               <entry key="contact.deleteContactCommand" value-ref="adminController"/>
           </map>
       </property>
   </bean>
 

Author:
Larry Streepy

Constructor Summary
DefaultSecurityControllerManager()
           
 
Method Summary
 SecurityController getFallbackSecurityController()
          Get the fallback security controller, if any.
 SecurityController getSecurityController(String id)
          Get the security controller for the given id.
 void registerSecurityControllerAlias(String aliasId, SecurityController securityController)
          Register an alias for a SecurityController.
 void setFallbackSecurityController(SecurityController fallbackController)
          Set the fallback security controller.
 void setSecurityControllerMap(Map map)
          Set the map of controller Ids to controller instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSecurityControllerManager

public DefaultSecurityControllerManager()
Method Detail

setSecurityControllerMap

public void setSecurityControllerMap(Map map)
Description copied from interface: SecurityControllerManager
Set the map of controller Ids to controller instances.

Specified by:
setSecurityControllerMap in interface SecurityControllerManager
Parameters:
map - keyed by controller Id, value is SecurityController instance

getSecurityController

public SecurityController getSecurityController(String id)
Get the security controller for the given id. If the id is registered in our map, then return the registered controller. If not, then try to obtain a bean with the given id if it implements the SecurityController interface.

Specified by:
getSecurityController in interface SecurityControllerManager
Parameters:
id - of controller to retrieve
Returns:
controller, null if not found

registerSecurityControllerAlias

public void registerSecurityControllerAlias(String aliasId,
                                            SecurityController securityController)
Register an alias for a SecurityController.

Specified by:
registerSecurityControllerAlias in interface SecurityControllerManager
Parameters:
aliasId - to register
securityController - to register under given alias Id

setFallbackSecurityController

public void setFallbackSecurityController(SecurityController fallbackController)
Set the fallback security controller. This controller will be returned for any requested controller Id that is not found in the registry.

Parameters:
fallbackController -

getFallbackSecurityController

public SecurityController getFallbackSecurityController()
Get the fallback security controller, if any.

Returns:
fallback security controller, null if not defined


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.