mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
[PM-8107] Remove Duo v2 from server (#4934)
refactor(TwoFactorAuthentication): Remove references to old Duo SDK version 2 code and replace them with the Duo SDK version 4 supported library DuoUniversal code. Increased unit test coverage in the Two Factor Authentication code space. We opted to use DI instead of Inheritance for the Duo and OrganizaitonDuo two factor tokens to increase testability, since creating a testing mock of the Duo.Client was non-trivial. Reviewed-by: @JaredSnider-Bitwarden
This commit is contained in:
@ -10,6 +10,7 @@ using Bit.Core.AdminConsole.Services.Implementations;
|
||||
using Bit.Core.AdminConsole.Services.NoopImplementations;
|
||||
using Bit.Core.Auth.Enums;
|
||||
using Bit.Core.Auth.Identity;
|
||||
using Bit.Core.Auth.Identity.TokenProviders;
|
||||
using Bit.Core.Auth.IdentityServer;
|
||||
using Bit.Core.Auth.LoginFeatures;
|
||||
using Bit.Core.Auth.Models.Business.Tokenables;
|
||||
@ -113,6 +114,7 @@ public static class ServiceCollectionExtensions
|
||||
services.AddSingleton<IDeviceService, DeviceService>();
|
||||
services.AddScoped<ISsoConfigService, SsoConfigService>();
|
||||
services.AddScoped<IAuthRequestService, AuthRequestService>();
|
||||
services.AddScoped<IDuoUniversalTokenService, DuoUniversalTokenService>();
|
||||
services.AddScoped<ISendService, SendService>();
|
||||
services.AddLoginServices();
|
||||
services.AddScoped<IOrganizationDomainService, OrganizationDomainService>();
|
||||
@ -388,8 +390,7 @@ public static class ServiceCollectionExtensions
|
||||
public static IdentityBuilder AddCustomIdentityServices(
|
||||
this IServiceCollection services, GlobalSettings globalSettings)
|
||||
{
|
||||
services.AddScoped<IOrganizationDuoWebTokenProvider, OrganizationDuoWebTokenProvider>();
|
||||
services.AddScoped<ITemporaryDuoWebV4SDKService, TemporaryDuoWebV4SDKService>();
|
||||
services.AddScoped<IOrganizationDuoUniversalTokenProvider, OrganizationDuoUniversalTokenProvider>();
|
||||
services.Configure<PasswordHasherOptions>(options => options.IterationCount = 100000);
|
||||
services.Configure<TwoFactorRememberTokenProviderOptions>(options =>
|
||||
{
|
||||
@ -430,7 +431,7 @@ public static class ServiceCollectionExtensions
|
||||
CoreHelpers.CustomProviderName(TwoFactorProviderType.Email))
|
||||
.AddTokenProvider<YubicoOtpTokenProvider>(
|
||||
CoreHelpers.CustomProviderName(TwoFactorProviderType.YubiKey))
|
||||
.AddTokenProvider<DuoWebTokenProvider>(
|
||||
.AddTokenProvider<DuoUniversalTokenProvider>(
|
||||
CoreHelpers.CustomProviderName(TwoFactorProviderType.Duo))
|
||||
.AddTokenProvider<TwoFactorRememberTokenProvider>(
|
||||
CoreHelpers.CustomProviderName(TwoFactorProviderType.Remember))
|
||||
|
Reference in New Issue
Block a user