ApiKeyFilter 1.0.3
dotnet add package ApiKeyFilter --version 1.0.3
NuGet\Install-Package ApiKeyFilter -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="ApiKeyFilter" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ApiKeyFilter --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ApiKeyFilter, 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.
// Install ApiKeyFilter as a Cake Addin
#addin nuget:?package=ApiKeyFilter&version=1.0.3
// Install ApiKeyFilter as a Cake Tool
#tool nuget:?package=ApiKeyFilter&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Changes in 1.0.3
- apiKeys.sqlite is now created in a ./database folder to enable docker integration
ApiKey Filter
The package adds an ApiKey filter to your Asp.Net Core Application.
The API Keys are organized in an SQLite database. The Roles can be defined as string.
Installation
Make sure that your ConfigureServices contains the following lines. You have to specify a master key
public void ConfigureServices(IServiceCollection services) {
services.AddControllers(
e => e.Filters.Add<ApiFilter>()
);
services.AddApiKeyController("00000000-0000-0000-0000-000000000000");
}
Usage
To apply a filter to a controller just add the filter attribute to your controller
[ApiKeyFilter.LevelFilter("weather")]
public class WeatherForecastController : ControllerBase {
Access control
To add a new API key call the url
POST http://{baseUrlOfHostProject}/api/accessControl/ApiKey
{
"description": "New Api Key"
}
as a response you get the new API Key
{
"description": "New Api Key",
"roles": null,
"id": "a86b941b-0000-0000-0000-d1c7f68b5022",
"created": "2020-10-09T05:24:54.1935783+00:00",
"deleted": null
}
To add an API key to a specific role call
POST http://{baseUrlOfHostProject}/api/accessControl/ApiKey/a86b941b-0000-0000-0000-d1c7f68b5022/role/<NameOfRole>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- AutoMapper (>= 10.0.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.EntityFrameworkCore.Relational.Design (>= 1.1.6)
- Microsoft.EntityFrameworkCore.Sqlite (>= 3.1.8)
- Microsoft.EntityFrameworkCore.Sqlite.Core (>= 3.1.8)
- Microsoft.EntityFrameworkCore.Sqlite.Design (>= 1.1.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.