Xindice API

org.apache.xindice.core.security
Class LocalSecurityManager

java.lang.Object
  |
  +--org.apache.xindice.core.security.LocalSecurityManager
All Implemented Interfaces:
Configurable, DBSecurityManager, Named

public class LocalSecurityManager
extends java.lang.Object
implements DBSecurityManager

Implements security based off of configurations stored in the local database configuration.


Constructor Summary
LocalSecurityManager(Database db, boolean disabled)
          Initialize the security manager.
 
Method Summary
 Credentials authenticate(java.lang.String username, java.lang.String password)
          Authenticates the user and retrieves a credentials object for the provided username and password.
 void checkAccess(java.lang.String resource, int requestedAccess)
          Determines if the credentials retrieved from thread local storage are valid for accessing the specified resource.
 void checkAccess(java.lang.String resource, int requestedAccess, Credentials cred)
          Determines if the provided credentials are valid for accessing the specified resource.
 Configuration getConfig()
          getConfig retrieves the configuration information for the Configurable object instance.
 java.lang.String getName()
          getName retrieves the contextually important name of the object
 void logout()
          Removes any credentials associated with the current thread.
 void readConfig()
          Reads the ACL security configuration from the database.
 void setActive()
           
 void setConfig(Configuration config)
          setConfig sets the configuration information for the Configurable object instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalSecurityManager

public LocalSecurityManager(Database db,
                            boolean disabled)
Initialize the security manager. The security manager can not actually be used until readConfig() is called.
Parameters:
db - the Database instance associated with this manager
disabled - whether security should be enabled or not. true to disable.
Method Detail

getName

public java.lang.String getName()
getName retrieves the contextually important name of the object
Specified by:
getName in interface Named
Returns:
The object's name

checkAccess

public void checkAccess(java.lang.String resource,
                        int requestedAccess,
                        Credentials cred)
                 throws AccessDeniedException,
                        InvalidCredentialsException
Determines if the provided credentials are valid for accessing the specified resource.
Specified by:
checkAccess in interface DBSecurityManager
Parameters:
resource - The resource to check access for.
requestedAccess - The access level being requested.
cred - The credentials to use to authenticate
Throws:
AccessDeniedException - Thrown when access to the resource is denied.
InvalidCredentialsException - Thrown if the provided credentials are not valid.

checkAccess

public void checkAccess(java.lang.String resource,
                        int requestedAccess)
                 throws AccessDeniedException,
                        InvalidCredentialsException
Determines if the credentials retrieved from thread local storage are valid for accessing the specified resource.
Specified by:
checkAccess in interface DBSecurityManager
Parameters:
resource - The resource to check access for.
requestedAccess - The access level being requested.
cred - The credentials to use to authenticate
Throws:
AccessDeniedException - Thrown when access to the resource is denied.
InvalidCredentialsException - Thrown if the credentials retrieved from thread local storage are not valid.

authenticate

public Credentials authenticate(java.lang.String username,
                                java.lang.String password)
                         throws InvalidPasswordException,
                                UnknownUserException,
                                InvalidCredentialsException
Authenticates the user and retrieves a credentials object for the provided username and password. If an existing object can be found in the cache it will be returned otherwise a new Credentials instance will be created and returned. Cached objects are verified before being returned.
Specified by:
authenticate in interface DBSecurityManager
Parameters:
username - The username to authenticate
password - The password used to authenticate the user.
Throws:
InvalidPasswordException - Thrown when the password provided does not match for the username.
UnknownUserException - Thrown when the username can not be found.

logout

public void logout()
Removes any credentials associated with the current thread. Any further access by the thread will result in a InvalidCredentialsException being thrown.
Specified by:
logout in interface DBSecurityManager

setActive

public void setActive()
Specified by:
setActive in interface DBSecurityManager

readConfig

public void readConfig()
Reads the ACL security configuration from the database.
Specified by:
readConfig in interface DBSecurityManager

setConfig

public void setConfig(Configuration config)
setConfig sets the configuration information for the Configurable object instance.
Specified by:
setConfig in interface Configurable
Parameters:
config - The configuration Node

getConfig

public Configuration getConfig()
getConfig retrieves the configuration information for the Configurable object instance.
Specified by:
getConfig in interface Configurable
Returns:
The configuration Node

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation