com.ibm.commerce.security.commands
Class DBAuthenticationCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.security.commands.DBAuthenticationCmdImpl
All Implemented Interfaces:
DBAuthenticationCmd, ECCommand, TaskCommand

public class DBAuthenticationCmdImpl
extends TaskCommandImpl
implements DBAuthenticationCmd

If the server is configured to authenticate against the database, this task command will be called to perform either authentication or an update.

Before executing this task command, the methods listed below must be invoked.

 		setEnciphereMerchantKey or setMerchantKey
		setLogonId
		setPassword
 

If the setUpdateFlag is called, then upon execution of this task command, the credentials set are updated in the database.

If the setUpdateFlag is not called, upon execution of this task command, verification of the credentials is performed. To determine whether the authentication was successful, call isValidCredentials.

Error View Task: DBAuthenticationErrorView


Field Summary
static java.lang.String ERRTASK_NAME
           
 
Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.security.commands.DBAuthenticationCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Constructor Summary
DBAuthenticationCmdImpl()
           
 
Method Summary
protected static byte[] formatPassword(byte[] bytePassword)
          Formats the password such that it in a common format across databases and operating systems.
protected  java.lang.String getLogonId()
          Retrieve the logon ID under which the current user wishes to logon.
protected  java.lang.String getMerchantKey()
          Retrieves the merchant key to be used in the authentication process.
protected  java.lang.String getPassword()
          Retrieves the password to be used for authentication with the new logon ID.
protected  boolean isPasswordTemporary()
          Indicates whether the password is temporary.
protected  boolean isUpdatePending()
          Indicates whether the password should be verified against an existing one in the database or if the password should be updated in the database.
 boolean isValidCredentials()
          Sets a boolean result flag indicate if the authentication was successful.
 void markPasswordAsTemporary()
          Call this method to indicate that the updated password is temporary.
 void performExecute()
          Contains the actual business logic of the command It should be implemented by all the command writer.
 void performOneWayHashAuthentication()
          Computes the one-way hash of the password.
 void performReversibleAuthentication()
          Encrypts the plaintext password.
 void setEncipheredMerchantKey(java.lang.String strEncipheredMerchantKey)
          Sets the enciphered merchant key to be used in the encryption of the password.
 void setLogonId(java.lang.String strLogonId)
          Sets the logon ID under which the current user wishes to logon.
 void setMerchantKey(java.lang.String strMerchantKey)
          Sets the merchant key to be used in the encryption of the password.
 void setPassword(java.lang.String strPassword)
          Sets the password to be used for authentication with the new logon ID.
 void setUpdateFlag()
          This method is called to indicate that instead of performing verification of the credentials, the credentials should be set in the database.
 void validateParameters()
          Performs server side parameter checking.
 
Methods inherited from class com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

Field Detail

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME
Constructor Detail

DBAuthenticationCmdImpl

public DBAuthenticationCmdImpl()
Method Detail

formatPassword

protected static byte[] formatPassword(byte[] bytePassword)
Formats the password such that it in a common format across databases and operating systems.
Returns:
The formatted password.

getLogonId

protected java.lang.String getLogonId()
Retrieve the logon ID under which the current user wishes to logon.
Returns:
The logon ID.

getMerchantKey

protected java.lang.String getMerchantKey()
Retrieves the merchant key to be used in the authentication process.
Returns:
The merchant key.

getPassword

protected java.lang.String getPassword()
Retrieves the password to be used for authentication with the new logon ID.
Returns:
The password.

isPasswordTemporary

protected boolean isPasswordTemporary()
Indicates whether the password is temporary.
Returns:
True if password temporary.

isUpdatePending

protected boolean isUpdatePending()
Indicates whether the password should be verified against an existing one in the database or if the password should be updated in the database.
Returns:
True if password should be updated in the database.

isValidCredentials

public boolean isValidCredentials()
Description copied from interface: DBAuthenticationCmd
Sets a boolean result flag indicate if the authentication was successful. This method will return the this result flag to indicate if the authentication was successful.
Specified by:
isValidCredentials in interface DBAuthenticationCmd
Following copied from interface: com.ibm.commerce.security.commands.DBAuthenticationCmd
Returns:
True if authentication was successful.

markPasswordAsTemporary

public void markPasswordAsTemporary()
Description copied from interface: DBAuthenticationCmd
Call this method to indicate that the updated password is temporary.
Specified by:
markPasswordAsTemporary in interface DBAuthenticationCmd

performExecute

public void performExecute()
                    throws ECException
Description copied from interface: ECCommand
Contains the actual business logic of the command It should be implemented by all the command writer.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

performOneWayHashAuthentication

public void performOneWayHashAuthentication()
                                     throws ECException
Computes the one-way hash of the password.

performReversibleAuthentication

public void performReversibleAuthentication()
                                     throws ECException
Encrypts the plaintext password.

setEncipheredMerchantKey

public void setEncipheredMerchantKey(java.lang.String strEncipheredMerchantKey)
Description copied from interface: DBAuthenticationCmd
Sets the enciphered merchant key to be used in the encryption of the password. This command task will implicitly decrypt the enciphered merchant key. This should only be set if the merchant key was not set.
Specified by:
setEncipheredMerchantKey in interface DBAuthenticationCmd
Following copied from interface: com.ibm.commerce.security.commands.DBAuthenticationCmd
Parameters:
strEncipheredMerchantKey - The enciphered merchant key.

setLogonId

public void setLogonId(java.lang.String strLogonId)
Description copied from interface: DBAuthenticationCmd
Sets the logon ID under which the current user wishes to logon.
Specified by:
setLogonId in interface DBAuthenticationCmd
Following copied from interface: com.ibm.commerce.security.commands.DBAuthenticationCmd
Parameters:
strLogonID - The logon ID.

setMerchantKey

public void setMerchantKey(java.lang.String strMerchantKey)
Description copied from interface: DBAuthenticationCmd
Sets the merchant key to be used in the encryption of the password. This should only be set if an enciphered merchant key was not set.
Specified by:
setMerchantKey in interface DBAuthenticationCmd
Following copied from interface: com.ibm.commerce.security.commands.DBAuthenticationCmd
Parameters:
strMerchantKey - The merchant key.

setPassword

public void setPassword(java.lang.String strPassword)
Description copied from interface: DBAuthenticationCmd
Sets the password to be used for authentication with the new logon ID.
Specified by:
setPassword in interface DBAuthenticationCmd
Following copied from interface: com.ibm.commerce.security.commands.DBAuthenticationCmd
Parameters:
strPassword - The password.

setUpdateFlag

public void setUpdateFlag()
Description copied from interface: DBAuthenticationCmd
This method is called to indicate that instead of performing verification of the credentials, the credentials should be set in the database.
Specified by:
setUpdateFlag in interface DBAuthenticationCmd

validateParameters

public void validateParameters()
                        throws ECException
Description copied from interface: ECCommand
Performs server side parameter checking. This method replaces the checkParameters() method in a previous version of the code.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -