TFE.Umbraco.AccessRestriction
14.1.2
dotnet add package TFE.Umbraco.AccessRestriction --version 14.1.2
NuGet\Install-Package TFE.Umbraco.AccessRestriction -Version 14.1.2
<PackageReference Include="TFE.Umbraco.AccessRestriction" Version="14.1.2" />
paket add TFE.Umbraco.AccessRestriction --version 14.1.2
#r "nuget: TFE.Umbraco.AccessRestriction, 14.1.2"
// Install TFE.Umbraco.AccessRestriction as a Cake Addin #addin nuget:?package=TFE.Umbraco.AccessRestriction&version=14.1.2 // Install TFE.Umbraco.AccessRestriction as a Cake Tool #tool nuget:?package=TFE.Umbraco.AccessRestriction&version=14.1.2
TFE.Umbraco.AccessRestriction
TFE.Umbraco.AccessRestriction is a IP access restriction manager for Umbraco. The package features a dashboard and editor that let's users manage whitelisted IP addresses from within the Umbraco backoffice. IP's can be added with a description and have both a creation and modified date and user.
Getting started
License: | Umbraco: | Target Framework: |
---|---|---|
MIT License | Umbraco 14 | .NET 8 |
Package Installation
The Umbraco 14.1.2 version of this package is only available via NuGet. To install the package, you can use either .NET CLI:
dotnet add package TFE.Umbraco.AccessRestriction --version 14.1.2
or the older NuGet Package Manager:
NuGet\Install-Package TFE.Umbraco.AccessRestriction --version 14.1.2
Umbraco Installation
Before the Umbraco middleware, add the IPAccessRestrictionMiddleware to Program.cs or Startup.cs in previous versions:
app.UseMiddleware<IPAccessRestrictionMiddleware>();
Add the necessary usings to Program.cs (or Startup.cs):
using TFE.Umbraco.AccessRestriction.Middleware;
Add these settings to appsettings.json
"TFE.Umbraco.AccessRestriction": {
"disable": true,
"logBlockedIP": false,
"localHost": "127.0.0.1",
"excludePaths": "/umbraco, /App_Plugins, /api/keepalive/ping",
"includePaths": "",
"isCloudFlare": false,
"customHeader": ""
}
Either use "excludePaths" or "includePaths" to direct the IP blocker.
Azure / CloudFlare / Umbraco Cloud Installation
When installed on a cloud environment make sure to add your the cloud IP Addresses. Replace the following excludePaths property in appsettings.json :
"excludePaths": "/umbraco, /App_Plugins, /api/keepalive/ping, /umbraco-signin-oidc, /sb",
Set to true when using Cloudflare
"isCloudFlare": true,
If a proxy is being used, set the value of the 'customHeader' field to 'header' with the IP address used by the proxy.
"customHeader": "",
Whitelist IP Addresses
There are two different ways to whitelist an IP address, though the dashboard interface and by adding the IP address to WhitelistedIps.txt. Both methods can be used simultaneously and separately.
Add an IP using the Umbraco dashboard
Add an IP using WhitelistedIps.txt
Add WhitelistedIps.txt to the root of your Umbraco project.
IP Addresses must be line separated and to add a comment use the #.
192.168.1.1
192.168.1.2 #John
192.168.1.3
::1
192.168.1.4 #Hank
Features
- Global dashboard for listing all whitelisted IP addresses.
- Package handles IP addresses added manually by a user with admin rights and IP addresses added to the WhitelistedIps.txt.
- logBlockedIP enables you to see all blocked IP addresses in the Umbraco log.
- Use as wildcard to add a range of IP addresses e.g. "192.168.1."
- Include or exclude paths from being blocked.
Building and Packing the NuGet Package
If you've made changes to the frontend (e.g., using Vite or Lit), it's important to build the frontend assets before packing the NuGet package. This ensures that all the necessary files are correctly included in the package.
Step 1: Build the Frontend
Before you pack the NuGet package, you need to build the frontend assets:
Navigate to the
TFE.Umbraco.AccessRestriction/client
directory of your project where the frontend files are located.Run the following command to build the frontend:
npm run build
This command compiles the frontend files, optimizes them for production, and places them in
TFE.Umbraco.AccessRestriction/src/wwwroot
.
Step 2: Pack the NuGet Package
Once the frontend is built, you can proceed to create the NuGet package:
Open a terminal in
TFE.Umbraco.AccessRestriction/src
.Run the following .NET CLI command to pack the NuGet package:
dotnet pack --configuration Release
This command creates a
.nupkg
file in thebin/Release
directory of your project. This file is the NuGet package that you can distribute.
Step 3: Publish the NuGet Package
After packing, you can publish your NuGet package to NuGet.org or any other NuGet server you use:
Use the following command to push the package to NuGet.org:
dotnet nuget push bin/Release/TFE.Umbraco.AccessRestriction.<version>.nupkg --api-key <Your_NuGet_API_Key> --source https://api.nuget.org/v3/index.json
Replace
<version>
with the version number of your package, and<Your_NuGet_API_Key>
with your actual NuGet API key.
Summary
npm run build
: Builds the frontend assets.dotnet pack --configuration Release
: Creates the NuGet package.dotnet nuget push
: Publishes the package to NuGet.org.
By following these steps, you ensure that any frontend changes are properly included in the NuGet package, providing a seamless experience for users who install your package.
Contribution guidelines
To raise a new bug, create an issue on the GitHub repository. To fix a bug or add new features, fork the repository and send a pull request with your changes. Feel free to add ideas to the repository's issues list if you would like to discuss anything related to the library.
Who do I talk to?
This project is maintained by Rutger Dijkstra and contributors. If you have any questions about the project please raise a issue on GitHub.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Umbraco.Cms.Api.Management (>= 14.1.2)
- Umbraco.Cms.Web.Common (>= 14.1.2)
- Umbraco.Cms.Web.Website (>= 14.1.2)
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 | |
---|---|---|---|
14.1.2 | 105 | 9/4/2024 | |
13.0.0 | 242 | 6/10/2024 | |
13.0.0-alpha | 82 | 6/10/2024 | |
12.0.1.1 | 286 | 7/25/2023 | |
12.0.1 | 189 | 7/20/2023 | |
11.3.1 | 1,133 | 5/5/2023 | |
10.4.0.1 | 406 | 1/20/2023 | |
10.4.0 | 280 | 1/19/2023 | |
10.3.2.2 | 342 | 11/9/2022 | |
10.3.2.1 | 356 | 11/4/2022 | |
10.3.2 | 365 | 11/4/2022 | |
10.2.2.4-alpha | 156 | 11/4/2022 | |
10.2.2.3-alpha | 278 | 10/20/2022 | |
10.2.1 | 427 | 10/11/2022 | |
10.2.0 | 399 | 10/11/2022 |