AspNetCore.Identity.Cassandra.Niki
7.0.1
dotnet add package AspNetCore.Identity.Cassandra.Niki --version 7.0.1
NuGet\Install-Package AspNetCore.Identity.Cassandra.Niki -Version 7.0.1
<PackageReference Include="AspNetCore.Identity.Cassandra.Niki" Version="7.0.1" />
paket add AspNetCore.Identity.Cassandra.Niki --version 7.0.1
#r "nuget: AspNetCore.Identity.Cassandra.Niki, 7.0.1"
// Install AspNetCore.Identity.Cassandra.Niki as a Cake Addin
#addin nuget:?package=AspNetCore.Identity.Cassandra.Niki&version=7.0.1
// Install AspNetCore.Identity.Cassandra.Niki as a Cake Tool
#tool nuget:?package=AspNetCore.Identity.Cassandra.Niki&version=7.0.1
ASP.NET Core Identity Cassandra
Apache Cassandra data store adapter for ASP.NET Core Identity, which allows you to build ASP.NET Core web applications, including membership, login, and user data. With this library, you can store your user's membership related data on Apache Cassandra.
Inspired by existing AspNetCore.Identity.RaveDB implementation.
Installation
You can install AspNetCore.Identity.Cassandra via NuGet. Run the following command in the NuGet Package Manager Console:
PM> Install-Package AspNetCore.Identity.Cassandra.Niki
Usage
To use the AspNetCore.Identity.Cassandra, follow these steps:
- Create your own User and Role entities:
[Table("roles", Keyspace = "identity")]
public class ApplicationRole : CassandraIdentityRole
{
public ApplicationRole()
: base(Guid.NewGuid())
{ }
}
[Table("users", Keyspace = "identity")]
public class ApplicationUser : CassandraIdentityUser
{
public ApplicationUser()
: base(Guid.NewGuid())
{ }
}
- Configure options for Cassandra in the
appsettings.json
file:
{
"Cassandra": {
"ContactPoints": [
"127.0.0.1"
],
"Port": 9042,
"RetryCount": 5,
"Credentials": {
"UserName": "cassandra",
"Password": "cassandra"
},
"KeyspaceName": "kanyafields",
"Replication": {
"class": "SimpleStrategy",
"replication_factor": "2"
},
"Query": {
"ConsistencyLevel": "One",
"TracingEnabled": false,
"PageSize": 25
}
}
}
- Configure the following services:
public void ConfigureServices(IServiceCollection services)
{
services.AddCassandra(Configuration);
services.AddIdentity<ApplicationUser, ApplicationRole>()
.AddCassandraErrorDescriber<CassandraErrorDescriber>()
.UseCassandraStores<Cassandra.ISession>()
.AddDefaultTokenProviders();
// will create all Identity related tables (if not exist) in the Cassandra database
// on the application startup
services.AddHostedService<CassandraIdentityInfrastructureInitializer<ApplicationUser, ApplicationRole>>();
...
}
- Resolve
UserManager
,RoleManager
orSignInManager
wherever you need them:
public IndexModel(
UserManager<ApplicationUser> userManager,
RoleManager<ApplicationRole> roleManager,
SignInManager<ApplicationUser> signInManager,
IEmailSender emailSender)
{
_userManager = userManager;
_roleManager = roleManager;
_signInManager = signInManager;
_emailSender = emailSender;
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- CassandraCSharpDriver (>= 3.19.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Identity.Stores (>= 7.0.9)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- Polly (>= 7.2.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.