A2v10.Identity.ApiKey 10.1.8630

There is a newer version of this package available.
See the version list below for details.
dotnet add package A2v10.Identity.ApiKey --version 10.1.8630
                    
NuGet\Install-Package A2v10.Identity.ApiKey -Version 10.1.8630
                    
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="A2v10.Identity.ApiKey" Version="10.1.8630" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="A2v10.Identity.ApiKey" Version="10.1.8630" />
                    
Directory.Packages.props
<PackageReference Include="A2v10.Identity.ApiKey" />
                    
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 A2v10.Identity.ApiKey --version 10.1.8630
                    
#r "nuget: A2v10.Identity.ApiKey, 10.1.8630"
                    
#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 A2v10.Identity.ApiKey@10.1.8630
                    
#: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=A2v10.Identity.ApiKey&version=10.1.8630
                    
Install as a Cake Addin
#tool nuget:?package=A2v10.Identity.ApiKey&version=10.1.8630
                    
Install as a Cake Tool

About

A2v10.Identity.ApiKey allows the ApiKey authorization for the A2v10 platform applications.

How to use

The ApiKey may be plain text (KeyType.ApiKey) or contain encoded user claims (KeyType.EncodedClaims).

If you use KeyType.EncodedClaims, you must specify the encryption key and vector.

Use

ApiKeyUserHelper<T>.GenerateApiKey(User, Сonfiguration)

for generate encoded ApiKey.

// T - type of user identifier
.AddApiKeyAuthorization<T>(options => {
    // options is read only
});

// configure
services.Configure<ApiKeyConfigurationOptions>(options =>
{
	options.KeyType = KeyType.EncodedClaims; /* or KeyType.ApiKey */
	/* for KeyType.EncodedClaims */
	options.AesEncryptKey = "Aes_Encrypt_Key";
	options.AesEncryptVector = "Aes_Encrypt_Vector";
	options.SkipCheckUser = true;
	/* or */
	options.Configure<Int64>(KeyType.EncodedClaims, Configuration);
});

appsettings.json (for KeyType.EncodedClaims)

"AesEncrypt": {
	"Key": "my_encrypt_key_1", /* 16 chars min */
	"Vector": "my_encrypt_vector_1" /* 16 chars min */
}

Configure Swagger

Add PackageReference to Swashbuckle.AspNetCore:

<PackageReference Include="Swashbuckle.AspNetCore" Version="10.0.0" />

and add the following code to Startup.cs:

using Microsoft.OpenApi;

services.AddSwaggerGen(c =>
{
	c.AddSecurityDefinition(ApiKeyAuthenticationOptions.Scheme, 
		new OpenApiSecurityScheme()
		{
			Type = SecuritySchemeType.ApiKey,
            In = ParameterLocation.Header,
            Name = ApiKeyAuthenticationOptions.HeaderName,
            Scheme = ApiKeyAuthenticationOptions.Scheme
        }
	);

	c.AddSecurityRequirement(doc => 
		new OpenApiSecurityRequirement()
		{
			{
				new OpenApiSecuritySchemeReference(ApiKeyAuthenticationOptions.Scheme, doc),
				new List<String>()
            }
		}
	);
});

Feedback

A2v10.Identity.ApiKey is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET 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.  net10.0 is compatible.  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
10.1.8650 103 8/18/2026
10.1.8647 217 7/15/2026
10.1.8642 146 6/27/2026
10.1.8639 179 6/7/2026
10.1.8637 225 5/8/2026
10.1.8634 130 4/21/2026
10.1.8631 240 3/29/2026
10.1.8630 139 3/24/2026
10.1.8624 189 3/4/2026
10.1.8622 299 2/24/2026
10.1.8620 218 1/17/2026
10.1.8600 612 12/1/2025
10.1.8575 390 10/19/2025
10.1.8573 304 10/1/2025
10.1.8570 372 8/28/2025
10.1.8566 288 8/18/2025
10.1.8565 286 8/12/2025
10.1.8563 432 7/26/2025
10.1.8558 338 6/19/2025
10.1.8554 376 6/9/2025
Loading failed