SimpleAuthenticationTools 1.0.29

There is a newer version of this package available.
See the version list below for details.
dotnet add package SimpleAuthenticationTools --version 1.0.29                
NuGet\Install-Package SimpleAuthenticationTools -Version 1.0.29                
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="SimpleAuthenticationTools" Version="1.0.29" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleAuthenticationTools --version 1.0.29                
#r "nuget: SimpleAuthenticationTools, 1.0.29"                
#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.
// Install SimpleAuthenticationTools as a Cake Addin
#addin nuget:?package=SimpleAuthenticationTools&version=1.0.29

// Install SimpleAuthenticationTools as a Cake Tool
#tool nuget:?package=SimpleAuthenticationTools&version=1.0.29                

Simple Authentication for ASP.NET Core

GitHub Super-Linter Nuget Nuget

A library to easily integrate Authentication in ASP.NET Core projects. Currently supports JWT Bearer and API Key Authentication.

Installation

The library is available on NuGet. Just search SimpleAuthenticationTools in the Package Manager GUI or run the following command in the Package Manager Console:

Install-Package SimpleAuthenticationTools

Usage Video

Take a look to a quick demo showing how to integrate the library:

Simple Authentication for ASP.NET Core

Configuration

Authentication can be totally configured adding an Authentication section in the appsettings.json file:

"Authentication": {
  "DefaultAuthenticationScheme": "Bearer", // Optional
  "JwtBearer": {
      "SchemeName": "Bearer" // Default Bearer
      "SecurityKey": "supersecretsecuritykey42!", // Required
      "Algorithm": "HS256", // Default HS256
      "Issuers": [ "issuer" ], // Optional
      "Audiences": [ "audience" ], // Optional
      "ExpirationTime": "01:00:00", // Default no expiration
      "ClockSkew": "00:02:00", // Default 5 minutes
      "EnableJwtBearerService": true // Default true
  },
  "ApiKey": {
      "SchemeName": "MyApiKeyScheme", // Default "ApiKey"
      // You can specify either HeaderName, QueryName or both
      "HeaderName": "x-api-key",
      "QueryName": "code",
      // Uncomment this line if you want to validate the API Key against a fixed value.
      // Otherwise, you need to register an IApiKeyValidator implementation that will be used
      // to validate the API Key.
      //"ApiKeyValue": "f1I7S5GXa4wQDgLQWgz0",
      "DefaultUserName": "ApiUser" // Required ApiKeyValue is used
  }
}

You can configure only the kind of authentication you want to use, or you can include both.

The DefaultAuthenticationScheme attribute is used to specify what kind of authentication must be configured as default. Allowed values are the values of the SchemeName attributes.

Contribute

The project is constantly evolving. Contributions are welcome. Feel free to file issues and pull requests on the repo and we'll address them as we can.

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. 
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
2.1.6 291 10/15/2024
2.1.5 123 10/9/2024
2.1.4 159 9/30/2024
2.1.3 141 9/23/2024
2.1.2 367 9/9/2024
2.0.22 157 9/2/2024
2.0.21 445 7/11/2024
2.0.18 263 7/10/2024
2.0.17 4,249 5/15/2024
2.0.16 225 5/14/2024
2.0.15 1,960 1/10/2024
2.0.14 593 12/12/2023
2.0.12 3,503 7/10/2023
2.0.10 686 6/26/2023
2.0.9 620 6/14/2023
2.0.8 758 5/9/2023
2.0.4 1,769 4/4/2023
1.0.79 1,039 1/23/2023
1.0.77 774 1/11/2023
1.0.76 733 1/8/2023
1.0.68 951 12/5/2022
1.0.64 787 12/1/2022
1.0.60 795 11/30/2022
1.0.54 835 11/15/2022
1.0.47 791 11/9/2022
1.0.46 802 11/8/2022
1.0.43 827 11/3/2022
1.0.42 789 10/27/2022
1.0.40 974 10/19/2022
1.0.38 929 9/27/2022
1.0.36 840 9/17/2022
1.0.34 976 7/25/2022
1.0.32 915 7/6/2022
1.0.30 930 6/15/2022
1.0.29 900 6/4/2022
1.0.25 894 6/3/2022
1.0.16 896 5/20/2022
1.0.13 923 5/18/2022
1.0.10 989 5/14/2022
1.0.2 967 5/13/2022