Browse Source

Use PreConfigure configure identityBuild

pull/4443/head
liangshiwei 6 years ago
parent
commit
f55f57309f
  1. 14
      modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreModule.cs

14
modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpIdentityAspNetCoreModule.cs

@ -9,13 +9,17 @@ namespace Volo.Abp.Identity.AspNetCore
)] )]
public class AbpIdentityAspNetCoreModule : AbpModule public class AbpIdentityAspNetCoreModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)
{ {
context.Services PreConfigure<IdentityBuilder>(builder =>
.GetObject<IdentityBuilder>() {
.AddDefaultTokenProviders() builder.AddDefaultTokenProviders();
.AddSignInManager(); builder.AddSignInManager();
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
//(TODO: Extract an extension method like IdentityBuilder.AddAbpSecurityStampValidator()) //(TODO: Extract an extension method like IdentityBuilder.AddAbpSecurityStampValidator())
context.Services.AddScoped<AbpSecurityStampValidator>(); context.Services.AddScoped<AbpSecurityStampValidator>();
context.Services.AddScoped(typeof(SecurityStampValidator<IdentityUser>), provider => provider.GetService(typeof(AbpSecurityStampValidator))); context.Services.AddScoped(typeof(SecurityStampValidator<IdentityUser>), provider => provider.GetService(typeof(AbpSecurityStampValidator)));

Loading…
Cancel
Save