All Projects → JudahGabriel → Ravendb.identity

JudahGabriel / Ravendb.identity

Licence: mit
RavenDB Identity provider for ASP.NET Core. Let RavenDB manage your users and logins.

Projects that are alternatives of or similar to Ravendb.identity

Security.identity
.NET DevPack Identity is a set of common implementations to help you implementing Identity, Jwt, claims validation and another facilities
Stars: ✭ 165 (+230%)
Mutual labels:  asp-net-core, identity
identityazuretable
This project provides a high performance cloud solution for ASP.NET Identity Core using Azure Table storage replacing the Entity Framework / MSSQL provider.
Stars: ✭ 97 (+94%)
Mutual labels:  identity, asp-net-core
Identitymanager2
Development tool for administering users and roles
Stars: ✭ 164 (+228%)
Mutual labels:  asp-net-core, identity
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+2390%)
Mutual labels:  asp-net-core, identity
Identity.Firebase
ASP.NET Identity Firebase Provider
Stars: ✭ 23 (-54%)
Mutual labels:  identity, asp-net-core
Active Directory B2c Dotnetcore Webapp
An ASP.NET Core web application that can sign in a user using Azure AD B2C, get an access token using MSAL.NET and call an API.
Stars: ✭ 160 (+220%)
Mutual labels:  asp-net-core, identity
Aspnetcore2jwtauthentication
Jwt Authentication without ASP.NET Core Identity
Stars: ✭ 218 (+336%)
Mutual labels:  asp-net-core, identity
Aspnetcore.identity.mongodbcore
A MongoDb UserStore and RoleStore adapter for Microsoft.AspNetCore.Identity 2.2. Allows you to use MongoDb instead of SQL server with Microsoft.AspNetCore.Identity 2.2. (not Identity 3.0)
Stars: ✭ 118 (+136%)
Mutual labels:  asp-net-core, identity
Cosmos.Identity
A Cosmos storage provider for ASP.NET Core Identity.
Stars: ✭ 26 (-48%)
Mutual labels:  identity, nosql
CleanArchitecture-Template
This is a solution template for Clean Architecture and CQRS implementation with ASP.NET Core.
Stars: ✭ 60 (+20%)
Mutual labels:  identity, asp-net-core
Aspnetcoreid4external
external OpenID Connect Login to IdentityServer4 with AAD
Stars: ✭ 63 (+26%)
Mutual labels:  asp-net-core, identity
Aspnetcore2cookieauthentication
Cookie Authentication without ASP.NET Core Identity 3.x
Stars: ✭ 19 (-62%)
Mutual labels:  asp-net-core, identity
Aspnetcore.identity.mongo
This is a MongoDB provider for the ASP.NET Core 2 Identity framework
Stars: ✭ 179 (+258%)
Mutual labels:  asp-net-core, identity
grandnode2
Free, Open source, Fast, Headless, Multi-tenant eCommerce platform built with .NET Core, MongoDB, AWS DocumentDB, Azure CosmosDB, LiteDB, Vue.js.
Stars: ✭ 626 (+1152%)
Mutual labels:  nosql, asp-net-core
Jpproject.identityserver4.adminui
🔧 ASP.NET Core 3 & Angular 8 Administration Panel for 💞IdentityServer4 and ASP.NET Core Identity
Stars: ✭ 717 (+1334%)
Mutual labels:  asp-net-core, identity
Identity.redis
ASP.NET Identity Redis Provider
Stars: ✭ 22 (-56%)
Mutual labels:  asp-net-core, identity
Active Directory B2c Dotnet Desktop
Sample showing how a Windows Desktop .NET (WPF) application can sign in a user using Azure AD B2C, get an access token using MSAL.NET and call an API.
Stars: ✭ 39 (-22%)
Mutual labels:  identity
Vue.js With Asp.net Core Sample
This provides a sample code using vue.js running on ASP.NET Core
Stars: ✭ 44 (-12%)
Mutual labels:  asp-net-core
Simplerpc
A simple and fast contractless RPC library for .NET and .NET Core
Stars: ✭ 39 (-22%)
Mutual labels:  asp-net-core
Ant Design Blazor
Enterprise-class UI components based on Ant Design and Blazor.
Stars: ✭ 39 (-22%)
Mutual labels:  asp-net-core

RavenDB.Identity

The simple and easy Identity provider for RavenDB and ASP.NET Core. Use Raven to store your users and roles.

Instructions

Important: Upgrading from a previous version of RavenDB.Identity? See Updating From Old Version for steps to migrate to the latest RavenDB.Identity.

  1. Add an AppUser class that derives from Raven.Identity.IdentityUser:
public class AppUser : Raven.Identity.IdentityUser
{
    /// <summary>
    /// A user's full name.
    /// </summary>
    public string FullName { get; set; }
}
  1. In appsettings.json, configure your connection to Raven:
"RavenSettings": {
    "Urls": [
        "http://live-test.ravendb.net"
    ],
    "DatabaseName": "Raven.Identity.Sample.RazorPages",
    "CertFilePath": "",
    "CertPassword": ""
},

3a. In Startup.cs, wire it all up. Note that this approach will use the email address as part of the User Id, such that changing their email will change their User Id as well:

public void ConfigureServices(IServiceCollection services)
{    
    // Add RavenDB and identity.
    services
        .AddRavenDbDocStore() // Create an IDocumentStore singleton from the RavenSettings.
        .AddRavenDbAsyncSession() // Create a RavenDB IAsyncDocumentSession for each request. You're responsible for calling .SaveChanges after each request.
        .AddIdentity<AppUser, IdentityRole>() // Adds an identity system to ASP.NET Core
        .AddRavenDbIdentityStores<AppUser, IdentityRole>(); // Use RavenDB as the store for identity users and roles. Specify your app user type here, and your role type. If you don't have a role type, use Raven.Identity.IdentityRole.
    ...
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ...
    // Instruct ASP.NET Core to use authentication and authorization.
    app.UseAuthentication();
    app.UseAuthorization();
    ...
}
  1. In your controller actions, call .SaveChangesAsync() when you're done making changes. Typically this is done via a RavenController base class for MVC/WebAPI projects or via a page filter for Razor Pages projects.

Changing how user IDs are generated

Previous versions of RavenDB.Identity used email-based user IDs, e.g. "AppUser/[email protected]". Newer versions use Raven's default behavior, typically"AppUsers/1-A"`. To change how Raven controls IDs for your users, see Raven's Global Identifier Generation Conventions.

If you have old users in your database using the email-based ID convention, no problem, Raven.Identity will still work with the old users. If you want consistent IDs across all your users, you can migrate existing users to a new ID generation scheme using the ChangeUserIdType migration:

// Important: backup your database before running this migration.
var newIdType = UserIdType.ServerGenerated; // Or whatever ID type you prefer.
var migration = new Raven.Identity.Migrations.ChangeUserIdType(docStore, newIdType);
migration.Migrate<AppUser>(); // AppUser, or whatever you user type is.

Regardless of how IDs are generated, uniqueness is based on email address. You can't have 2 users in your database with the same email address.

Modifying RavenDB conventions

Need to modify RavenDB conventions? You can use the services.AddRavenDbDocStore(options) overload:

services.AddRavenDbDocStore(options =>
{
    // Maybe we want to change the identity parts separator.
    options.BeforeInitializeDocStore = docStore => docStore.Conventions.IdentityPartsSeparator = "-";
})

Updating From Old Version of RavenDB.Identity

Using RavenDB.Identity v5 or earlier and want to upgrade to the latest? You need to run the CompareExchangeUniqueness migration:

// Important: backup your database before running this migration.
var migration = new Raven.Identity.Migrations.CompareExchangeUniqueness(docStore);
migration.Migrate();

This upgrade step is necessary because we updated RavenDB.Identity to use RavenDB's cluster-safe compare/exchange to enforce email-based uniqueness.

Previous versions of RavenDB.Identity had relied on IdentityUserByUserName IDs to enforce uniqueness, but this isn't guaranteed to work in a cluster. Doing this migration will create compare/exchange values in Raven for each user email address, and will remove the now-obsolete IdentityUserByUserNames collection.

Getting Started and Sample Project

Need help? Checkout the our samples to see how to use it:

Not using .NET Core?

See our sister project for a RavenDB Identity Provider for the full .NET Framework.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].