1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 17:12:49 -05:00

generate signin token for enterprise portal (#728)

This commit is contained in:
Kyle Spearrin
2020-05-12 15:36:33 -04:00
committed by GitHub
parent 00af142d63
commit 10a6e12d09
4 changed files with 30 additions and 3 deletions

View File

@ -393,6 +393,7 @@ namespace Bit.Core.Utilities
public static void AddCustomDataProtectionServices(
this IServiceCollection services, IWebHostEnvironment env, GlobalSettings globalSettings)
{
var builder = services.AddDataProtection().SetApplicationName("Bitwarden");
if (env.IsDevelopment())
{
return;
@ -400,8 +401,7 @@ namespace Bit.Core.Utilities
if (globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.DataProtection.Directory))
{
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(globalSettings.DataProtection.Directory));
builder.PersistKeysToFileSystem(new DirectoryInfo(globalSettings.DataProtection.Directory));
}
if (!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Storage?.ConnectionString))
@ -419,7 +419,7 @@ namespace Bit.Core.Utilities
"dataprotection.pfx", globalSettings.DataProtection.CertificatePassword)
.GetAwaiter().GetResult();
}
services.AddDataProtection()
builder
.PersistKeysToAzureBlobStorage(storageAccount, "aspnet-dataprotection/keys.xml")
.ProtectKeysWithCertificate(dataProtectionCert);
}