首先,这可以在我们的web.config转换文件内的<system.web>下找到:<membership hashAlgorithmType="SHA256" xdt:Transform="SetAttributes(hashAlgorithmType)"> <providers> <add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="switcher" providerWildcard="%" raiseEvents="true" xdt:Locator="Match(name)" xdt:Transform="Replace" /> <add name="myprovider" type="MyProject.SecurityProviders.MembershipProvider, MyProject.SecurityProviders" applicationName="sitecore" xdt:Transform="Insert"/> </providers></membership><roleManager> <providers> <add name="sitecore" type="Sitecore.Security.SitecoreRoleProvider, Sitecore.Kernel" realProviderName="switcher" raiseEvents="true" xdt:Locator="Match(name)" xdt:Transform="Replace" /> <add name="myprovider" type="MyProject.SecurityProviders.RoleProvider, MyProject.SecurityProviders" applicationName="sitecore" xdt:Transform="Insert"/> </providers></roleManager>接下来,可以在单独的配置包含文件中直接在<sitecore>下找到该文件:<switchingProviders> <membership> <provider providerName="myprovider" storeFullNames="false" wildcard="%" domains="websitedomain" patch:before="*"/> </membership> <roleManager> <provider providerName="myprovider" storeFullNames="false" wildcard="%" domains="websitedomain" patch:before="*"/> </roleManager></switchingProviders>这2个配置更改将使您能够创建自定义成员资格和角色提供程序(如果需要).如您所见,棘手的部分不是将sitecore的切换成员资格提供程序作为默认提供程序(如文档2.6.2中所述),而是将sitecore提供程序的realProviderName设置为switcher.从这里开始,它是ASP.NET成员资格的直接实现.We have a need to use an existing external database for our membership needs. This database will contain all the basic information needed to authenticate and authorize users. I'm looking to see if you have documentation that can guide me through this process. I've seen posts online for custom membership providers implementation. But I haven't seen examples on how to integrate the custom membership provider with Sitecore API so Sitecore.Context.User will return the information of the logged in user.Also, is there a way to access the custom profile information via Sitecore API?Thanks 解决方案 As promised in my comment here is our setup for enabling the Sitecore setup to stay the same while adding an extra membership provider to use in your website specifically.First this can be found inside of our web.config transform file under the <system.web>:<membership hashAlgorithmType="SHA256" xdt:Transform="SetAttributes(hashAlgorithmType)"> <providers> <add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="switcher" providerWildcard="%" raiseEvents="true" xdt:Locator="Match(name)" xdt:Transform="Replace" /> <add name="myprovider" type="MyProject.SecurityProviders.MembershipProvider, MyProject.SecurityProviders" applicationName="sitecore" xdt:Transform="Insert"/> </providers></membership><roleManager> <providers> <add name="sitecore" type="Sitecore.Security.SitecoreRoleProvider, Sitecore.Kernel" realProviderName="switcher" raiseEvents="true" xdt:Locator="Match(name)" xdt:Transform="Replace" /> <add name="myprovider" type="MyProject.SecurityProviders.RoleProvider, MyProject.SecurityProviders" applicationName="sitecore" xdt:Transform="Insert"/> </providers></roleManager>Next this is found in a separate config include file directly under <sitecore>:<switchingProviders> <membership> <provider providerName="myprovider" storeFullNames="false" wildcard="%" domains="websitedomain" patch:before="*"/> </membership> <roleManager> <provider providerName="myprovider" storeFullNames="false" wildcard="%" domains="websitedomain" patch:before="*"/> </roleManager></switchingProviders>These 2 changes in configuration will enable you to create a custom membership and role provider (in case you need one). As you can see the tricky part is not making the switching membership provider of sitecore the default provider (as stated in the documentation 2.6.2) but setting the realProviderName of the sitecore provider to switcher.From hereon it is straightforward implementation of ASP.NET Membership. 这篇关于Sitecore自定义成员资格提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-05 21:44