diff --git a/bitwarden_license/src/Portal/Startup.cs b/bitwarden_license/src/Portal/Startup.cs index ccd8c6fb75..324460e545 100644 --- a/bitwarden_license/src/Portal/Startup.cs +++ b/bitwarden_license/src/Portal/Startup.cs @@ -61,15 +61,6 @@ namespace Bit.Portal services.AddDefaultServices(globalSettings); services.AddCoreLocalizationServices(); - // Fido2 - services.AddFido2(options => - { - options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; - options.ServerName = "Bitwarden"; - options.Origin = globalSettings.BaseServiceUri.Vault; - options.TimestampDriftTolerance = 300000; - }); - // Mvc services.AddControllersWithViews() .AddViewAndDataAnnotationLocalization(); diff --git a/bitwarden_license/src/Sso/Startup.cs b/bitwarden_license/src/Sso/Startup.cs index dfac772cc1..5678dace21 100644 --- a/bitwarden_license/src/Sso/Startup.cs +++ b/bitwarden_license/src/Sso/Startup.cs @@ -59,15 +59,6 @@ namespace Bit.Sso }); } - // Fido2 - services.AddFido2(options => - { - options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; - options.ServerName = "Bitwarden"; - options.Origin = globalSettings.BaseServiceUri.Vault; - options.TimestampDriftTolerance = 300000; - }); - // Authentication services.AddDistributedIdentityServices(globalSettings); services.AddAuthentication() diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index 9f67455dcc..3802745862 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -66,15 +66,6 @@ namespace Bit.Admin services.AddBaseServices(); services.AddDefaultServices(globalSettings); - // Fido2 - services.AddFido2(options => - { - options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; - options.ServerName = "Bitwarden"; - options.Origin = globalSettings.BaseServiceUri.Vault; - options.TimestampDriftTolerance = 300000; - }); - // Mvc services.AddMvc(config => { diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index a0ebc051e2..aaf748c785 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -119,15 +119,6 @@ namespace Bit.Api services.AddDefaultServices(globalSettings); services.AddCoreLocalizationServices(); - // Fido2 - services.AddFido2(options => - { - options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; - options.ServerName = "Bitwarden"; - options.Origin = globalSettings.BaseServiceUri.Vault; - options.TimestampDriftTolerance = 300000; - }); - // MVC services.AddMvc(config => { diff --git a/src/Billing/Startup.cs b/src/Billing/Startup.cs index 0290e9378d..f50c169af8 100644 --- a/src/Billing/Startup.cs +++ b/src/Billing/Startup.cs @@ -49,15 +49,6 @@ namespace Bit.Billing // Context services.AddScoped(); - // Fido2 - services.AddFido2(options => - { - options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; - options.ServerName = "Bitwarden"; - options.Origin = globalSettings.BaseServiceUri.Vault; - options.TimestampDriftTolerance = 300000; - }); - // Identity services.AddCustomIdentityServices(globalSettings); //services.AddPasswordlessIdentityServices(globalSettings); diff --git a/src/Core/Utilities/ServiceCollectionExtensions.cs b/src/Core/Utilities/ServiceCollectionExtensions.cs index 1038d825ef..2cafa9b1a4 100644 --- a/src/Core/Utilities/ServiceCollectionExtensions.cs +++ b/src/Core/Utilities/ServiceCollectionExtensions.cs @@ -126,6 +126,9 @@ namespace Bit.Core.Utilities public static void AddDefaultServices(this IServiceCollection services, GlobalSettings globalSettings) { + // Required for UserService + services.AddWebAuthn(globalSettings); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); @@ -535,5 +538,16 @@ namespace Bit.Core.Utilities return services; } + + public static void AddWebAuthn(this IServiceCollection services, GlobalSettings globalSettings) + { + services.AddFido2(options => + { + options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; + options.ServerName = "Bitwarden"; + options.Origin = globalSettings.BaseServiceUri.Vault; + options.TimestampDriftTolerance = 300000; + }); + } } } diff --git a/src/Identity/Startup.cs b/src/Identity/Startup.cs index 27ae5a8890..a3d03b2957 100644 --- a/src/Identity/Startup.cs +++ b/src/Identity/Startup.cs @@ -56,15 +56,6 @@ namespace Bit.Identity // Caching services.AddMemoryCache(); - // Fido2 - services.AddFido2(options => - { - options.ServerDomain = new Uri(globalSettings.BaseServiceUri.Vault).Host; - options.ServerName = "Bitwarden"; - options.Origin = globalSettings.BaseServiceUri.Vault; - options.TimestampDriftTolerance = 300000; - }); - // Mvc services.AddMvc();