mirror of
https://github.com/bitwarden/server.git
synced 2025-02-24 03:11:22 +01:00
get rid of AddBasicCustomIdentityServices
This commit is contained in:
parent
f359ef4ee2
commit
88384836b5
@ -47,7 +47,6 @@ namespace Bit.Admin
|
||||
services.AddScoped<CurrentContext>();
|
||||
|
||||
// Identity
|
||||
services.AddBasicCustomIdentityServices(globalSettings);
|
||||
services.AddPasswordlessIdentityServices<ReadOnlyEnvIdentityUserStore>(globalSettings);
|
||||
if(globalSettings.SelfHosted)
|
||||
{
|
||||
|
@ -153,13 +153,15 @@ namespace Bit.Core.Utilities
|
||||
public static IdentityBuilder AddCustomIdentityServices(
|
||||
this IServiceCollection services, GlobalSettings globalSettings)
|
||||
{
|
||||
services.TryAddTransient<ILookupNormalizer, LowerInvariantLookupNormalizer>();
|
||||
services.AddSingleton<IOrganizationDuoWebTokenProvider, OrganizationDuoWebTokenProvider>();
|
||||
services.Configure<PasswordHasherOptions>(options => options.IterationCount = 100000);
|
||||
services.Configure<TwoFactorRememberTokenProviderOptions>(options =>
|
||||
{
|
||||
options.TokenLifespan = TimeSpan.FromDays(30);
|
||||
});
|
||||
|
||||
var identityBuilder = services.AddBasicCustomIdentityServices(globalSettings, options =>
|
||||
var identityBuilder = services.AddIdentityWithoutCookieAuth<User, Role>(options =>
|
||||
{
|
||||
options.User = new UserOptions
|
||||
{
|
||||
@ -184,6 +186,9 @@ namespace Bit.Core.Utilities
|
||||
});
|
||||
|
||||
identityBuilder
|
||||
.AddUserStore<UserStore>()
|
||||
.AddRoleStore<RoleStore>()
|
||||
.AddTokenProvider<DataProtectorTokenProvider<User>>(TokenOptions.DefaultProvider)
|
||||
.AddTokenProvider<AuthenticatorTokenProvider>(TwoFactorProviderType.Authenticator.ToString())
|
||||
.AddTokenProvider<YubicoOtpTokenProvider>(TwoFactorProviderType.YubiKey.ToString())
|
||||
.AddTokenProvider<DuoWebTokenProvider>(TwoFactorProviderType.Duo.ToString())
|
||||
@ -194,25 +199,8 @@ namespace Bit.Core.Utilities
|
||||
return identityBuilder;
|
||||
}
|
||||
|
||||
public static IdentityBuilder AddBasicCustomIdentityServices(
|
||||
this IServiceCollection services, GlobalSettings globalSettings,
|
||||
Action<IdentityOptions> setAction = null)
|
||||
{
|
||||
services.TryAddTransient<ILookupNormalizer, LowerInvariantLookupNormalizer>();
|
||||
services.Configure<PasswordHasherOptions>(options => options.IterationCount = 100000);
|
||||
|
||||
var identityBuilder = services.AddIdentityWithoutCookieAuth<User, Role>(setAction);
|
||||
|
||||
identityBuilder
|
||||
.AddUserStore<UserStore>()
|
||||
.AddRoleStore<RoleStore>()
|
||||
.AddTokenProvider<DataProtectorTokenProvider<User>>(TokenOptions.DefaultProvider);
|
||||
|
||||
return identityBuilder;
|
||||
}
|
||||
|
||||
public static IdentityBuilder AddPasswordlessIdentityServices<TUserStore>(
|
||||
this IServiceCollection services, GlobalSettings globalSettings) where TUserStore : class
|
||||
this IServiceCollection services, GlobalSettings globalSettings) where TUserStore : class
|
||||
{
|
||||
services.TryAddTransient<ILookupNormalizer, LowerInvariantLookupNormalizer>();
|
||||
services.Configure<DataProtectionTokenProviderOptions>(options =>
|
||||
|
Loading…
Reference in New Issue
Block a user