mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
Refactor WebAuthn IoC container (#1302)
* Refactor WebAuthn IoC container * Move to AddDefaultServices
This commit is contained in:
parent
7cae9d5e47
commit
cae204cb7c
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -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 =>
|
||||
{
|
||||
|
@ -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 =>
|
||||
{
|
||||
|
@ -49,15 +49,6 @@ namespace Bit.Billing
|
||||
// Context
|
||||
services.AddScoped<ICurrentContext, CurrentContext>();
|
||||
|
||||
// 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<ReadOnlyDatabaseIdentityUserStore>(globalSettings);
|
||||
|
@ -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<IPaymentService, StripePaymentService>();
|
||||
services.AddSingleton<IMailService, HandlebarsMailService>();
|
||||
services.AddSingleton<ILicensingService, LicensingService>();
|
||||
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user