Git Product home page Git Product logo

ms-ssrs-2014-custom-security's Introduction

Microsoft SQL Server Reporting Services 2014 Custom Security Sample

As the other sample SQL server version are < 2014 or > 2014, I created this sample.

Download Microsoft SQL Server 2014 + Reporting Services

Download and install ExpressAdv from: https://www.microsoft.com/en-us/download/details.aspx?id=42299

The following path will use ๐Ÿ”ธ to represent the install path.
The default install path may look like:

C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services

Original Source

https://archive.codeplex.com/?p=msftrsprodsamples

I have removed the database connection part from the sample, and hard coded the user verification to true. You may find "todoooooooooooooooooooo" from the code and replace with your custom security rule.

Deployment

If the Microsoft.ReportingServices.Interfaces is missing, add it from ๐Ÿ”ธ\ReportServer\bin\Microsoft.ReportingServices.Interfaces.dll

Build and copy the following file to the specific directory:
Logon.aspx -> ๐Ÿ”ธ\ReportServer
UILogon.aspx -> ๐Ÿ”ธ\ReportMnager\Pages
Microsoft.Samples.ReportingServices.CustomSecurity.dll, Microsoft.Samples.ReportingServices.CustomSecurity.pdb -> ๐Ÿ”ธ\ReportServer\bin
Microsoft.Samples.ReportingServices.CustomSecurity.dll, Microsoft.Samples.ReportingServices.CustomSecurity.pdb -> ๐Ÿ”ธ\ReportManager\bin

Configuration

Before modify the following configuration files, please create a copy for backup.

๐Ÿ”ธ\ReportServer\rsreportserver.config

Replace Configuration.Authentication to:

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

Replace Configuration.Extensions.Security to:
(For the AdminConfiguration.UserName, you may replace the value to your admin user name.)
(Use need to assess the Report Manager by admin account for kick-up.)

<Security>
    <Extension Name="Forms" Type="Microsoft.Samples.ReportingServices.CustomSecurity.Authorization, Microsoft.Samples.ReportingServices.CustomSecurity" >
        <Configuration>
            <AdminConfiguration>
                <UserName>admin</UserName>
            </AdminConfiguration>
        </Configuration>
    </Extension>
</Security>

Replace Configuration.Extensions.Authentication to:

<Authentication>
    <Extension Name="Forms" Type="Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationExtension,Microsoft.Samples.ReportingServices.CustomSecurity" />
</Authentication>

Replace Configuration.UI to:
(Set UseSSL to false if not using SSL)
(Set <IP> to your report server IP)

<UI>
    <CustomAuthenticationUI>
        <loginUrl>/Pages/UILogon.aspx</loginUrl>
        <UseSSL>True</UseSSL>
    </CustomAuthenticationUI>
    <ReportServerUrl>http://<IP>/ReportServer</ReportServerUrl>
</UI>

๐Ÿ”ธ\ReportServer\rssrvpolicy.config

Set PermissionSetName="FullTrust" to configuration.mscorlib.security.policy.PolicyLevel.CodeGroup

<CodeGroup
        class="FirstMatchCodeGroup"
        version="1"
        PermissionSetName="FullTrust">

Append following CodeGroup to configuration.mscorlib.security.policy.PolicyLevel
(Remind: replace <install path> to your install path)

<CodeGroup
        class="UnionCodeGroup"
        version="1"
        Name="SecurityExtensionCodeGroup"
        Description="Code group for the custom security extension"
        PermissionSetName="FullTrust">
    <IMembershipCondition
            class="UrlMembershipCondition"
            version="1"
            Url="<install path>\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll" />
</CodeGroup>

๐Ÿ”ธ\ReportServer\web.config

Replace configuration.'system.web'.authentication to:

<authentication mode="Forms">
    <forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="60" path="/"></forms>
</authentication>
<authorization>
    <deny users="?" />
</authorization>

๐Ÿ”ธ\ReportManager\rsmgrpolicy.config

Set PermissionSetName="FullTrust" to configuration.mscorlib.security.policy.PolicyLevel.CodeGroup

<CodeGroup 
        class="FirstMatchCodeGroup"
        version="1"
        PermissionSetName="FullTrust">

Set PermissionSetName="FullTrust" where Description="This code group grants MyComputer code Execution permission. "

<CodeGroup 
        class="FirstMatchCodeGroup" 
        version="1" 
        PermissionSetName="FullTrust"
        Description="This code group grants MyComputer code Execution permission. ">

๐Ÿ”ธ\ReportManager\Web.config

Replace configuration.'system.web'.authentication & configuration.'system.web'.identity to:

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

Append following to configuration.appSettings
(If you are using default instance: MSSQLSERVER, the instance name will be RS_MSSQLSERVER)

<add key="ReportServer" value="<Your PC Machine Name>"/>
<add key="ReportServerInstance" value="<Instance Name>"/>

ms-ssrs-2014-custom-security's People

Contributors

chunlampang avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.