From d458ca6486d4a4ed0e8493ec6f3d8c4afce6b6a7 Mon Sep 17 00:00:00 2001 From: JudahGabriel Date: Tue, 5 Sep 2017 12:25:38 -0500 Subject: [PATCH] Added overload for AddRavenDbIdentity to allow identity configuration options. --- RavenDB.Identity/RavenDB.Identity.csproj | 2 +- .../ServiceCollectionExtensions.cs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/RavenDB.Identity/RavenDB.Identity.csproj b/RavenDB.Identity/RavenDB.Identity.csproj index f43b5bc..5556bcd 100644 --- a/RavenDB.Identity/RavenDB.Identity.csproj +++ b/RavenDB.Identity/RavenDB.Identity.csproj @@ -18,7 +18,7 @@ false false false - 2.0.2 + 2.0.3 False diff --git a/RavenDB.Identity/ServiceCollectionExtensions.cs b/RavenDB.Identity/ServiceCollectionExtensions.cs index 9c5b6c4..cfd01dd 100644 --- a/RavenDB.Identity/ServiceCollectionExtensions.cs +++ b/RavenDB.Identity/ServiceCollectionExtensions.cs @@ -94,5 +94,25 @@ namespace RavenDB.Identity return services; } + + /// + /// Registers a RavenDB as the user store. + /// + /// The type of user. This should be a class you created derived from . + /// + /// Identity options configuration. + /// The same service collection so that multiple calls can be chained. + public static IServiceCollection AddRavenDbIdentity(this IServiceCollection services, Action setupAction) + where TUser : IdentityUser + { + // Add the AspNet identity system to work with our RavenDB identity objects. + services.AddIdentity(setupAction) + .AddDefaultTokenProviders(); + + services.AddScoped, UserStore>(); + services.AddScoped, RoleStore>(); + + return services; + } } }