一步一步配置Moss 2010 Form 认证
1. 配置一个用户数据库,这里使用Aspnetdb,下面的步聚我们将创建这个数据库
a. 启动cmd 并运行 cd C:\Windows\Microsoft.NET\Framework\v2.0.50727
b. 执行 aspnet_regsql.exe
c. 点击下一步
d. 选择 Configure SQL Server for application services 并点击下一步
e. 输入Sql server的服务器名称和要新建的数据库名称aspnetdb,并点击下一步
f. 点击 Finish 完成
2. 在aspnetdb中创建用户
a. 下载 FBA User Management Tool http://fbamanagementtool.codeplex.com/
b. 解压缩MembershipSeeder.zip并启动release目录下的 MembershipSeeder.exe
c. 点击Configure … ,输入Sql server的服务器名称(注意与第一大步中保持一致)
d. 点击Create,这个工具将在aspnetdb中创建 user1 … user50等50个用户,密码为!Passw0rd
3. 配置Web.config (建议在配置任何web.config文件之前先备份原文件,以备操作失误使得SharePoint崩溃时用于恢复)
a. 配置C:\Program Files\CommonFiles\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken\web.config,注<system.net>和<system.web>节点时原有节点,只需更新相应的内容。
<system.net>
<connectionManagement>
<add address="*" maxconnection="10000" />
</connectionManagement>
</system.net>
<connectionStrings>
<add name="SQLConnectionString"
connectionString="Data Source=.;Initial Catalog=aspnetdb;
Persist Security Info=True;User ID=fba;Password=cc8866"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true" cacheRolesInCookie="false">
<providers>
<add name="SqlRoleProvider"
type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider,
Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SQLConnectionString"
applicationName="/"
description="Stores and retrieves roles from SQL Server"
name="fbarole"
type="System.Web.Security.SqlRoleProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<membership>
<providers>
<add name="SqlMembershipProvider"
type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider,
Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SQLConnectionString"
passwordAttemptWindow="5"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="true"
passwordFormat="Hashed"
description="Stores and Retrieves membership data from SQL Server"
name="fbarole"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<authentication mode="Windows" />
</system.web>
b. 配置管理中心的web.config
在<configuration>节点下添加
<system.net>
<connectionManagement>
<add address="*" maxconnection="10000" />
</connectionManagement>
</system.net>
<connectionStrings>
<add name="SQLConnectionString"
connectionString="Data Source=.;Initial Catalog=aspnetdb;
Persist Security Info=True;User ID=fba;Password=cc8866"
providerName="System.Data.SqlClient" />
</connectionStrings>
更新roleManager和 membership 节点:
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">
<providers>
<add name="SqlRoleProvider"
type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider,
Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SQLConnectionString"
applicationName="/"
description="Stores and retrieves roles from SQL Server"
name="fbarole"
type="System.Web.Security.SqlRoleProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<membership>
<providers>
<add name="SqlMembershipProvider"
type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider,
Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" />
<add connectionStringName="SQLConnectionString"
passwordAttemptWindow="5"
enablePasswordRetrieval="false"
enablePasswordReset="false"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="true"
passwordFormat="Hashed"
description="Stores and Retrieves membership data from SQL Server"
name="fbarole"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
4. 新建Web Application (注意选择Claims,并且enableFBA, 填写对应的provider,注意与上面的web.config中的保持一致 )
5. 新建网站集,注意第一管理员是windows 用户 第二管理员是我们在aspnetdb中创建的user1
6. 测试, 打开上面新建的网站集,登陆时选择 Forms Authentication
输入用户名user1, 密码 !Passw0rd, 点击 Sign In
登陆成功: