From 88384836b559aef400e3a3c928fba9323822130e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 12 Sep 2018 00:15:59 -0400 Subject: [PATCH] get rid of AddBasicCustomIdentityServices --- src/Admin/Startup.cs | 1 - .../Utilities/ServiceCollectionExtensions.cs | 28 ++++++------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index 7ab672d115..f526c9a8f4 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -47,7 +47,6 @@ namespace Bit.Admin services.AddScoped(); // Identity - services.AddBasicCustomIdentityServices(globalSettings); services.AddPasswordlessIdentityServices(globalSettings); if(globalSettings.SelfHosted) { diff --git a/src/Core/Utilities/ServiceCollectionExtensions.cs b/src/Core/Utilities/ServiceCollectionExtensions.cs index f626287b7d..f8a755468e 100644 --- a/src/Core/Utilities/ServiceCollectionExtensions.cs +++ b/src/Core/Utilities/ServiceCollectionExtensions.cs @@ -153,13 +153,15 @@ namespace Bit.Core.Utilities public static IdentityBuilder AddCustomIdentityServices( this IServiceCollection services, GlobalSettings globalSettings) { + services.TryAddTransient(); services.AddSingleton(); + services.Configure(options => options.IterationCount = 100000); services.Configure(options => { options.TokenLifespan = TimeSpan.FromDays(30); }); - - var identityBuilder = services.AddBasicCustomIdentityServices(globalSettings, options => + + var identityBuilder = services.AddIdentityWithoutCookieAuth(options => { options.User = new UserOptions { @@ -184,6 +186,9 @@ namespace Bit.Core.Utilities }); identityBuilder + .AddUserStore() + .AddRoleStore() + .AddTokenProvider>(TokenOptions.DefaultProvider) .AddTokenProvider(TwoFactorProviderType.Authenticator.ToString()) .AddTokenProvider(TwoFactorProviderType.YubiKey.ToString()) .AddTokenProvider(TwoFactorProviderType.Duo.ToString()) @@ -194,25 +199,8 @@ namespace Bit.Core.Utilities return identityBuilder; } - public static IdentityBuilder AddBasicCustomIdentityServices( - this IServiceCollection services, GlobalSettings globalSettings, - Action setAction = null) - { - services.TryAddTransient(); - services.Configure(options => options.IterationCount = 100000); - - var identityBuilder = services.AddIdentityWithoutCookieAuth(setAction); - - identityBuilder - .AddUserStore() - .AddRoleStore() - .AddTokenProvider>(TokenOptions.DefaultProvider); - - return identityBuilder; - } - public static IdentityBuilder AddPasswordlessIdentityServices( - this IServiceCollection services, GlobalSettings globalSettings) where TUserStore : class + this IServiceCollection services, GlobalSettings globalSettings) where TUserStore : class { services.TryAddTransient(); services.Configure(options =>