Class AuthSubsystem

  • All Implemented Interfaces:
    ISubsystem, IAuthSubsystem

    public class AuthSubsystem
    extends java.lang.Object
    implements IAuthSubsystem
    Default authentication subsystem

    Version:
    $Revision$, $Date$
    Author:
    cfu, lhsiao
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
      • mAuthMgrPlugins

        public java.util.Hashtable<java.lang.String,​AuthMgrPlugin> mAuthMgrPlugins
      • mAuthMgrInsts

        public java.util.Hashtable<java.lang.String,​AuthManagerProxy> mAuthMgrInsts
    • Method Detail

      • init

        public void init​(IConfigStore config)
                  throws EBaseException
        Initializes the authentication subsystem from the config store. Load Authentication manager plugins, create and initialize initialize authentication manager instances.
        Specified by:
        init in interface ISubsystem
        Parameters:
        config - The configuration store.
        Throws:
        EBaseException - failed to initialize
      • getRequiredCreds

        public java.lang.String[] getRequiredCreds​(java.lang.String authMgrInstName)
                                            throws EAuthMgrNotFound
        Gets a list of required authentication credential names of the specified authentication manager.
        Specified by:
        getRequiredCreds in interface IAuthSubsystem
        Parameters:
        authMgrInstName - The authentication manager name
        Returns:
        a Vector of required credential attribute names.
        Throws:
        EAuthMgrNotFound
      • getConfigParams

        public java.lang.String[] getConfigParams​(java.lang.String implName)
                                           throws EAuthMgrPluginNotFound,
                                                  EBaseException
        Gets configuration parameters for the given authentication manager plugin.
        Specified by:
        getConfigParams in interface IAuthSubsystem
        Parameters:
        implName - Name of the authentication plugin.
        Returns:
        Hashtable of required parameters.
        Throws:
        EAuthMgrPluginNotFound - If the authentication manager plugin is not found.
        EBaseException - If an internal error occurred.
      • add

        public void add​(java.lang.String name,
                        IAuthManager authMgrInst)
        Add an authentication manager instance.
        Specified by:
        add in interface IAuthSubsystem
        Parameters:
        name - name of the authentication manager instance
        authMgr - the authentication manager instance to be added
      • delete

        public void delete​(java.lang.String name)
        Description copied from interface: IAuthSubsystem
        Deletes (deregisters) the given authentication manager.
        Specified by:
        delete in interface IAuthSubsystem
        Parameters:
        name - The authentication manager name to delete.
      • get

        public IAuthManager get​(java.lang.String name)
        Gets the authentication manager instance of the specified name.
        Specified by:
        get in interface IAuthSubsystem
        Parameters:
        name - name of the authentication manager instance
        Returns:
        the named authentication manager instance
      • getAuthManagers

        public java.util.Enumeration<IAuthManager> getAuthManagers()
        Enumerate all authentication manager instances.
        Specified by:
        getAuthManagers in interface IAuthSubsystem
        Returns:
        a list of authentication managers
      • getAuthManagerPlugins

        public java.util.Enumeration<AuthMgrPlugin> getAuthManagerPlugins()
        Enumerate all registered authentication manager plugins.
        Specified by:
        getAuthManagerPlugins in interface IAuthSubsystem
        Returns:
        a list of authentication plugins
      • getAuthManagerPluginImpl

        public AuthMgrPlugin getAuthManagerPluginImpl​(java.lang.String name)
        retrieve a single auth manager plugin by name
        Specified by:
        getAuthManagerPluginImpl in interface IAuthSubsystem
        Parameters:
        name - given authentication manager name.
        Returns:
        an authentication manager plugin
      • getAuthManagerPlugin

        public IAuthManager getAuthManagerPlugin​(java.lang.String name)
        Retrieve a single auth manager instance
        Specified by:
        getAuthManagerPlugin in interface IAuthSubsystem
        Parameters:
        name - given authentication plugin name
        Returns:
        the given authentication plugin
      • getId

        public java.lang.String getId()
        Retrieves id (name) of this subsystem.
        Specified by:
        getId in interface ISubsystem
        Returns:
        name of the authentication subsystem
      • setId

        public void setId​(java.lang.String id)
                   throws EBaseException
        Sets id string to this subsystem.

        Use with caution. Should not do it when sharing with others

        Specified by:
        setId in interface ISubsystem
        Parameters:
        id - name to be applied to an authentication sybsystem
        Throws:
        EBaseException - failed to set id
      • shutdown

        public void shutdown()
        shuts down authentication managers one by one.

        Specified by:
        shutdown in interface ISubsystem
      • getPlugins

        public java.util.Hashtable<java.lang.String,​AuthMgrPlugin> getPlugins()
        Description copied from interface: IAuthSubsystem
        Get a hashtable containing all authentication plugins.
        Specified by:
        getPlugins in interface IAuthSubsystem
        Returns:
        all authentication plugins.
      • getInstances

        public java.util.Hashtable<java.lang.String,​AuthManagerProxy> getInstances()
        Description copied from interface: IAuthSubsystem
        Get a hashtable containing all authentication instances.
        Specified by:
        getInstances in interface IAuthSubsystem
        Returns:
        all authentication instances.
      • getConfigStore

        public AuthenticationConfig getConfigStore()
        Returns the root configuration storage of this system.

        Specified by:
        getConfigStore in interface ISubsystem
        Returns:
        configuration store of this subsystem
      • getAuthManager

        public IAuthManager getAuthManager​(java.lang.String name)
        gets the named authentication manager
        Specified by:
        getAuthManager in interface IAuthSubsystem
        Parameters:
        name - of the authentication manager
        Returns:
        the named authentication manager