2019-03-04 17:13:26 -06:00
2019-03-04 17:11:14 -06:00
2017-08-21 10:06:27 -05:00
2017-08-23 13:47:22 -05:00
2019-03-04 17:13:26 -06:00

RavenDB.Identity

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

Instructions

  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",
    "CertFilePath": "",
    "CertPassword": ""
},
  1. In Startup.cs, wire it all up:
public void ConfigureServices(IServiceCollection services)
{
    // Grab our RavenSettings object from appsettings.json.
    services.Configure<RavenSettings>(Configuration.GetSection("RavenSettings"));
    
    ...
    
    // 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.
        .AddRavenDbIdentity<AppUser>(); // Use Raven to manage users and roles.
    
    ...
}
  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 an action filter. See our sample RavenSaveChangesAsyncFilter.cs.

Need help? Checkout the sample app to see it all in action.

Not using .NET Core? See our sister project for a RavenDB Identity Provider for the full .NET Framework.

S
Description
RavenDB Identity provider for ASP.NET Core. Let RavenDB manage your users and logins.
Readme 1.3 MiB
Languages
C# 100%