Class AuthzSubsystem
- java.lang.Object
-
- com.netscape.cmscore.authorization.AuthzSubsystem
-
- All Implemented Interfaces:
ISubsystem,IAuthzSubsystem
public class AuthzSubsystem extends java.lang.Object implements IAuthzSubsystem
Default authorization subsystem- Version:
- $Revision$, $Date$
- Author:
- cfu
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringIDstatic org.slf4j.Loggerloggerjava.util.Hashtable<java.lang.String,AuthzManagerProxy>mAuthzMgrInstsjava.util.Hashtable<java.lang.String,AuthzMgrPlugin>mAuthzMgrPlugins-
Fields inherited from interface org.dogtagpki.server.authorization.IAuthzSubsystem
PROP_CLASS, PROP_IMPL, PROP_PLUGIN, PROP_REALM
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String name, IAuthzManager authzMgrInst)Add an authorization manager instance.AuthzTokenauthorize(java.lang.String authzMgrInstName, IAuthToken authToken, java.lang.String exp)AuthzTokenauthorize(java.lang.String authzMgrName, IAuthToken authToken, java.lang.String resource, java.lang.String operation)authorize the user associated with the given authToken for a given operation with the given authorization manager nameAuthzTokenauthorize(java.lang.String authzMgrInstName, IAuthToken authToken, java.lang.String resource, java.lang.String operation, java.lang.String realm)Authorization to the named authorization manager instancevoidauthzMgrAccessInit(java.lang.String authzMgrInstName, java.lang.String accessInfo)authMgrzAccessInit is for servlets who want to initialize their own authorization information before full operation.voidcheckRealm(java.lang.String realm, IAuthToken authToken, java.lang.String owner, java.lang.String resource, java.lang.String operation)Authorize the user against the specified realm.voiddelete(java.lang.String name)Deletes (deregisters) the given authorization manager.IAuthzManagerget(java.lang.String name)Gets the authorization manager instance of the specified name.IAuthzManagergetAuthzManager(java.lang.String name)gets the named authorization managerjava.lang.StringgetAuthzManagerNameByRealm(java.lang.String realm)Given a realm name, return the name of an authz manager for that realm.IAuthzManagergetAuthzManagerPlugin(java.lang.String name)Retrieve a single authz manager instanceAuthzMgrPlugingetAuthzManagerPluginImpl(java.lang.String name)retrieve a single authz manager plugin by namejava.util.Enumeration<AuthzMgrPlugin>getAuthzManagerPlugins()Enumerate all registered authorization manager plugins.java.util.Enumeration<IAuthzManager>getAuthzManagers()Enumerate all authorization manager instances.java.lang.String[]getConfigParams(java.lang.String implName)Gets configuration parameters for the given authorization manager plugin.IConfigStoregetConfigStore()Returns the root configuration storage of this system.java.lang.StringgetId()Retrieves id (name) of this subsystem.static AuthzSubsystemgetInstance()java.util.Hashtable<java.lang.String,AuthzManagerProxy>getInstances()Get a hashtable containing all authentication instances.java.util.Hashtable<java.lang.String,AuthzMgrPlugin>getPlugins()Get a hashtable containing all authentication plugins.voidinit(IConfigStore config)Initializes the authorization subsystem from the config store.voidsetId(java.lang.String id)Sets id string to this subsystem.voidshutdown()shuts down authorization managers one by one.voidstartup()registers the administration servlet with the administration subsystem.
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
mAuthzMgrPlugins
public java.util.Hashtable<java.lang.String,AuthzMgrPlugin> mAuthzMgrPlugins
-
mAuthzMgrInsts
public java.util.Hashtable<java.lang.String,AuthzManagerProxy> mAuthzMgrInsts
-
-
Method Detail
-
getInstance
public static AuthzSubsystem getInstance()
-
init
public void init(IConfigStore config) throws EBaseException
Initializes the authorization subsystem from the config store. Load Authorization manager plugins, create and initialize initialize authorization manager instances.- Specified by:
initin interfaceISubsystem- Parameters:
config- The configuration store.- Throws:
EBaseException- failed to initialize
-
authzMgrAccessInit
public void authzMgrAccessInit(java.lang.String authzMgrInstName, java.lang.String accessInfo) throws EAuthzMgrNotFound, EBaseExceptionauthMgrzAccessInit is for servlets who want to initialize their own authorization information before full operation. It is supposed to be called during the init() method of a servlet.- Specified by:
authzMgrAccessInitin interfaceIAuthzSubsystem- Parameters:
authzMgrName- The authorization manager nameaccessInfo- the access information to be initialized. currently it's acl string in the format specified in the authorization manager- Throws:
EBaseException- if authorization manager is not foundEAuthzMgrNotFound
-
authorize
public AuthzToken authorize(java.lang.String authzMgrInstName, IAuthToken authToken, java.lang.String resource, java.lang.String operation, java.lang.String realm) throws EAuthzMgrNotFound, EBaseException
Authorization to the named authorization manager instance- Specified by:
authorizein interfaceIAuthzSubsystem- Parameters:
authzMgrName- The authorization manager nameauthToken- the authentication token associated with a userresource- the resource protected by the authorization systemoperation- the operation for resource protected by the authoriz n system- Returns:
- a authorization token.
- Throws:
EBaseException- If an error occurs during authorization.EAuthzMgrNotFound
-
authorize
public AuthzToken authorize(java.lang.String authzMgrName, IAuthToken authToken, java.lang.String resource, java.lang.String operation) throws EBaseException
Description copied from interface:IAuthzSubsystemauthorize the user associated with the given authToken for a given operation with the given authorization manager name- Specified by:
authorizein interfaceIAuthzSubsystem- Parameters:
authzMgrName- The authorization manager nameauthToken- the authenticaton token associated with a userresource- the resource protected by the authorization systemoperation- the operation for resource protected by the authorization system- Returns:
- a authorization token.
- Throws:
EBaseException- If an error occurs during authorization.
-
authorize
public AuthzToken authorize(java.lang.String authzMgrInstName, IAuthToken authToken, java.lang.String exp) throws EAuthzMgrNotFound, EBaseException
- Specified by:
authorizein interfaceIAuthzSubsystem- Throws:
EAuthzMgrNotFoundEBaseException
-
getConfigParams
public java.lang.String[] getConfigParams(java.lang.String implName) throws EAuthzMgrPluginNotFound, EBaseExceptionGets configuration parameters for the given authorization manager plugin.- Parameters:
implName- Name of the authorization plugin.- Returns:
- Hashtable of required parameters.
- Throws:
EAuthzMgrPluginNotFoundEBaseException
-
add
public void add(java.lang.String name, IAuthzManager authzMgrInst)Add an authorization manager instance.- Specified by:
addin interfaceIAuthzSubsystem- Parameters:
name- name of the authorization manager instanceauthzMgr- the authorization manager instance to be added
-
delete
public void delete(java.lang.String name)
Description copied from interface:IAuthzSubsystemDeletes (deregisters) the given authorization manager.- Specified by:
deletein interfaceIAuthzSubsystem- Parameters:
name- The authorization manager name to delete.
-
get
public IAuthzManager get(java.lang.String name)
Gets the authorization manager instance of the specified name.- Specified by:
getin interfaceIAuthzSubsystem- Parameters:
name- name of the authorization manager instance- Returns:
- the named authorization manager instance
-
getAuthzManagers
public java.util.Enumeration<IAuthzManager> getAuthzManagers()
Enumerate all authorization manager instances.- Specified by:
getAuthzManagersin interfaceIAuthzSubsystem- Returns:
- a list of authorization managers
-
getAuthzManagerPlugins
public java.util.Enumeration<AuthzMgrPlugin> getAuthzManagerPlugins()
Enumerate all registered authorization manager plugins.- Specified by:
getAuthzManagerPluginsin interfaceIAuthzSubsystem- Returns:
- list of authorization manager plugins
-
getAuthzManagerPluginImpl
public AuthzMgrPlugin getAuthzManagerPluginImpl(java.lang.String name)
retrieve a single authz manager plugin by name
-
getAuthzManagerPlugin
public IAuthzManager getAuthzManagerPlugin(java.lang.String name)
Retrieve a single authz manager instance- Specified by:
getAuthzManagerPluginin interfaceIAuthzSubsystem- Parameters:
name- given authorization plugin name- Returns:
- authorization manager plugin
-
getId
public java.lang.String getId()
Retrieves id (name) of this subsystem.- Specified by:
getIdin interfaceISubsystem- Returns:
- name of the authorization subsystem
-
setId
public void setId(java.lang.String id) throws EBaseExceptionSets id string to this subsystem.Use with caution. Should not do it when sharing with others
- Specified by:
setIdin interfaceISubsystem- Parameters:
id- name to be applied to an authorization sybsystem- Throws:
EBaseException- failed to set id
-
startup
public void startup() throws EBaseExceptionregisters the administration servlet with the administration subsystem.- Specified by:
startupin interfaceISubsystem- Throws:
EBaseException- failed to start up
-
shutdown
public void shutdown()
shuts down authorization managers one by one.- Specified by:
shutdownin interfaceISubsystem
-
getPlugins
public java.util.Hashtable<java.lang.String,AuthzMgrPlugin> getPlugins()
Description copied from interface:IAuthzSubsystemGet a hashtable containing all authentication plugins.- Specified by:
getPluginsin interfaceIAuthzSubsystem- Returns:
- all authentication plugins.
-
getInstances
public java.util.Hashtable<java.lang.String,AuthzManagerProxy> getInstances()
Description copied from interface:IAuthzSubsystemGet a hashtable containing all authentication instances.- Specified by:
getInstancesin interfaceIAuthzSubsystem- Returns:
- all authentication instances.
-
getConfigStore
public IConfigStore getConfigStore()
Returns the root configuration storage of this system.- Specified by:
getConfigStorein interfaceISubsystem- Returns:
- configuration store of this subsystem
-
getAuthzManager
public IAuthzManager getAuthzManager(java.lang.String name)
gets the named authorization manager- Specified by:
getAuthzManagerin interfaceIAuthzSubsystem- Parameters:
name- of the authorization manager- Returns:
- the named authorization manager
-
checkRealm
public void checkRealm(java.lang.String realm, IAuthToken authToken, java.lang.String owner, java.lang.String resource, java.lang.String operation) throws EBaseExceptionDescription copied from interface:IAuthzSubsystemAuthorize the user against the specified realm. Looks for authz manager associated with the plugin and authenticates if present.- Specified by:
checkRealmin interfaceIAuthzSubsystemowner- TODO- Throws:
EBaseException- if any error occurs during authentication.
-
getAuthzManagerNameByRealm
public java.lang.String getAuthzManagerNameByRealm(java.lang.String realm) throws EAuthzUnknownRealmDescription copied from interface:IAuthzSubsystemGiven a realm name, return the name of an authz manager for that realm.- Specified by:
getAuthzManagerNameByRealmin interfaceIAuthzSubsystem- Throws:
EAuthzUnknownRealm- if no authz manager is found.
-
-