Introduced in Feature Pack 3

Creating a CSV file with user password information

Introduced in Feature Pack 3 In this lesson, you create a new CSV file that contains the user password information to load into the WebSphere Commerce database.

About this task

Note: This tutorial demonstrates how to write a custom column handler and encrypt a clear text password by using the com.ibm.commerce.util.WCPasswordEncrypter class. It assumes that customers obtain password input (plain message text) from the external system by using their own encryption algorithm for password encryption and decryption. If you do not want to define clear text password information in a CSV file, you can use an alternative method to define user password information:
  • Export the user logon ID and encrypted password in the CSV file. Modify the PasswordHandler tutorial code to decrypt the encrypted user password before the WCPasswordEncrypter class is called to encrypt the user password information.
  • Create a custom data reader to read the user logon ID and password directly from the external system. By reading the ID and password directly you can ensure that no clear text or encrypted passwords are saved in a CSV file. Use the custom data reader to decrypt the user password by using your own algorithm. By combining the custom data reader with the customized PasswordHandler, you can securely load the user password into the database.

WebSphere Commerce DeveloperSample data is provided in the WCDE_installdir\components\foundation\samples\Dataload\Member\Person directory. In this step, you load the sample customer data into the USERREG database table. Then, load the corresponding password information into the database table separately after the customization is complete.

Procedure

  1. Apache DerbyEnsure that your WebSphere Commerce Server is stopped before you run the Data Load utility.
    For more information about stopping your server, see Starting and stopping WebSphere Commerce Test Server.
  2. Ensure that the Data Load environment configuration file in the member directory points to an existing store.
    1. Go to the following file:
      • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/Member/Person/wc-dataload.xml
      • WebSphere Commerce DeveloperWindowsWCDE_installdir\components\foundation\samples\DataLoad\Member\Person\wc-dataload.xml
    2. Locate the following snippet:
      
      	<_config:BusinessContext storeIdentifier="Madisons" 
      		languageId="-1" currency="USD">
      
      	</_config:BusinessContext>
      
    3. Ensure that the store associated with the storeIdentifier value exists. Either publish the Madisons starter store, or change the storeIdentifier value to Aurora:
      
      	<_config:BusinessContext storeIdentifier="Aurora" 
      		languageId="-1" currency="USD">
      
      	</_config:BusinessContext>
      
    4. Save your changes and close the file.
  3. To load the sample customer data into the USERREG database table, enter the following command:
    • SolarisLinuxAIX./dataload.sh ../components/foundation/samples/DataLoad/Member/Person/wc-dataload.xml
    • WebSphere Commerce DeveloperWindowsdataload ..\components\foundation\samples\DataLoad\Member\Person\wc-dataload.xml
  4. Verify the results of the data load:
    1. Review the Data Load utility summary report. For more information, see Verifying the results of the data load.
    2. Query the USERREG database table to verify that the data for the registered customers is loaded into the table.
      USERREG database table before customization
      Note: The values for the following columns are set to null:
      • LOGONPASSWORD
      • SALT
      After the customization is complete, the encrypted data for these columns is loaded into the database table.
  5. Create the WCDE_installdir\components\foundation\samples\Dataload\Member\Password directory.
  6. In this directory, create the MemberDataload_Password.csv file.
  7. Copy the following content into your MemberDataload_Password.csv file:
    logonId logonPassword
    jacobsmith shopper1
    ryanjohnson shopper2
    olivialee shopper3
    This CSV file provides the user passwords for three different customers. The encrypted data for these passwords is loaded into the USERREG database table after the customization is complete.
  8. Save and close the file.