com.ibm.commerce.me.commands
Class AuthenticationHelperCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.me.commands.AuthenticationHelperCmdImpl
All Implemented Interfaces:
AuthenticationHelperCmd, ECCommand, ECTargetableCommand, TaskCommand

public class AuthenticationHelperCmdImpl
extends TaskCommandImpl
implements AuthenticationHelperCmd

This command will be invoked by the B2BLogon command to authenticate a b2b buyer. Before invoking this command the caller has to set the following parameters.

    setLogonMode
    setBuyerCredentials
    setMarketPlaceBuyerCredentials
    setSupplierCredentilas
    setUpdateFlag

After this command is executed, the following methods can be invoked to get the results of command execution.

    isValidCredentials
    getErrorCode
    getBuyerId
    getSupplierId
Creation date: (4/24/01 7:18:48 PM)
See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.me.commands. AuthenticationHelperCmd
defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
AuthenticationHelperCmdImpl()
           
 
Method Summary
protected  boolean checkCredentials(int authLevel)
          verify the buyer and supplier credentials given by the buyer depending upon the mode of authentication This calls either the DBProcurementAuthenticationCmd (default), LdapAuthenticationCmd, or the ThirdPartyB2BAuthCmd to verify the credential.
 int getAuthType()
          Gets the authentication type
  Credentials getBuyerCredentials()
          Gets the buyer credential information which stores the buyer organizations code, code type, user id and password
 long getBuyerId()
          If the isValidCredentilas() returns true (ie.
 int getErrorCode()
          If the isValidCredentilas() returns false (ie.
  SessionInfo getSessionInfo()
          get the userId (registered requisitioner id)
  Credentials getSupplierCredentials()
          Gets the supplier credential information which stores the supplier organizations code, code type, user id and password
 long getSupplierId()
          If the isValidCredentilas() returns true (ie.
 boolean isValidCredentials()
          After the task commands are executed, a boolean result flag will be set to indicate if the authentication was successful.
 void performExecute()
          The business logic for this task command.
 void setAuthType(int anAuthType)
          Sets the authentication type
 void setBuyerCredentials( Credentials buyerCredentials)
          Sets the buyer credentials under which the current B2B user wishes to logon.
 void setLogonMode(short logonMode)
          Sets the logon mode
 void setMarketPlaceBuyerCredentials( Credentials mpBuyerCredentials)
          In case the buyer comes from a marketplace and wants to be authenticated against the marketplace credentials, use this method.
 void setProtocolId(java.lang.Integer aProtocolId)
          Sets the protocol id
 void setSessionInfo( SessionInfo sessionInfo)
          Sets the sessionInfo (information pertaining to requisitioner registration)
 void setSupplierCredentials( Credentials supplierCredentials)
          Sets the supplier credentials for the store to which the buyer want to connect.
 void setUpdateFlag()
          This method is called to indicate instead of performing verification of the credentials, the credentials should be set in the database.
protected  java.lang.Long validateBuyerGroupLogonCredentials()
          Check whether the buyer credential information is valid.
 void validateParameters()
          Check whether all the required parameters are available forauthentication.
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
See Also:
Constant Field Values
Constructor Detail

AuthenticationHelperCmdImpl

public AuthenticationHelperCmdImpl()
Method Detail

checkCredentials

protected boolean checkCredentials(int authLevel)
                            throws ECException
verify the buyer and supplier credentials given by the buyer depending upon the mode of authentication This calls either the DBProcurementAuthenticationCmd (default), LdapAuthenticationCmd, or the ThirdPartyB2BAuthCmd to verify the credential.
Returns:
true if the credentials are valid
Throws:
ECException - Raised by the authentication command

getAuthType

public int getAuthType()
Gets the authentication type
Returns:
the authentication type

getBuyerCredentials

public Credentials getBuyerCredentials()
Gets the buyer credential information which stores the buyer organizations code, code type, user id and password
Specified by:
getBuyerCredentials in interface AuthenticationHelperCmd
Returns:
the buyer credential information

getBuyerId

public long getBuyerId()
If the isValidCredentilas() returns true (ie. if the command is successful) then this method can be called to get the buyer organization id.
Specified by:
getBuyerId in interface AuthenticationHelperCmd
Returns:
the id of the buyer organization.

getErrorCode

public int getErrorCode()
If the isValidCredentilas() returns false (ie. if authentication failed) then this method can be called to get the error code. This is required because in the B2B scenario we need to know what is the exact reason for which athentication failed.
Specified by:
getErrorCode in interface AuthenticationHelperCmd
Returns:
a code indicating the error status

getSessionInfo

public SessionInfo getSessionInfo()
get the userId (registered requisitioner id)
Specified by:
getSessionInfo in interface AuthenticationHelperCmd
Returns:
long userId public long getUsersId() { return this.userId; } /** Gets the sessionInfo (information pertaining to requisitioner registration)

getSupplierCredentials

public Credentials getSupplierCredentials()
Gets the supplier credential information which stores the supplier organizations code, code type, user id and password
Specified by:
getSupplierCredentials in interface AuthenticationHelperCmd
Returns:
the supplier credential information

getSupplierId

public long getSupplierId()
If the isValidCredentilas() returns true (ie. if the command is successful) then this method can be called to get the supplier organization id.
Specified by:
getSupplierId in interface AuthenticationHelperCmd
Returns:
the id of the supplier organization.

isValidCredentials

public boolean isValidCredentials()
After the task commands are executed, a boolean result flag will be set to 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 AuthenticationHelperCmd
Returns:
true if authentication was successful, fase if otherwise

performExecute

public void performExecute()
                    throws ECException
The business logic for this task command. To see the details of the logic see the comments for the class.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException. - Raised if checkCredentails() catchs any exception
ECException

setAuthType

public void setAuthType(int anAuthType)
Sets the authentication type
Specified by:
setAuthType in interface AuthenticationHelperCmd

setBuyerCredentials

public void setBuyerCredentials(Credentials buyerCredentials)
Sets the buyer credentials under which the current B2B user wishes to logon.
Specified by:
setBuyerCredentials in interface AuthenticationHelperCmd
Parameters:
buyerCredentials - the buyer credential

setLogonMode

public void setLogonMode(short logonMode)
Sets the logon mode
Specified by:
setLogonMode in interface AuthenticationHelperCmd
Parameters:
logonMode - the new logon mode

setMarketPlaceBuyerCredentials

public void setMarketPlaceBuyerCredentials(Credentials mpBuyerCredentials)
In case the buyer comes from a marketplace and wants to be authenticated against the marketplace credentials, use this method. This methode will set the marketplace buyer credentials under which the current B2B user wishes to logon.
Specified by:
setMarketPlaceBuyerCredentials in interface AuthenticationHelperCmd
Parameters:
mpBuyerCredentials - the marketspace buyer credential

setProtocolId

public void setProtocolId(java.lang.Integer aProtocolId)
Sets the protocol id
Specified by:
setProtocolId in interface AuthenticationHelperCmd
Parameters:
aProtocolId - the protocol id

setSessionInfo

public void setSessionInfo(SessionInfo sessionInfo)
Sets the sessionInfo (information pertaining to requisitioner registration)
Specified by:
setSessionInfo in interface AuthenticationHelperCmd
Parameters:
sessionInfo - the session information pertaining to requisitioner registration

setSupplierCredentials

public void setSupplierCredentials(Credentials supplierCredentials)
Sets the supplier credentials for the store to which the buyer want to connect.
Specified by:
setSupplierCredentials in interface AuthenticationHelperCmd
Parameters:
supplierCredentials - the supplier credential

setUpdateFlag

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

validateBuyerGroupLogonCredentials

protected java.lang.Long validateBuyerGroupLogonCredentials()
                                                     throws ECException
Check whether the buyer credential information is valid. This method calls LogonCmd to verify the credential information.
Returns:
The wcs user id mapped to the set of credential information
Throws:
ECException - Raised with message _ERR_PROCUREMENT_INVALID_CREDENTIAL if LogonCmd raise an exception

validateParameters

public void validateParameters()
                        throws ECException
Check whether all the required parameters are available forauthentication. To see which all parameters are required for each authentication level see the comment for the class. The checking inclues: 1. buyer credential is not null and containg non empty code and code domain
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_PROCUREMENT_INVALID_CREDENTIAL if the check for buyer credential fails