SharePoint 2013 基于表单 Membership 的身份验证

其实关于SharePoint 2013 表单身份验证网上已经有很多了,比如 SharePoint 2013自定义Providers在基于表单的身份验证(Forms-Based-Authentication)中的应用  和 Configuring Forms Based Authentication in SharePoint 2013这里我为什么还要写这篇blog,因为我是一个比较“懒惰”的人,做任何事情都喜欢用简单的方式。现在来说说主要步骤吧(我一直都在做microsoft平台的东东,所以这里也只考虑SQL):

1)建立对应的数据,一般切换C:WindowsMicrosoft.NETFramework64v4.0.30319路径下执行aspnet_regsql.exe建立对应的数据库

2)修改config文件,这里一般要修改要修改3个地方,Web Application Config、SharePoint Central Administration Config、SecurityTokenServiceApplication

而我这里就比较偷懒了,直接改C:WindowsMicrosoft.NETFramework64v4.0.30319Configmachine.config,建议不要修默认的配置,这里我们只是添加相应配置就可以了

   <add name="FBADB" connectionString="Server=sherry2012R2;Database=aspnetdb;Integrated Security=true" providerName="System.Data.SqlClient"/>

 <add name="FBAMembershipProvider"
                 type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                 connectionStringName="FBADB"
                 enablePasswordRetrieval="false"
                 enablePasswordReset="true"
                 requiresQuestionAndAnswer="false"
                 applicationName="/"
                 requiresUniqueEmail="true"
                 passwordFormat="Hashed"
                 maxInvalidPasswordAttempts="5"
                 minRequiredPasswordLength="7"
                 minRequiredNonalphanumericCharacters="1"
                 passwordAttemptWindow="10"
                 passwordStrengthRegularExpression="" />

 <add name="FBARoleProvider" connectionStringName="FBADB" applicationName="/"
                type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

3)创建user 和role,在Windows2012 上IIS是可以创建user和Role(Windows2012 默认情况下是不能创建user和role),这里我选着一个非sharepoint站点创建user和role

4)将Web Application的Authentication Type修改为混合模式

如果你遇到如下问题:

 解决方法:启用匿名访问既可以了

这个解决方案我在http://www.cr173.com/html/20704_1.html 找到的

这里大家要养成查看log,尤其是系统log的习惯,

记住这里需要先把user加到sharepoint成员组后,才能用user登陆

原文地址:https://www.cnblogs.com/majiang/p/3631908.html