前言:偶然的机会弄了一次关于Reporting Services 使用窗体身份验证来访问Reporting Services的东西:)现在整理下,原始的信息看下面的链接
本微软提供的信息:
http://technet.microsoft.com/zh-cn/library/ms160724.aspx sql2005版本微软提供的信息
http://www.microsoft.com/china/msdn/library/data/sqlserver/ufairs.mspx?mfr=true sql2000版本

前期准备:
1: CustomSecurity 示例
 默认情况下,此示例位于 Reporting Services 示例目录的 Extension Samples\FormsAuthentication Sample 子目录中。
 C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Extension Samples\FormsAuthentication Sample
 当然也可以到网络上去下载的:),把这个项目给编译咯但是编译前需要看下面:
(1)生成强名称密钥文件
打开 Microsoft Visual Studio 2005 命令提示符。单击“开始”,依次指向“所有程序”、“Microsoft .NET Framework SDK 2.0”,然后单击“SDK 命令提示符”。
- 或 -
打开 Microsoft .NET Framework 命令提示符。单击“开始”,依次指向“所有程序”、“Microsoft .NET Framework SDK 2.0”,然后单击“SDK 命令提示符”。
使用更改目录命令 (CD) 将命令提示符窗口的当前目录更改至安装示例的文件夹。
注意:
若要确定示例所在的文件夹,请单击“开始”按钮,依次指向“所有程序”、“Microsoft SQL Server 2005”、“文档和教程”,然后单击“示例目录”。如果使用了默认安装位置,则示例将位于 <system_drive>:\Program Files\Microsoft SQL Server\90\Samples 中。
 在命令提示符下,运行以下命令以生成密钥文件:
sn -k SampleKey.snk
(2)打开 CustomSecurity.sln把其中原来的SampleKey.snk 删除,然后添加你新生成的,另外需要引用Microsoft.ReportingServices.Interfaces。默认情况下,程序集位于 <安装位置>\ReportServer\bin
示例编译完成后,必须将 DLL 和 ASPX 页复制到安装报表服务器的相应子目录中。

部署示例
将 Microsoft.Samples.ReportingServices.CustomSecurity.dll 和 Microsoft.Samples.ReportingServices.CustomSecurity.pdb 复制到 <安装位置>\ReportServer\bin 目录。
将 Microsoft.Samples.ReportingServices.CustomSecurity.dll 和 Microsoft.Samples.ReportingServices.CustomSecurity.pdb 复制到 <安装位置>\ReportManager\bin 目录。
将 Logon.aspx 页复制到 <安装位置>\ReportServer 目录,并将 UILogon.aspx 页复制到 <安装位置>\ReportManager\Pages 目录。
将程序集和登录页复制到服务器上之后,需要对报表服务器和报表管理器配置文件做一些修改。

2:修改 Reporting Services配置
(1)ReportServer
使用 Visual Studio 2005 或简单的文本编辑器(如记事本)打开 RSReportServer.config 文件。RSReportServer.config 位于 <安装位置>\ReportServer 目录中。
找到 <Security> 和 <Authentication> 元素,并对该设置进行如下修改:
<Security>
   <Extension Name="Forms"
Type="Microsoft.Samples.ReportingServices.CustomSecurity.Authorization,
Microsoft.Samples.ReportingServices.CustomSecurity" >
      <Configuration>
         <AdminConfiguration>
            <UserName>username</UserName>//这个地方就是默认的注册后拥有最高权限的帐号你可以修改掉,或者添加多个
         </AdminConfiguration>
      </Configuration>
   </Extension>
</Security>
<Authentication>
   <Extension Name="Forms"
Type="Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationExtension,
 Microsoft.Samples.ReportingServices.CustomSecurity" />
</Authentication>

修改 RSWebApplication.config 文件
接着,需要打开位于 <安装位置>\ReportManager 目录的报表管理器配置文件 RSWebApplication.config。
找到 <UI> 元素,对其进行如下更新:
<UI>
   <CustomAuthenticationUI>
      <loginUrl>/Pages/UILogon.aspx</loginUrl>
         <UseSSL>True</UseSSL>
   </CustomAuthenticationUI>
   <ReportServerUrl>http://<server>/ReportServer</ReportServerUrl>
</UI>
注意: 
如果运行安全扩展插件示例的开发环境中没有安装安全套接字层 (SSL) 证书,则必须在上述配置条目中将 <UseSSL> 元素的值改为 False。建议将 Reporting Services 与窗体身份验证结合使用时始终使用 SSL。

打开位于 <安装位置>\ReportServer 目录中的 rssrvpolicy.config 文件。
在安全策略文件中找到具有 $CodeGen URL 成员身份的现有代码组(如下所示),然后按照如下所示向 rssrvpolicy.config 添加条目。
注意: 
如果已安装 Analysis Services,则需要将 Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll 改为 MSSQL.3。
<CodeGroup
   class="UnionCodeGroup"
   version="1"
   PermissionSetName="FullTrust">
   <IMembershipCondition
      class="UrlMembershipCondition"
      version="1"
      Url="$CodeGen$/*"
   />
</CodeGroup>
<CodeGroup
   class="UnionCodeGroup"
   version="1"
   Name="SecurityExtensionCodeGroup"
   Description="Code group for the sample security extension"
   PermissionSetName="FullTrust">
   <IMembershipCondition
      class="UrlMembershipCondition"
      version="1"
      Url="C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll"
   />
</CodeGroup>

在文本编辑器中打开 Web.config 文件。默认情况下,此文件位于 <安装位置>\ReportServer 目录中。
找到 <identity> 元素并将 Impersonate 属性设置为 false。
找到 <identity> 元素并将 Impersonate 属性设置为 false。
<identity impersonate="false" />
找到 <authentication> 元素并将 Mode 属性改为 Forms。
将以下 <forms> 元素添加为 <authentication> 元素的子元素,并按如下所示设置 loginUrl、name、timeout 和 path 属性:
<authentication mode="Forms">
   <forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="60"
               path="/"></forms>
   </authentication>
将以下 <authorization> 元素直接添加到 authentication> 元素的后面。
<authorization>
   <deny users="?" />
</authorization>

(2)ReportManager
打开位于 <安装位置>\ReportManager 目录中的报表管理器策略文件 rsmgrpolicy.config。
在 rsmgrpolicy.config 中找到以下代码组,并按照如下所示将 PermissionSetName 属性由 Execution 改为 FullTrust:
<CodeGroup
        class="FirstMatchCodeGroup"
        version="1"
        PermissionSetName="FullTrust"
        Description="This code group grants MyComputer code Execution
permission. ">
    <IMembershipCondition
            class="ZoneMembershipCondition"
            version="1"
            Zone="MyComputer" />
打开报表管理器的 Web.config。它位于 <安装位置>\ReportManager 目录中。
查找 <identity impersonate= "true" /> 部分并将其改为 <identity impersonate="false" />,以禁用模拟。

 

需要注意的地方:如果你的机器不是单独的实例或者默认的端口那么在编译CustomSecurity项目的时候需要修改里面的相关信息.功能是实现了,但是微软不推荐使用

posted on 2007-08-22 10:03  草莽  阅读(1716)  评论(3编辑  收藏  举报