HumanSecurityModule 0.13.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HumanSecurityModule --version 0.13.0
                    
NuGet\Install-Package HumanSecurityModule -Version 0.13.0
                    
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="HumanSecurityModule" Version="0.13.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HumanSecurityModule" Version="0.13.0" />
                    
Directory.Packages.props
<PackageReference Include="HumanSecurityModule" />
                    
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 HumanSecurityModule --version 0.13.0
                    
#r "nuget: HumanSecurityModule, 0.13.0"
                    
#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.
#:package HumanSecurityModule@0.13.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HumanSecurityModule&version=0.13.0
                    
Install as a Cake Addin
#tool nuget:?package=HumanSecurityModule&version=0.13.0
                    
Install as a Cake Tool

Human Security .Net Core Enforcer - Module

Latest stable version: [v0.13.0]

Dependencies

  • [.NET >= 6]

Installation

To install Human_Security_Module, run the following command:

dotnet add package HumanSecurityModule

Integration

Edit program.cs

  1. Add Human Module
using HumanSecurityModule;
  1. Add HumanSecurityModule as a service to your web api app:
builder.Services.AddSingleton<HumanSecurityModule.HumanSecurityModule>(provider =>
{
    EnforcerConfig enforcerConfig = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build().GetSection("HumanConfiguration").Get<EnforcerConfig>();
    return new HumanSecurityModule.HumanSecurityModule(enforcerConfig);
});
  1. Add site specific configuration (configuration level) On your app configuration JSON file (Default file name appsettings.json), add the following section:
"HumanConfiguration": {
    "px_app_id": "XXX",
    "px_cookie_secret": "XXX",
    "px_auth_token": "XXX"
    Other Human configuration options...
}

⚠️ If you do not wish to add the configuration for Human on your appsettings.json file, you can simply create an instance of EnforcerConfig manually and provide it to the module instead.

Configuring Required Parameters

Configuration options are set in EnforcerConfig

Required parameters:
  • px_app_id
  • px_cookie_secret
  • px_auth_token

Using HumanSecurityModule in a controller

  1. Inject HumanSecurityModule to your controller, for example:
public class WeatherForecastController : ControllerBase
{
...
private readonly HumanSecurityModule.HumanSecurityModule _humanModule;

    public WeatherForecastController(HumanSecurityModule.HumanSecurityModule humanModule)
    {
        _humanModule = humanModule;
    }
    ...

  1. In the handler function you wish to use Human, create a new instance of HumanRequest by either passing it the httpContext or the different components individually, and then call the Enforce method as follows:
 HumanRequest humanRequest = new HumanRequest(this.HttpContext);

 EnforceResult res = await _humanModule.Enforce(humanRequest);

EnforceResult will always contain the IsValid property, which indicate whether the request is a valid one (not a bot) or not, in addition to the request context which contains additional data about the request.

Upgrading

To upgrade to the latest Enforcer version:

  1. In Visual Studio, right click on the solution and Select Manage NuGet packages for solution.
  2. Search for HumanSecurityModule in the updates section, and update.
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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
0.16.0 187 6/18/2025
0.15.0 188 4/3/2025
0.14.1 127 1/19/2025
0.14.0 148 11/17/2024
0.13.0 174 9/17/2024
0.12.0 160 7/8/2024
0.11.0 199 3/28/2024