ApiAuthorization.Plugin
5.7.0
dotnet add package ApiAuthorization.Plugin --version 5.7.0
NuGet\Install-Package ApiAuthorization.Plugin -Version 5.7.0
<PackageReference Include="ApiAuthorization.Plugin" Version="5.7.0" />
paket add ApiAuthorization.Plugin --version 5.7.0
#r "nuget: ApiAuthorization.Plugin, 5.7.0"
// Install ApiAuthorization.Plugin as a Cake Addin #addin nuget:?package=ApiAuthorization.Plugin&version=5.7.0 // Install ApiAuthorization.Plugin as a Cake Tool #tool nuget:?package=ApiAuthorization.Plugin&version=5.7.0
This package is one of many packages that can be used with Plugin Manager which can be used to extend any c#/.net based application (MVC, Winform, WPF, MAUI etc) by using a Modular Approach.
API Authorization Plugin
There are many different ways in which you can secure an Api endpoint so that the resources are only used by those authorised to use them.
When writing open and accesible Api's that can be used across a public domain it is important to follow some basic principles, these being:
- Prioritize Security. Think about the type of security that you want to employ for endpoints at the start of a project, do not leave it as an afterthought, or believe that it's somebody elses issue.
- Use a strong authentication solution. Authenticating a user, using industry standard techniques can help protect data and ensure that only those requiring access to data are able to get access.
- Use authorization. Just because a user can authenticate, it does not mean the should have carte blanche once authentication is successfull. Using a principal of least privilege can help ensure that a user is not authorized to perform any action unless that action has been specifically granted.
Implementing Api Authorization
Api authorization is accomplished by applying an attribute to the endpoint or controller for all endpoints and implementing two interfaces
ApiAuthorizationAttribute. An attribute that is put on each controller or individual action endpoint. IApiAuthorizationService. The application must register an instance of IApiAuthorizationService within the service container. This interface contains one method and is used by the attribute to validate the request. IUserApiQueryProvider. The application must register an instance of IUserApiQueryProvider within the service container.
Product | Versions 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 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. net9.0 is compatible. 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. |
-
net6.0
- ApplicationSettings (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Middleware (>= 5.7.0)
- PluginManager (>= 5.7.0)
- SC.Shared.Library.Core (>= 3.17.0)
- SharedPluginFeatures (>= 5.7.0)
-
net8.0
- ApplicationSettings (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Middleware (>= 5.7.0)
- PluginManager (>= 5.7.0)
- SC.Shared.Library.Core (>= 3.17.0)
- SharedPluginFeatures (>= 5.7.0)
-
net9.0
- ApplicationSettings (>= 2.3.0)
- Microsoft.Extensions.Configuration (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.Configuration.Json (>= 9.0.0)
- Middleware (>= 5.7.0)
- PluginManager (>= 5.7.0)
- SC.Shared.Library.Core (>= 3.17.0)
- SharedPluginFeatures (>= 5.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Supports net 6.0, net8.0 and net9.0