com.ibm.commerce.security.commands
Class LogonCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.security.commands.LogonCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, LogonCmd, Protectable

public class LogonCmdImpl
extends ControllerCommandImpl
implements LogonCmd

This controller command will log the user into the system. If the user is logging in from a guest shopper identity then the resources that exist under the guest shopper identity is migrated to the identity to which the user is logging in.

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

		setLogonId
		setPassword
		setReLogonURL
		setPostLogonURL
 

Upon successful authentication the user is redirected to the URL specified by the setPostLogonURL. Upon unsuccessful authentication the user is redirected to the URL specified by setReLogonURL.


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String ERRTASK_NAME
           
 
Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.security.commands.LogonCmd
defaultCommandClassName, NAME
 
Constructor Summary
LogonCmdImpl()
           
 
Method Summary
 java.lang.String getAuthenticateUserId()
          Retrieves the user ID of the logged in user.
protected  java.lang.String getLogonId()
          Retrieves the logon ID under which the current user wishes to logon.
protected  java.lang.String getLogonPassword()
          Retrieves the password to be used for authentication with the new logon ID.
protected  java.lang.String getPostLogonURL()
          Retrieves the URL to w which the user should be redirected to after successful authentication.
protected  java.lang.String getReLogonURL()
          Retrieves the URL to which the user should be redirected to if authentication was unsuccessful.
protected  boolean isAccountDisabled()
           
 boolean isGeneric()
          Check to see if this is a generic command.
protected  boolean isLogonAllowedNow()
           
protected  boolean isValidCredentials()
          Based on the configuration parameters in the WCS configuration file, one of three authentication task will be called.
protected  void migrateUserEntries()
          This method will migrate 'resources' belonging to the current user to the identity, associated with the logon ID, which the user will be assuming once the logon is successful.
 void performExecute()
          Contains the actual business logic of the command It should be implemented by all the command writer.
 void setLogonId(java.lang.String strLogonId)
          Sets the logon ID under which the current user wishes to logon.
 void setLogonPassword(java.lang.String strPassword)
          Sets the password to be used for authentication with the new logon ID.
 void setPostLogonURL(java.lang.String strPostLoginURL)
          Sets the URL to which the user should be redirected after successful authentication.
 void setReLogonURL(java.lang.String strReLoginURL)
          Sets the URL to which the user should be redirected to if authentication was unsuccessful.
 void setRequestProperties(TypedProperty hshReqParameters)
          The WebController calls this method before invoking the execute method in this command to set the request properties for this command.
protected  void updateCmdContext()
          Switches the current user identity to the identity associated with the LoginID supplied to this Logon command.
 void updateLockoutInformation(boolean valid_credentials)
           
 void validateParameters()
          Performs server side parameter checking.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME
Constructor Detail

LogonCmdImpl

public LogonCmdImpl()
Method Detail

getAuthenticateUserId

public java.lang.String getAuthenticateUserId()
Description copied from interface: LogonCmd
Retrieves the user ID of the logged in user.
Specified by:
getAuthenticateUserId in interface LogonCmd
Following copied from interface: com.ibm.commerce.security.commands.LogonCmd
Returns:
The user ID.

getLogonId

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

getLogonPassword

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

getPostLogonURL

protected java.lang.String getPostLogonURL()
Retrieves the URL to w which the user should be redirected to after successful authentication.
Returns:
The post login URL.

getReLogonURL

protected java.lang.String getReLogonURL()
Retrieves the URL to which the user should be redirected to if authentication was unsuccessful.
Returns:
The relogin login URL.

isAccountDisabled

protected boolean isAccountDisabled()
                             throws ECSystemException

isGeneric

public boolean isGeneric()
Description copied from interface: ControllerCommand
Check to see if this is a generic command. A generic command is a command that can be invoked by a generic user. The default is false for all controller commands and true for all view commands.
Specified by:
isGeneric in interface ControllerCommand
Overrides:
isGeneric in class ControllerCommandImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Returns:
boolean - true if this command can be called by a generic user - false if this command cannot be called by a generic user

isLogonAllowedNow

protected boolean isLogonAllowedNow()

isValidCredentials

protected boolean isValidCredentials()
                              throws ECException
Based on the configuration parameters in the WCS configuration file, one of three authentication task will be called. The three authentication task, include two pre-setup task. The first presetup task will authenticate the user against the WCS DB, while the second will authenticate the user against LDAP. The third task is left to customers to implement such that third party authentication schemes can be supported.
Returns:
Returns true if authentication is successful, false otherwise.

migrateUserEntries

protected void migrateUserEntries()
                           throws ECException
This method will migrate 'resources' belonging to the current user to the identity, associated with the logon ID, which the user will be assuming once the logon is successful. The resources to be migrated include addresses, current orders, order items, orders, order templates, and shopping cart entries.

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 AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

setLogonId

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

setLogonPassword

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

setPostLogonURL

public void setPostLogonURL(java.lang.String strPostLoginURL)
Description copied from interface: LogonCmd
Sets the URL to which the user should be redirected after successful authentication.
Specified by:
setPostLogonURL in interface LogonCmd
Following copied from interface: com.ibm.commerce.security.commands.LogonCmd
Parameters:
strPostLoginURL - The post login URL.

setReLogonURL

public void setReLogonURL(java.lang.String strReLoginURL)
Description copied from interface: LogonCmd
Sets the URL to which the user should be redirected to if authentication was unsuccessful.
Specified by:
setReLogonURL in interface LogonCmd
Following copied from interface: com.ibm.commerce.security.commands.LogonCmd
Parameters:
strReLoginURL - The relogin login URL.

setRequestProperties

public void setRequestProperties(TypedProperty hshReqParameters)
                          throws ECApplicationException
Description copied from interface: ControllerCommand
The WebController calls this method before invoking the execute method in this command to set the request properties for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -  

updateCmdContext

protected void updateCmdContext()
                         throws ECException
Switches the current user identity to the identity associated with the LoginID supplied to this Logon command.

updateLockoutInformation

public void updateLockoutInformation(boolean valid_credentials)
                              throws ECException

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 AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -