com.netscape.cms.authentication
Class HashAuthentication

java.lang.Object
  extended by com.netscape.cms.authentication.HashAuthentication
All Implemented Interfaces:
IAuthManager, IExtendedPluginInfo

public class HashAuthentication
extends java.lang.Object
implements IAuthManager, IExtendedPluginInfo

Hash uid/pwd directory based authentication manager

Version:
$Revision: 1211 $, $Date: 2010-08-18 10:15:37 -0700 (Wed, 18 Aug 2010) $

Field Summary
static java.lang.String CRED_FINGERPRINT
           
static java.lang.String CRED_HOST
           
static java.lang.String CRED_PAGEID
           
static java.lang.String CRED_UID
           
static long DEFAULT_TIMEOUT
           
protected static java.lang.String[] mRequiredCreds
           
static java.lang.String SALT
           
 
Fields inherited from interface com.netscape.certsrv.authentication.IAuthManager
CRED_CERT_SERIAL_TO_REVOKE, CRED_HOST_NAME, CRED_SESSION_ID, CRED_SSL_CLIENT_CERT
 
Fields inherited from interface com.netscape.certsrv.base.IExtendedPluginInfo
HELP_TEXT, HELP_TOKEN
 
Constructor Summary
HashAuthentication()
          Default constructor, initialization must follow.
 
Method Summary
 void addAuthToken(java.lang.String pageID, IAuthToken token)
           
 IAuthToken authenticate(IAuthCredentials authCreds)
          Authenticates a user based on uid, pwd in the directory.
 void createEntry(java.lang.String host, java.lang.String dn, long timeout, java.lang.String secret, long lastLogin)
           
 void deleteToken(java.lang.String pageID)
           
 void disable(java.lang.String hostname)
           
 java.lang.String getAgentName(java.lang.String hostname)
           
 IAuthToken getAuthToken(java.lang.String key)
           
 java.lang.String[] getConfigParams()
          Returns a list of configuration parameter names.
 IConfigStore getConfigStore()
          Gets the configuration substore used by this authentication manager
 HashAuthData getData()
           
 java.lang.String[] getExtendedPluginInfo(java.util.Locale locale)
          This method returns an array of strings.
 java.util.Enumeration getHosts()
           
 java.lang.String getImplName()
          gets the plugin name of this authentication manager.
 long getLastLogin(java.lang.String hostname)
           
 java.lang.String getName()
          gets the name of this authentication manager instance
 long getPageID()
           
 java.lang.String[] getRequiredCreds()
          Returns array of required credentials for this authentication manager.
 java.lang.String getSecret(java.lang.String hostname)
           
 long getTimeout(java.lang.String hostname)
           
 java.lang.String hashFingerprint(java.lang.String host, java.lang.String pageID, java.lang.String uid)
           
 void init(java.lang.String name, java.lang.String implName, IConfigStore config)
          Initialize this authentication manager.
 boolean isEnable(java.lang.String hostname)
           
 void log(int level, java.lang.String msg)
           
 void setAgentName(java.lang.String hostname, java.lang.String agentName)
           
 void setLastLogin(java.lang.String hostname, long lastlogin)
           
 void setSecret(java.lang.String hostname, java.lang.String secret)
           
 void setTimeout(java.lang.String hostname, long timeout)
           
 void shutdown()
          Prepare this authentication manager for a shutdown.
 boolean validFingerprint(java.lang.String host, java.lang.String pageID, java.lang.String uid, java.lang.String fingerprint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SALT

public static final java.lang.String SALT
See Also:
Constant Field Values

CRED_UID

public static final java.lang.String CRED_UID
See Also:
Constant Field Values

CRED_FINGERPRINT

public static final java.lang.String CRED_FINGERPRINT
See Also:
Constant Field Values

CRED_PAGEID

public static final java.lang.String CRED_PAGEID
See Also:
Constant Field Values

CRED_HOST

public static final java.lang.String CRED_HOST
See Also:
Constant Field Values

mRequiredCreds

protected static java.lang.String[] mRequiredCreds

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

HashAuthentication

public HashAuthentication()
Default constructor, initialization must follow.

Method Detail

init

public void init(java.lang.String name,
                 java.lang.String implName,
                 IConfigStore config)
          throws EBaseException
Description copied from interface: IAuthManager
Initialize this authentication manager.

Specified by:
init in interface IAuthManager
Parameters:
name - The name of this authentication manager instance.
implName - The name of the authentication manager plugin.
config - The configuration store for this authentication manager.
Throws:
EBaseException - If an initialization error occurred.

getAuthToken

public IAuthToken getAuthToken(java.lang.String key)

addAuthToken

public void addAuthToken(java.lang.String pageID,
                         IAuthToken token)

deleteToken

public void deleteToken(java.lang.String pageID)

getData

public HashAuthData getData()

createEntry

public void createEntry(java.lang.String host,
                        java.lang.String dn,
                        long timeout,
                        java.lang.String secret,
                        long lastLogin)

disable

public void disable(java.lang.String hostname)

getAgentName

public java.lang.String getAgentName(java.lang.String hostname)

setAgentName

public void setAgentName(java.lang.String hostname,
                         java.lang.String agentName)

isEnable

public boolean isEnable(java.lang.String hostname)

getTimeout

public long getTimeout(java.lang.String hostname)

setTimeout

public void setTimeout(java.lang.String hostname,
                       long timeout)

getSecret

public java.lang.String getSecret(java.lang.String hostname)

setSecret

public void setSecret(java.lang.String hostname,
                      java.lang.String secret)

getLastLogin

public long getLastLogin(java.lang.String hostname)

setLastLogin

public void setLastLogin(java.lang.String hostname,
                         long lastlogin)

getPageID

public long getPageID()

log

public void log(int level,
                java.lang.String msg)

validFingerprint

public boolean validFingerprint(java.lang.String host,
                                java.lang.String pageID,
                                java.lang.String uid,
                                java.lang.String fingerprint)

getHosts

public java.util.Enumeration getHosts()

hashFingerprint

public java.lang.String hashFingerprint(java.lang.String host,
                                        java.lang.String pageID,
                                        java.lang.String uid)

shutdown

public void shutdown()
Description copied from interface: IAuthManager
Prepare this authentication manager for a shutdown. Called when the server is exiting for any cleanup needed.

Specified by:
shutdown in interface IAuthManager

authenticate

public IAuthToken authenticate(IAuthCredentials authCreds)
                        throws EBaseException
Authenticates a user based on uid, pwd in the directory.

Specified by:
authenticate in interface IAuthManager
Parameters:
authCreds - The authentication credentials.
Returns:
The user's ldap entry dn.
Throws:
EInvalidCredentials - If the uid and password are not valid
EBaseException - If an internal error occurs.

getRequiredCreds

public java.lang.String[] getRequiredCreds()
Returns array of required credentials for this authentication manager.

Specified by:
getRequiredCreds in interface IAuthManager
Returns:
Array of required credentials.

getConfigStore

public IConfigStore getConfigStore()
Gets the configuration substore used by this authentication manager

Specified by:
getConfigStore in interface IAuthManager
Returns:
configuration store

getName

public java.lang.String getName()
gets the name of this authentication manager instance

Specified by:
getName in interface IAuthManager
Returns:
the name of this authentication manager.

getImplName

public java.lang.String getImplName()
gets the plugin name of this authentication manager.

Specified by:
getImplName in interface IAuthManager
Returns:
the name of the authentication manager plugin.

getExtendedPluginInfo

public java.lang.String[] getExtendedPluginInfo(java.util.Locale locale)
Description copied from interface: IExtendedPluginInfo
This method returns an array of strings. Each element of the array represents a configurable parameter, or some other meta-info (such as help-token) there is an entry indexed on that parameter name ;[,required];;... Where: type_info is either 'string', 'number', 'boolean', 'password' or 'choice(ch1,ch2,ch3,...)' If the marker 'required' is included after the type_info, the parameter will has some visually distinctive marking in the UI. 'description' is a short sentence describing the parameter 'choice' is rendered as a drop-down list. The first parameter in the list will be activated by default 'boolean' is rendered as a checkbox. The resulting parameter will be either 'true' or 'false' 'string' allows any characters 'number' allows only numbers 'password' is rendered as a password field (the characters are replaced with *'s when being types. This parameter is not passed through to the plugin. It is instead inserted directly into the password cache keyed on the instance name. The value of the parameter 'bindPWPrompt' (see example below) is set to the key. In addition to the configurable parameters, the following magic parameters may be defined: HELP_TOKEN;helptoken - a pointer to the online manual section for this plugin HELP_TEXT;helptext - a general help string describing the plugin For example: "username;string;The username you wish to login as" "bindPWPrompt;password;Enter password to bind as above user with" "algorithm;choice(RSA,DSA);Which algorithm do you want to use" "enable;boolean;Do you want to run this plugin" "port;number;Which port number do you want to use"

Specified by:
getExtendedPluginInfo in interface IExtendedPluginInfo

getConfigParams

public java.lang.String[] getConfigParams()
Returns a list of configuration parameter names. The list is passed to the configuration console so instances of this implementation can be configured through the console.

Specified by:
getConfigParams in interface IAuthManager
Returns:
String array of configuration parameter names.