1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

Refactor WebAuthn IoC container (#1302)

* Refactor WebAuthn IoC container

* Move to AddDefaultServices
This commit is contained in:
Oscar Hinton
2021-05-06 10:17:12 +02:00
committed by GitHub
parent 7cae9d5e47
commit cae204cb7c
7 changed files with 14 additions and 54 deletions

View File

@ -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;
});
}
}
}