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
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="AspNetCore.Identity.Cassandra.Niki" Version="7.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNetCore.Identity.Cassandra.Niki --version 7.0.1
#r "nuget: AspNetCore.Identity.Cassandra.Niki, 7.0.1"
#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.
// 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

NuGet

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:

  1. 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())
    { }
}
  1. 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
    }
  }
}
  1. 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>>();

    ...
}
  1. Resolve UserManager, RoleManager or SignInManager 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 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. 
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
7.0.1 181 7/19/2023
7.0.0 158 7/19/2023