A2v10.Identity.ApiKey
10.1.8647
dotnet add package A2v10.Identity.ApiKey --version 10.1.8647
NuGet\Install-Package A2v10.Identity.ApiKey -Version 10.1.8647
<PackageReference Include="A2v10.Identity.ApiKey" Version="10.1.8647" />
<PackageVersion Include="A2v10.Identity.ApiKey" Version="10.1.8647" />
<PackageReference Include="A2v10.Identity.ApiKey" />
paket add A2v10.Identity.ApiKey --version 10.1.8647
#r "nuget: A2v10.Identity.ApiKey, 10.1.8647"
#:package A2v10.Identity.ApiKey@10.1.8647
#addin nuget:?package=A2v10.Identity.ApiKey&version=10.1.8647
#tool nuget:?package=A2v10.Identity.ApiKey&version=10.1.8647
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.1.4" />
and add the following code to Startup.cs:
using Microsoft.OpenApi;
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v3", new OpenApiInfo { Title = API_NAME, Version = "v3" });
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>()
}
}
);
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});
// UseSwagger ALWAYS before app.UseRouting()!
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v3/swagger.json", $"{API_NAME} v3"));
Related Packages
Feedback
A2v10.Identity.ApiKey is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
| Product | Versions 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. |
-
net10.0
- A2v10.Identity.Core (>= 10.1.8647)
-
net8.0
- A2v10.Identity.Core (>= 10.1.8647)
-
net9.0
- A2v10.Identity.Core (>= 10.1.8647)
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.8647 | 92 | 7/15/2026 |
| 10.1.8642 | 132 | 6/27/2026 |
| 10.1.8639 | 168 | 6/7/2026 |
| 10.1.8637 | 219 | 5/8/2026 |
| 10.1.8634 | 123 | 4/21/2026 |
| 10.1.8631 | 232 | 3/29/2026 |
| 10.1.8630 | 130 | 3/24/2026 |
| 10.1.8624 | 175 | 3/4/2026 |
| 10.1.8622 | 283 | 2/24/2026 |
| 10.1.8620 | 206 | 1/17/2026 |
| 10.1.8600 | 603 | 12/1/2025 |
| 10.1.8575 | 383 | 10/19/2025 |
| 10.1.8573 | 295 | 10/1/2025 |
| 10.1.8570 | 363 | 8/28/2025 |
| 10.1.8566 | 279 | 8/18/2025 |
| 10.1.8565 | 276 | 8/12/2025 |
| 10.1.8563 | 424 | 7/26/2025 |
| 10.1.8558 | 331 | 6/19/2025 |
| 10.1.8554 | 368 | 6/9/2025 |
| 10.1.8553 | 270 | 6/4/2025 |