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.
<PackageVersion Include="ApiKeyFilter" Version="1.0.3" />
<PackageReference Include="ApiKeyFilter" />
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 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.
#:package ApiKeyFilter@1.0.3
#: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=ApiKeyFilter&version=1.0.3
#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. 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. |
.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.