1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

more premium licensing

This commit is contained in:
Kyle Spearrin
2017-08-11 22:55:25 -04:00
parent 73029f76d2
commit 9c254a7325
12 changed files with 126 additions and 59 deletions

View File

@ -146,6 +146,16 @@ namespace Bit.Core.Utilities
return _epoc.AddMilliseconds(milliseconds);
}
public static long ToEpocSeconds(DateTime date)
{
return (long)Math.Round((date - _epoc).TotalSeconds, 0);
}
public static DateTime FromEpocSeconds(long seconds)
{
return _epoc.AddSeconds(seconds);
}
public static string U2fAppIdUrl(GlobalSettings globalSettings)
{
return string.Concat(globalSettings.BaseServiceUri.Vault, "/app-id.json");

View File

@ -55,6 +55,7 @@ namespace Bit.Core.Utilities
public static void AddDefaultServices(this IServiceCollection services, GlobalSettings globalSettings)
{
services.AddSingleton<IMailService, RazorViewMailService>();
services.AddSingleton<ILicensingService, RsaLicensingService>();
if(CoreHelpers.SettingHasValue(globalSettings.Mail.SendGridApiKey))
{
@ -113,15 +114,6 @@ namespace Bit.Core.Utilities
{
services.AddSingleton<IAttachmentStorageService, NoopAttachmentStorageService>();
}
if(globalSettings.SelfHosted)
{
services.AddSingleton<ILicenseVerificationService, RsaLicenseVerificationService>();
}
else
{
services.AddSingleton<ILicenseVerificationService, NoopLicenseVerificationService>();
}
}
public static void AddNoopServices(this IServiceCollection services)
@ -132,7 +124,7 @@ namespace Bit.Core.Utilities
services.AddSingleton<IBlockIpService, NoopBlockIpService>();
services.AddSingleton<IPushRegistrationService, NoopPushRegistrationService>();
services.AddSingleton<IAttachmentStorageService, NoopAttachmentStorageService>();
services.AddSingleton<ILicenseVerificationService, NoopLicenseVerificationService>();
services.AddSingleton<ILicensingService, NoopLicensingService>();
}
public static IdentityBuilder AddCustomIdentityServices(