AspNetCore.Identity.AmazonDynamoDB
2.2.0
dotnet add package AspNetCore.Identity.AmazonDynamoDB --version 2.2.0
NuGet\Install-Package AspNetCore.Identity.AmazonDynamoDB -Version 2.2.0
<PackageReference Include="AspNetCore.Identity.AmazonDynamoDB" Version="2.2.0" />
<PackageVersion Include="AspNetCore.Identity.AmazonDynamoDB" Version="2.2.0" />
<PackageReference Include="AspNetCore.Identity.AmazonDynamoDB" />
paket add AspNetCore.Identity.AmazonDynamoDB --version 2.2.0
#r "nuget: AspNetCore.Identity.AmazonDynamoDB, 2.2.0"
#:package AspNetCore.Identity.AmazonDynamoDB@2.2.0
#addin nuget:?package=AspNetCore.Identity.AmazonDynamoDB&version=2.2.0
#tool nuget:?package=AspNetCore.Identity.AmazonDynamoDB&version=2.2.0
AspNetCore.Identity.AmazonDynamoDB
An ASP.NET Core Identity provider for DynamoDB, targeting .NET 8, 9 and 10. On .NET 10 it also stores passkey (WebAuthn) credentials through IUserPasskeyStore<TUser>.
Getting Started
You can install the latest version via Nuget:
> dotnet add package AspNetCore.Identity.AmazonDynamoDB
Then you use the stores by calling AddDynamoDbStores on IdentityBuilder:
services
.AddIdentityCore<DynamoDbUser>()
.AddRoles<DynamoDbRole>()
.AddDynamoDbStores()
.Configure(options =>
{
options.BillingMode = BillingMode.PROVISIONED; // Default is BillingMode.PAY_PER_REQUEST
options.ProvisionedThroughput = new ProvisionedThroughput
{
ReadCapacityUnits = 5, // Default is 1
WriteCapacityUnits = 5, // Default is 1
};
options.DefaultTableName = "my-custom-identity-table-name"; // Default is identity
options.ResolveRoleNames = true; // Default is false, see Role Names below
});
Finally, you need to ensure that tables and indexes have been added:
AspNetCoreIdentityDynamoDbSetup.EnsureInitialized(serviceProvider);
Or asynchronously:
await AspNetCoreIdentityDynamoDbSetup.EnsureInitializedAsync(serviceProvider);
The table is created if it doesn't exist. If it already exists, any global secondary index that is missing from it (such as CredentialId-index, used to look up users by passkey) is added and the call waits until the index is active. New indexes use provisioned throughput from the options when the existing table is provisioned, and on-demand capacity otherwise. It's safe to call from several instances at the same time.
The call needs the dynamodb:DescribeTable permission on the table, plus dynamodb:CreateTable to create it and dynamodb:UpdateTable to add a missing index. Without dynamodb:DescribeTable it falls back to dynamodb:ListTables and only checks that the table exists. If an index can't be added because dynamodb:UpdateTable is missing, a warning is logged instead of failing.
The IServiceProvider overloads log progress and warnings through the registered ILoggerFactory.
Role Names
Users store the normalized names of their roles, so by default UserManager.GetRolesAsync returns ADMIN for a role named Admin, and that is also the value of the role claims in the user's cookie. ClaimsPrincipal.IsInRole and [Authorize(Roles = "...")] compare role names case sensitively, so they need to use the normalized name.
Set ResolveRoleNames (or call ResolveRoleNames() on the builder) to return the names of the roles instead, as the Entity Framework Core stores do. Each role is then looked up by its normalized name when the user's roles are read, and roles that can't be found are returned with their normalized name.
Tests
To run the tests, you need to have DynamoDB running locally on localhost:8000. This can easily be done using Docker and the following command:
docker run -p 8000:8000 amazon/dynamodb-local
Adding Attributes
To add custom attributes to the user or role model, you would need to create a new class that extends the DynamoDbUser or DynamoDbRole and adds the needed additional attributes.
public class CustomUser : DynamoDbUser
{
public string? ProfilePictureUrl { get; set; }
}
Then you need to use your new classes when adding the DynamoDB stores:
services
.AddIdentityCore<CustomUser>()
.AddRoles<CustomRole>()
.AddDynamoDbStores();
| 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
- AWSSDK.DynamoDBv2 (>= 4.0.107)
- Microsoft.Extensions.DependencyInjection.AutoActivation (>= 10.10.0)
- Microsoft.Extensions.Identity.Stores (>= 10.0.12)
-
net8.0
- AWSSDK.DynamoDBv2 (>= 4.0.107)
- Microsoft.Extensions.DependencyInjection.AutoActivation (>= 10.10.0)
- Microsoft.Extensions.Identity.Stores (>= 8.0.31)
-
net9.0
- AWSSDK.DynamoDBv2 (>= 4.0.107)
- Microsoft.Extensions.DependencyInjection.AutoActivation (>= 10.10.0)
- Microsoft.Extensions.Identity.Stores (>= 9.0.20)
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 |
|---|---|---|
| 2.2.0 | 264 | 9/30/2026 |
| 2.1.0 | 95 | 9/30/2026 |
| 2.0.1 | 707 | 10/28/2025 |
| 2.0.0 | 690 | 2/2/2025 |
| 1.2.4 | 1,104 | 10/4/2024 |
| 1.2.3 | 250 | 10/4/2024 |
| 1.2.1 | 324 | 9/26/2024 |
| 1.2.0 | 952 | 7/7/2024 |
| 1.1.3 | 1,090 | 3/23/2024 |
| 1.1.2 | 350 | 1/22/2024 |
| 1.1.1 | 274 | 1/21/2024 |
| 1.1.0 | 357 | 11/27/2023 |
| 1.0.2 | 600 | 10/29/2023 |
| 1.0.1 | 1,288 | 1/28/2023 |
| 1.0.0 | 552 | 1/6/2023 |
| 0.2.0 | 629 | 10/15/2022 |
| 0.1.3 | 593 | 10/5/2022 |
| 0.1.2 | 533 | 10/5/2022 |
| 0.1.1 | 530 | 10/2/2022 |