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; + } } }