环境:SQL SERVER 2016

 

一、修改配置文件

需要修改的配置文件目录C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer????,具体看自己服务器的实际路径

 

1、修改 web.config

找到:

    <authentication mode="Windows" />
    <identity impersonate="true" />

修改为:

       <authentication mode="None" />
       <identity impersonate="false"/>

 

2、修改rsreportserver.config

1.找到:

 <Authentication>
              <AuthenticationTypes>
                     <RSWindowsNTLM/>
              </AuthenticationTypes>         
        <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
        <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario> <EnableAuthPersistence>true</EnableAuthPersistence> </Authentication>

修改为:   

 <Authentication>
        <AuthenticationTypes>
            <Custom/>
        </AuthenticationTypes>              
      <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
      <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario> <EnableAuthPersistence>true</EnableAuthPersistence> </Authentication>

 

2.找到:

       <Security>
              <Extension Name="Windows" Type="Microsoft.ReportingServices.Authorization.WindowsAuthorization, Microsoft.ReportingServices.Authorization"/>
       </Security>
       <Authentication>
              <Extension Name="Windows" Type="Microsoft.ReportingServices.Authentication.WindowsAuthentication, Microsoft.ReportingServices.Authorization"/>
       </Authentication>

修改为:

    <Security>
        <Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.Authorization, Microsoft.Samples.ReportingServices.AnonymousSecurity" />
    </Security>
    <Authentication>
        <Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.AnonymousSecurity" />
  </Authentication>

 

3、修改rssrvpolicy.config

找到最后一个codegroup标签增加:

  

<CodeGroup
              class="UnionCodeGroup" 
              version="1"                                                              
              PermissionSetName="FullTrust" 
              Name="Private_assembly"
              Description="This code group grants custom code full trust.">                           
       <IMembershipCondition
                     class="UrlMembershipCondition"      
                     version="1" 
                     Url="C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"
                     />
  </CodeGroup>

 

二、添加自定义安全扩展插件

将Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 放置 C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer\bin目录。

MSSQL2016DLL下载

其实可以了解一下此dll的修改原理,是将登录验证的代码注释了????

此DLL的 Git地址

此DLL下包含两个类AuthenticationExtension、Authorization,下面提供了dll修改方式,其实挺无脑的????

AuthenticationExtension

using Microsoft.ReportingServices.Interfaces;
using System;
using System.Security.Principal;

namespace Microsoft.Samples.ReportingServices.AnonymousSecurity
{
    public class AuthenticationExtension : IAuthenticationExtension, IExtension
    {
        public string LocalizedName
        {
            get
            {
                return null;
            }
        }

        public void SetConfiguration(string configuration)
        {
        }

        public bool LogonUser(string userName, string password, string authority)
        {
            return true;
        }

        public void GetUserInfo(out IIdentity userIdentity, out IntPtr userId)
        {
            userIdentity = new GenericIdentity("dummy user");
            userId = IntPtr.Zero;
        }

        public bool IsValidPrincipalName(string principalName)
        {
            return true;
        }
    }
}
View Code

相关文章: