Associate a Membership Provider with Sitecore
Complete the following procedure to use the Sitecore Commerce 8.2 powered by Commerce Server and Commerce Server 11.4 Profile System to authenticate user profiles, allowing your users to log in using their existing credentials. This step is optional, and is for legacy Commerce Server users who want to use any databases that are populated with legacy customer profile data.
Complete the following prerequisites:
Install Commerce Server
This example will setup the UPM provider using the UserObject.GeneralInfo.email_address
as the login name.
At your Visual Studio solution setup:
Edit the Sitecore
web.config
file at configuration/system.web/membership/providers:Add the Commerce Server UPM Membership Provider .
<add name="UPM" type="CommerceServer.Core.Runtime.Profiles.UpmMembershipProvider, CommerceServer.Core.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=f5c79cb11734af7a" applicationName="sitecore" enablePasswordReset="false" requiresQuestionAndAnswer="false"/>
Add the Commerce Server switching provider
<add name="commerceSwitcher" ="Sitecore.Commerce.Connect.CommerceServer.Profiles.CommerceServerSwitchingMembershipProvider, Sitecore.Commerce.Connect.CommerceServer" applicationName="sitecore" mappings="switchingProviders/membership" /> Change the Sitecore membership provider realProviderName to be commerceSwitcher <add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="commerceSwitcher" providerWildcard="%" raiseEvents="true" />
Change the Sitecore membership provider realProviderName to commerceSwitcher
<add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="commerceSwitcher" providerWildcard="%" raiseEvents="true" />
Edit the
Website\App_Config\Include\CommerceServer.Profiles.config
fileAdd the membership provider info to
/configuration/sitecore/switchingProviders
<membership> <provider patch:before="*[@providerName='sql']" providerName="UPM" storeFullNames="false" wildcard="%" domains="CommerceUsers"/> </membership>
Change store full names to false on the profile provider
<profile> <provider patch:before="*[@providerName='sql']" providerName="cs" storeFullNames="false" wildcard="%" domains="CommerceUsers"/> </profile>
Change the link property to the
GeneralInfo.email_address
property<profiles> <SitecoreLinkProperty name="GeneralInfo.email_address" /> </profiles>
Modify the Sitecore Commerce 8.2 powered by Commerce Server and Commerce Server 11.4 profile schema:
Ensure that the GeneralInfo.email_address column is indexed and set as a primary key
Don’t allow email address to be null, and ensure it is unique
Remove the index from ExternalID (add a column if its not there)
Allow for ExternalID to be null
Set
ensureAnonymousUser
to false for the CommerceUsers domain and add the default profile item id in theSitecore Website\App_Config\Security\Domains.config
file.< domain name = " CommerceUsers " ensureAnonymousUser = " false " defaultProfileItemId = " {0FFEC1BD-4D35-49CF-8B7D-7F01930834ED} " />
Enable SitecoreUser Manager to create users.
Add the following to the Sitecore
web.config
file under/configuration/sitecore/settings
<setting name="AccountNameValidation" value=".+" />
Remove the
Password Question
andPassword Answer
from the profile schema.Note
If you wish to keep these properties, you cannot create users through the Sitecore User manager, however, editing/deleting of users will still work.