Verndale.Restrictor 1.0.3

dotnet add package Verndale.Restrictor --version 1.0.3
                    
NuGet\Install-Package Verndale.Restrictor -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Verndale.Restrictor" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Verndale.Restrictor" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Verndale.Restrictor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Verndale.Restrictor --version 1.0.3
                    
#r "nuget: Verndale.Restrictor, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Verndale.Restrictor&version=1.0.3
                    
Install Verndale.Restrictor as a Cake Addin
#tool nuget:?package=Verndale.Restrictor&version=1.0.3
                    
Install Verndale.Restrictor as a Cake Tool

OptiAccess Restrictor Add-on

Overview

The OptiAccess Restrictor add-on provides an easy way to control access to specific areas of an Optimizely website. By default, it restricts access to key administrative paths and allows you to configure policies for role-based access control.

Important: The add-on is disabled by default so that you can add your own IP. Be careful when activating it because you might lose access to the CMS. Additionally, some paths are whitelisted by default, such as /episerver and /util/login, but you can remove them if necessary.

The data is stored in DDS (Dynamic Data Store).

Enable Restriction

Restricted


Installation & Configuration

1. Register the Add-on in Startup.cs

To enable the OptiAccess Restrictor, add it to the ConfigureServices method in Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
    // Basic registration
    services.AddRestrictor();

    // OR: Configure with custom policies
    services.AddRestrictor(authorizationOptions =>
    {
        authorizationOptions.AddPolicy("My.AddOn.Policy.Name", policy =>
        {
            // Required when using Opti ID authentication
            policy.AddAuthenticationSchemes(OptimizelyIdentityDefaults.SchemeName);

            // Define roles required for this policy
            policy.RequireRole("WebAdmins", "SeoAdmins");
        });
    });

    ...
}

2. Initialize the Restrictor Handler (Register Only in Lower Environments)

To avoid restrictions in production, ensure that the Restrictor Handler middleware is only registered in lower environments (such as Integration and Preproduction). Modify the Configure method of Startup.cs as follows:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (!env.IsProduction()) // Register only in non-production environments
    {
        app.UseRestrictor();
    }
    
    ...
}

3. Default Restricted Paths

By default, the following paths are whitelisted and accessible:

  • /episerver
  • /util/login
  • /verndale-restrictor

If necessary, you can modify the configuration to remove or add paths as per your requirements.


Usage

Once installed, navigate to the IP Whitelist add-on view to configure your access rules. Here, you can whitelist IP addresses to allow access to restricted areas.

Enabling the Add-on

  • Go to the add-on configuration page.
  • Add your IP address to the whitelist.
  • Enable the restriction by checking the Enable checkbox.
  • Save the configuration.

Important Considerations

  • Be careful when enabling the add-on, as incorrect configuration might lock you out of the CMS.
  • Ensure that essential users have whitelisted IPs before enabling restrictions.
  • If you need to restrict additional paths, update the configuration accordingly.
  • The default whitelisted paths (/episerver, /util/login) can be removed if stricter security is required.

Notes

  • Easily enable or disable access restriction by checking the Enable checkbox in the admin view.
  • Ensure that users who need access have the appropriate roles defined in the policy.
  • If you need to restrict additional paths, update the configuration accordingly.
  • The data for the whitelist is stored in DDS (Dynamic Data Store), ensuring persistence across deployments.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 137 3/13/2025
1.0.1 219 3/13/2025 1.0.1 is deprecated.
1.0.0 212 3/12/2025 1.0.0 is deprecated.

The OptiAccess Restrictor add-on is now available!