Saturday, April 9, 2016

Setting up external membership provider in Sitecore

Steps to enable asp.net Membership in Sitecore using Switching Providers

     1. Create a asp.net membership db by running command aspnet_regsql.exe  in command prompt or you can run aspnet_regsql.exe located in C:\windows\Microsoft.NET\Framework\v2.0.50727

Reference Links:

       2. Add a connection string for ExtranetUser Membership Database in Connectionstrings.config.

     3. Make the following Configuration changes in web.config
a.       Add an element /configuration->system.web->membership->providers->add to web.config that exposes your membership provider class.

            b. Change the value of the realProviderName attribute of the                           /configuration/system.web/membership/providers/add element in web.config with a name attribute containing the value sitecore to switcher.

           c. Within the /configuration/sitecore/switchingProviders/membership element in web.config, add the following <provider> element, where the value of the providerName attribute containing the value sitecore to switcher.

(If step 3 is not clear )
Web.config:
In membership section,
·         change realProviderName to "switcher"
·         copy "sql" node and change name and connectionStringName to "external"
In switchingProviders section,
·         add "external" node with domains "external" )

<system.web>
<membership defaultProvider="sitecore" hashAlgorithmType="SHA1">
<Providers>

<! -- change realProviderName to "switcher" -->
<add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="switcher" providerWildcard="%" raiseEvents="true" />

<add name="sql" type="System.Web.Security.SqlMembershipProvider" connectionStringName="core" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="256" />
<add name="switcher" type="Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/membership" />

<! -- Copy "sql" node and change name and connectionStringName -->

 <add name="myProvider" type="System.Web.Security.SqlMembershipProvider" applicationName="sitecore" connectionStringName="ExternalMemberShipProvider"  minRequiredPasswordLength="1"  minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false"  requiresUniqueEmail="false"  maxInvalidPasswordAttempts="10" />
</providers> </membership>
    
  d. Within the /configuration/sitecore/switchingProviders/membership element in web.config, add the       following <provider> element, where the value of the providerName attribute matches the value         of the name attribute of the <add> element created previously

   <switchingProviders>  <Membership>
      <provider providerName="sql" storeFullNames="true" wildcard="%" domains="*" />
      <provider providerName="myprovider" storeFullNames="false" wildcard="%"                               domains="extranet"/>
</membership>

e. Under <system.web><roleManagerdefaultProvider="sitecore" enabled="true">
     <roleManager> tag add the following element
<add name="myProvider" type="System.Web.Security.SqlRoleProvider" applicationName="sitecore"  connectionStringName="ExternalMemberShipProvider" /> 
 And within <switchingProviders>
<provider providerName="AmetekRoleProvider" domains="extranet" storeFullNames="false" wildcard="%" />

f. Under <system.web> <profile> tag add the following element
<add name="myprovider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ExternalMemberShipProvider" applicationName="sitecore" /> and within <switchingProviders>
<provider providerName="AmetekProfileProvider" domains="extranet" storeFullNames="false" wildcard="%" />
     4. Create a role specific to site with extranet domain in CMS.

References

No comments:

Post a Comment