com.ibm.commerce.security.commands
Class AuthenticationPolicyCmdImpl

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

public class AuthenticationPolicyCmdImpl
extends TaskCommandImpl
implements AuthenticationPolicyCmd

Use this task command to enforce policies such as minimum password length. This task command is called by every command that performs verification or update of a user credentials.

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

		setLogonId
		setPassword
 


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.AuthenticationPolicyCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Constructor Summary
AuthenticationPolicyCmdImpl()
           
 
Method Summary
protected  void analyzePassword()
          Loads the password rules which will be used to validate the user's new password.
protected  java.lang.String getLogonId()
          Retrieves the logon ID of the current user.
protected  java.lang.String getPassword()
          Retrieves the password to be used for verification against the password policy.
 boolean isPasswordCompliant()
          After this task is executed, you can call this function to determine whether the user had a password policy and if the supplied password complies with that policy.
protected  boolean isPreviousPasswordDifferent()
          Determines whether the password supplied matches the user's previous password.
protected  boolean isUserIDDissimilar()
          Determines whether the password supplied matches the current user's logonID.
protected  boolean isValidConsecutiveCharacters()
          Determines whether the password supplied complies with the maximum number of consecutive characters allowed as specified by the password policy for this user.
protected  boolean isValidMaximumCharacters()
          Determines whether the password supplied complies with the minimum number of digits requirements as specified by the password policy for this user.
protected  boolean isValidMinimumDigits()
          Determines whether the password supplied complies with the minimum number of digits requirements as specified by the password policy for this user.
protected  boolean isValidMinimumLength()
          Determines whether the password supplied complies with the minimum password length requirements as specified by the password policy for this user.
protected  boolean isValidMinimumLetters()
          Determines whether the password supplied has the minimum of letters as specified by the password policy for this user.
protected  boolean loadUserPasswordPolicy()
          Loads the password rules which will be used to check the user's new password.
 void performExecute()
          Contains the actual business logic of the command It should be implemented by all the command writer.
 void setAccountPolicy(java.lang.String strDefinedAccountPolicy)
          Sets the account policy to be used to check this password.
 void setErrorTask(java.lang.String strErrorTask)
          This function allows for the default error view task of the command to be overwritten.
 void setLogonId(java.lang.String strLogonId)
          Sets the logon ID under which the current user wishes to logon.
 void setPassword(java.lang.String strPassword)
          Sets the password to be used for authentication with the new logon ID.
 void validateParameters()
          Performs server side parameter checking.
protected  void validatePasswordCompliance()
          Checks that the Password complies with the rules defined by the authentication policy for this user.
 
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 java.lang.String ERRTASK_NAME
Constructor Detail

AuthenticationPolicyCmdImpl

public AuthenticationPolicyCmdImpl()
Method Detail

analyzePassword

protected void analyzePassword()
Loads the password rules which will be used to validate the user's new password.

getLogonId

protected java.lang.String getLogonId()
Retrieves the logon ID of the current user.
Returns:
The logon ID.

getPassword

protected java.lang.String getPassword()
Retrieves the password to be used for verification against the password policy.
Returns:
The Password.

isPasswordCompliant

public boolean isPasswordCompliant()
After this task is executed, you can call this function to determine whether the user had a password policy and if the supplied password complies with that policy. If the user had a password policy and there was non-compliance then an exception is thrown.
Specified by:
isPasswordCompliant in interface AuthenticationPolicyCmd
Returns:
True if password complies with the user's password policy.

isPreviousPasswordDifferent

protected boolean isPreviousPasswordDifferent()
Determines whether the password supplied matches the user's previous password.
Returns:
True if password does not match the user's previous password.

isUserIDDissimilar

protected boolean isUserIDDissimilar()
Determines whether the password supplied matches the current user's logonID.
Returns:
True if password does not match the current user's LogonID.

isValidConsecutiveCharacters

protected boolean isValidConsecutiveCharacters()
Determines whether the password supplied complies with the maximum number of consecutive characters allowed as specified by the password policy for this user.
Returns:
True if password complies with the policy.

isValidMaximumCharacters

protected boolean isValidMaximumCharacters()
Determines whether the password supplied complies with the minimum number of digits requirements as specified by the password policy for this user.
Returns:
True if password has at least the minimum number of digits.

isValidMinimumDigits

protected boolean isValidMinimumDigits()
Determines whether the password supplied complies with the minimum number of digits requirements as specified by the password policy for this user.
Returns:
True if password has at least the minimum number of digits.

isValidMinimumLength

protected boolean isValidMinimumLength()
Determines whether the password supplied complies with the minimum password length requirements as specified by the password policy for this user.
Returns:
True if password is at least the minimum length.

isValidMinimumLetters

protected boolean isValidMinimumLetters()
Determines whether the password supplied has the minimum of letters as specified by the password policy for this user.
Returns:
True if password has at least the minimum number of letters.

loadUserPasswordPolicy

protected boolean loadUserPasswordPolicy()
                                  throws ECException
Loads the password rules which will be used to check the user's new password.
Returns:
True is the user's password policy was successfully loaded.

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.

setAccountPolicy

public void setAccountPolicy(java.lang.String strDefinedAccountPolicy)
Description copied from interface: AuthenticationPolicyCmd
Sets the account policy to be used to check this password. This overrides the default account policy for the user.
Specified by:
setAccountPolicy in interface AuthenticationPolicyCmd
Following copied from interface: com.ibm.commerce.security.commands.AuthenticationPolicyCmd
Parameters:
strDefinedAccountPolicy - The account policy.

setErrorTask

public void setErrorTask(java.lang.String strErrorTask)
Description copied from interface: AuthenticationPolicyCmd
This function allows for the default error view task of the command to be overwritten.
Specified by:
setErrorTask in interface AuthenticationPolicyCmd
Following copied from interface: com.ibm.commerce.security.commands.AuthenticationPolicyCmd
Parameters:
strErrorTask - The name of the new error view task.

setLogonId

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

setPassword

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

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. -  

validatePasswordCompliance

protected void validatePasswordCompliance()
                                   throws ECApplicationException
Checks that the Password complies with the rules defined by the authentication policy for this user.