Defining Membership User Settings in Metadata
The membership user is the ASP.NET representation of the commerce entity that represents shoppers in Microsoft Commerce Server 2009 R2. The CommerceMembershipUser class encapsulates the commerce entity whose model corresponds to the membershipUserModelName under <MembershipSettings> in ChannelConfiguration.config. For more information about MembershipSettings, see Defining MembershipSettings in Metadata.
In metadata, you must define the following:
Membership User Properties (see Defining Membership User Properties in Metadata)
Password Strength (see Defining Commerce Membership Provider Password Strength in Metadata)
Defining Membership User Properties in Metadata
For the Commerce Server 2009 R2 Commerce Membership Provider to function properly, the membership user properties must be defined in metadata under the name of the commerce entity that represents the shopper. In addition, the membership user properties must be supported by the Commerce Server Core Systems Profile System.
The following membership user properties must be mapped to the corresponding Commerce Server Core Systems Profile System properties in metadata under the name of the commerce entity that represents shoppers.
Membership User Property Name |
Description |
Commerce Server Core Systems Profile Property to which the Membership User Property is Mapped |
Required or Optional |
---|---|---|---|
Id |
Specifies the user ID of the membership user (shopper) |
GeneralInfo.user_id |
Required |
DateCreated |
Specifies the date and time when the user was added to the membership data store |
ProfileSystem.date_created |
Required |
DateModified |
Specifies the date and time when the profile was last updated |
ProfileSystem.date_last_changed |
Required |
AccountStatus |
Specifies the active or inactive status of the membership user’s account |
AccountInfo.account_status |
Required |
Specifies the e-mail address of the membership user (shopper) |
GeneralInfo.email_address |
Required |
|
FirstName |
Specifies the first name of the membership user (shopper) |
GeneralInfo.first_name |
Optional |
LastName |
Specifies the last name of the membership user (shopper) |
GeneralInfo.last_name |
Optional |
Password |
Specifies the user ID of the membership user (shopper) |
GeneralInfo.user_security_password |
Required |
PasswordQuestion |
Specifies the question a membership user must answer in the event he/she needs to retrieve or reset a forgotten password |
GeneralInfo.password_question |
Required |
PasswordAnswer |
Specifies the answer to the PasswordQuestion a membership user must provide in the event he/she needs to retrieve or reset a forgotten password |
GeneralInfo.password_answer |
Required |
LastActivityDate |
Specifies the last date the membership user logged in or accessed the site
Note:
This property is only required for determining if a user is currently online.
|
ProfileSystem.last_activity_date |
Optional |
LastLockoutDate |
Specifies the last date when the membership user was locked out of his/her account
Note:
This property is required if you want to support account lockout.
|
ProfileSystem.last_lockedout_date |
Optional |
LastLoginDate |
Specifies the last date the membership user logged in to his/her account |
ProfileSystem.date_last_logon |
Required |
LastPasswordChangedDate |
Specifies the last date the membership user changed the password to his/her account |
ProfileSystem.date_last_password_changed |
Required |
LoginErrorDates |
Specifies the dates when the membership user did not successfully log in to his/her account
Note:
This property is required if you want to support account lockout.
|
ProfileSystem.logon_error_dates |
Optional |
PasswordAnswerErrorDates |
Specifies the dates when the membership user did not provide the correct answer to the PasswordQuestion for his/her account
Note:
This property is required if you are using the PasswordQuestion and PasswordAnswer properties to support account lockout.
|
ProfileSystem.password_answer_error_dates |
Optional |
In , the UserProfile is the commerce entity that represents membership users (shoppers). The following sample configuration shows how the required Membership user properties are mapped to the corresponding Commerce Server Core Systems Profile System properties in metadata under the UserProfile entity, which represents shoppers, for the Solution Storefront site.
<!-- UserProfile Start -->
<CommerceEntity
name="UserProfile">
<DisplayName value="User Profile">
</DisplayName>
<Description value="Commerce Entity that defines the User Profile">
</Description>
…
<EntityMappings>
<EntityMapping
csType="Microsoft.CommerceServer.Runtime.Profiles.Profile"
csAssembly="Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
csDefinitionName="UserObject">
<PropertyMappings>
<PropertyMapping property="Id" csProperty="GeneralInfo.user_id" />
<PropertyMapping property="DateCreated" csProperty="ProfileSystem.date_created" />
<PropertyMapping property="DateModified" csProperty="ProfileSystem.date_last_changed" />
<PropertyMapping property="ModifiedBy" csProperty="ProfileSystem.user_id_changed_by" />
<PropertyMapping property="AccountStatus" csProperty="AccountInfo.account_status" />
<PropertyMapping property="Email" csProperty="GeneralInfo.email_address" />
<PropertyMapping property="FirstName" csProperty="GeneralInfo.first_name" />
<PropertyMapping property="LastName" csProperty="GeneralInfo.last_name" />
<PropertyMapping property="Password" csProperty="GeneralInfo.user_security_password" />
<PropertyMapping property="LiveId" csProperty="GeneralInfo.user_live_id" />
<PropertyMapping property="PasswordQuestion" csProperty="GeneralInfo.password_question" />
<PropertyMapping property="PasswordAnswer" csProperty="GeneralInfo.password_answer" />
<PropertyMapping property="LastActivityDate" csProperty="ProfileSystem.last_activity_date"/>
<PropertyMapping property="LastLockoutDate" csProperty="ProfileSystem.last_lockedout_date"/>
<PropertyMapping property="LastLoginDate" csProperty="ProfileSystem.date_last_logon"/>
<PropertyMapping property="LastPasswordChangedDate" csProperty="ProfileSystem.date_last_password_changed"/>
<PropertyMapping property="LoginErrorDates" csProperty="ProfileSystem.logon_error_dates"/>
<PropertyMapping property="PasswordAnswerErrorDates" csProperty="ProfileSystem.password_answer_error_dates" />
</PropertyMappings>
</EntityMapping>
</EntityMappings>
…
</CommerceEntity>
<!-- UserProfile End -->
Defining Commerce Membership Provider Password Strength in Metadata
The Commerce Membership Provider validates that shopper passwords meet the minimum password strength.
You define the minimum password strength of passwords in metadata under the commerce entity that represents shoppers. For example, in Commerce Server 2009 R2, the minimum strength for passwords is defined under the UserProfile entity in metadata.
The PasswordStrengthRegularExpression property gets the regular expression used to evaluate passwords through the property constraints defined in metadata.
The sample configuration below shows how the minimum password strength is defined by the Pattern property in metadata:
<Property name="Password" dataType="String">
<Constraints>
<RequiredProperty>
<Message value="Password is required">
</Message>
</RequiredProperty>
<RegularExpression>
<Message value="Passwords must meet minimum strength requirements.">
</Message>
<Pattern value="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$" />
</RegularExpression>
</Constraints>
</Property>
Note
The password strength regular expression must be defined in MetadataDefinitions.xml under the commerce entity that represents the membership user. If you define the password strength regular expression elsewhere, for example, under the <membership> section in the presentation tier Web.config, it will not be respected.
For more information about ASP.NET membership, see Managing Users by Using Membership https://go.microsoft.com/fwlink/?LinkId=209149.
See Also
Other Resources
Using the Commerce Membership Provider