Partager via


profiles Element

The profiles element is a container for the elements that configure the functionality of user profiles and catalog sets. It describes the high-level schema implemented by the user and organization profiles to the runtime. The CommerceContext object uses this information when you implement the UserProfile and OrganizationProfile smart properties and in the GetCatalogsForUser method. This element is optional.

Note

The profiles element is a container for other elements. You cannot create a configuration with the profiles element alone.

The profiles element contains the optional encryption, userProfile, and organizationProfile subelements.

encryption Element

The encryption element specifies the description of the encryption key configured in the Profiles System.

The encryption element is required if the application reads or writes asymmetrically encrypted profile members; otherwise it is optional.

Note

The encryption element is a container for other elements. You cannot create a configuration with the encryption element alone.

The encryption element contains the keys subelement.

keys Element

The keys element contains the add subelement.

A maximum of three add elements may be added to a keys element.

The following table lists and describes the attribute of the keys element.

Attribute

Data Type

Description

keyIndex

String

The current key pair used for encryption/decryption.

The set of valid values is 1 or 2.

If the keyIndex attribute is set to 1, the add tag type attribute values of publicKeyand privateKey1form the current key pair.

If the keyIndex attribute is set to 2, the add tag type attribute values of publicKey and privateKey2form the current key pair.

The value of this attribute must represent an integer.

This attribute is required if the application writes to asymmetrically encrypted profile properties. You must use this attribute together with an add element whose type attribute is publicKey.

This attribute is required.

add Element

The following table lists and describes the attributes of the add element.

Attribute

Data Type

Description

type

String

The type of public/private keys used for encryption/decryption.

The valid set of case sensitive values are publicKey, privateKey1, and privateKey2. The publicKey is required if the keyIndex attribute is specified.

The publicKey is required if the application writes to asymmetrically encrypted profile properties or if the keyIndex attribute is set.

The privateKey1 is required only if the application reads asymmetrically encrypted profile properties that were encrypted when the keyIndex attribute was set to 1. For all other instances, the privateKey1 is optional.

The privateKey2 is required only if the application reads asymmetrically encrypted profile properties that were encrypted when the keyIndex attribute was set to 2. For all other instances, the privateKey2 is optional.

This attribute is case sensitive. This attribute is required.

value

String

The hexadecimal string for the type attribute specified. Only keys generated by using the CryptoAPI routines are valid. This attribute is case sensitive.

Alternatively, you can use the format: registry:{hive}[\{subkey}],[{valuename}] where hive is the key hive name (for example, HKEY_LOCAL_MACHINE) and subkey is an optional subkey name. If valuename is not specified, the (Default) value is used. Keys formatted in this manner are encrypted in the specified registry value. You can create these types of keys using Using the Profile Key Manager with the /reg flag. This attribute is required.

To determine the keyIndex value used to encrypt the profile, query the profile member used to save the keyIndex value. The profile member used to save the keyIndex attribute must be defined in profiles using asymmetric encryption.

There are several acceptable combinations of the encryption element attributes. For encryption, the recommended combination is publicKey + keyIndex. For decryption, the recommended combination is privateKey1 + privateKey2. For both encryption and decryption, the recommended combination is publicKey + keyIndex + privateKey1 + privateKey2.

userProfile Element

The userProfile element specifies the description of the user profile configured in the Profiles System.

The following table lists and describes the attributes of the userProfile element.

Attribute

Data Type

Description

profileDefinition

String

The name of the profile definition that corresponds to a user in the Profiles System.

The default value is UserObject.

This attribute is required.

userIdProperty

String

The property in the user profile that stores the unique user ID. You should not confuse this with the logon name. The user ID is the primary key used to distinguish all instances of the user profile from one another.

The default value is user_id.

This attribute is required.

organizationIdProperty

String

The property in the user profile that stores the unique identifier of the instance of the organization profile with which the user profile is associated.

The default value is AccountInfo.org_id.

This attribute is required.

catalogSetIdProperty

String

The property in the user profile that stores the catalog set or sets with which a particular instance of the user profile is associated.

The default value is AccountInfo.user_catalog_set.

This attribute is required.

userIdSource

String

Specifies how Commerce Server initializes the UserID property. If you explicitly assign a value to the the UserID property in your site code, the userIdSource property is ignored. If your site code accesses the the UserID property before it is initialized, then the userIdSource attribute determines how to initialize the the UserID as follows:

  • If the value of userIdSource is "ASP.NET", Commerce Server determines the the UserID by finding an instance of a profile whose type is specified by the profileDefinition attribute, and whose userIdKey field equals the value of HttpContext.Current.User.Identity.Name.

  • If the value of userIdSource is "UPM", Commerce Server obtains the the UserID from the ID in the AuthTicket object, if the AuthTicket object exists.

Valid values are "ASP.NET" and "UPM".

The default value is "ASP.NET".

This attribute is required.

userIdKey

String

The name of a field of the profile whose type is specified by the profileDefinition attribute. You use the value of this field to identify the current user, if the value of the userIdSource attribute is "ASP.NET". This attribute is ignored if the value of the userIdSource attribute is "UPM".

The default value is "GeneralInfo.email_address".

This attribute is required.

userIdTarget

String

The name of a field of the profile whose type is specified by the profileDefinition attribute. The value of this field is the UserID of the current user, if the value of the userIdSource attribute is "ASP.NET". This attribute is ignored if the value of the userIdSource attribute is "UPM".

The default value is "GeneralInfo.user_id".

This attribute is required.

organizationProfile Element

The organizationProfile element specifies the description of the organization profile configured in the Profiles System.

The following table lists and describes the attributes of the organizationProfile element.

Attribute

Data Type

Description

profileDefinition

String

The name of the profile definition that corresponds to an organization in the Profiles System.

The default value is "Organization".

This attribute is required.

organizationIdProperty

String

The property in the organization profile that stores the unique identifier of the instance of the organization profile that distinguishes it from all other instances of organization profiles.

The default value is "GeneralInfo.org_id".

This attribute is required.

catalogSetIdProperty

String

The property in the organization profile that stores the catalog set or sets with which a particular instance of the organization profile is associated.

The default value is "GeneralInfo.org_catalog_set".

This attribute is required.

Example

<profiles>
    <userProfile
        profileDefinition="UserObject"
        userIdProperty="GeneralInfo.user_id"
        organizationIdProperty="AccountInfo.org_id"
        catalogSetIdProperty="AccountInfo.user_catalog_set"
        userIdSource="ASP.NET"
        userIdKey="GeneralInfo.email_address"
        userIdTarget="GeneralInfo.user_id"
    />
    <organizationProfile
        profileDefintion="Organization"
        organizationIdProperty="GeneralInfo.org_id"
        catalogSetIdProperty="GeneralInfo.org_catalog_set"
    />

   <encryption>
       <keys keyIndex="1">
           <add type="publicKey" value="registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Commerce Server 2007 Keys\StarterSite,PublicKey" />
           <add type="privateKey1" value="registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Commerce Server 2007 Keys\StarterSite,PrivateKey" />
           <add type="privateKey2" value="" />
       </keys>
  </encryption>

</profiles>

See Also

Reference

CommerceContext

Other Resources

Web.Config Configuration Settings