1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-27 03:41:30 +01:00

new uri settings

This commit is contained in:
Kyle Spearrin 2017-08-03 23:12:05 -04:00
parent 5deccf122a
commit ee9d8a074d
16 changed files with 92 additions and 80 deletions

View File

@ -178,9 +178,9 @@ namespace Bit.Api
{
var options = new IdentityServerAuthenticationOptions
{
Authority = globalSettings.BaseIdentityUri,
Authority = globalSettings.BaseServiceUri.InternalIdentity,
AllowedScopes = new string[] { "api" },
RequireHttpsMetadata = !env.IsDevelopment(),
RequireHttpsMetadata = false && !env.IsDevelopment(),
ApiName = "api",
NameClaimType = ClaimTypes.Email,
// Suffix until we retire the old jwt schemes.

View File

@ -1,10 +1,10 @@
{
"globalSettings": {
"baseVaultUri": "https://preview-vault.bitwarden.com/#",
"baseApiUri": "https://preview-api.bitwarden.com",
"baseIdentityUri": "https://preview-identity.bitwarden.com",
"u2f": {
"appId": "https://preview-vault.bitwarden.com/app-id.json"
"baseServiceUri": {
"vault": "https://preview-vault.bitwarden.com",
"api": "https://preview-api.bitwarden.com",
"identity": "https://preview-identity.bitwarden.com",
"identityInternal": "https://preview-identity.bitwarden.com"
}
}
}

View File

@ -1,10 +1,10 @@
{
"globalSettings": {
"baseVaultUri": "https://vault.bitwarden.com/#",
"baseApiUri": "https://api.bitwarden.com",
"baseIdentityUri": "https://identity.bitwarden.com",
"u2f": {
"appId": "https://vault.bitwarden.com/app-id.json"
"baseServiceUri": {
"vault": "https://vault.bitwarden.com",
"api": "https://api.bitwarden.com",
"identity": "https://identity.bitwarden.com",
"identityInternal": "https://identity.bitwarden.com"
},
"braintree": {
"production": true

View File

@ -1,10 +1,10 @@
{
"globalSettings": {
"baseVaultUri": "https://vault.bitwarden.com/#",
"baseApiUri": "https://api.bitwarden.com",
"baseIdentityUri": "https://identity.bitwarden.com",
"u2f": {
"appId": "https://vault.bitwarden.com/app-id.json"
"baseServiceUri": {
"vault": "https://vault.bitwarden.com",
"api": "https://api.bitwarden.com",
"identity": "https://identity.bitwarden.com",
"identityInternal": "https://identity.bitwarden.com"
}
}
}

View File

@ -2,9 +2,12 @@
"globalSettings": {
"selfHosted": false,
"siteName": "bitwarden",
"baseVaultUri": "http://localhost:4001/#",
"baseApiUri": "http://localhost:4000",
"baseIdentityUri": "http://localhost:33656",
"baseServiceUri": {
"vault": "http://localhost:4001",
"api": "http://localhost:4000",
"identity": "http://localhost:33656",
"identityInternal": "http://localhost:33656"
},
"stripeApiKey": "SECRET",
"sqlServer": {
"connectionString": "SECRET"
@ -41,9 +44,6 @@
"duo": {
"aKey": "SECRET"
},
"u2f": {
"appId": "https://localhost:4001/app-id.json"
},
"braintree": {
"production": false,
"merchantId": "SECRET",

View File

@ -1,8 +1,11 @@
{
"globalSettings": {
"baseVaultUri": "https://vault.bitwarden.com/#",
"baseApiUri": "https://api.bitwarden.com",
"baseIdentityUri": "https://identity.bitwarden.com",
"baseServiceUri": {
"vault": "https://vault.bitwarden.com",
"api": "https://api.bitwarden.com",
"identity": "https://identity.bitwarden.com",
"identityInternal": "https://identity.bitwarden.com"
},
"braintree": {
"production": true
}

View File

@ -2,9 +2,12 @@
"globalSettings": {
"selfHosted": false,
"siteName": "bitwarden",
"baseVaultUri": "http://localhost:4001/#",
"baseApiUri": "http://localhost:4000",
"baseIdentityUri": "http://localhost:33656",
"baseServiceUri": {
"vault": "http://localhost:4001",
"api": "http://localhost:4000",
"identity": "http://localhost:33656",
"identityInternal": "http://localhost:33656"
},
"stripeApiKey": "SECRET",
"sqlServer": {
"connectionString": "SECRET"

View File

@ -4,10 +4,8 @@
{
public bool SelfHosted { get; set; }
public virtual string SiteName { get; set; }
public virtual string BaseVaultUri { get; set; }
public virtual string BaseApiUri { get; set; }
public virtual string BaseIdentityUri { get; set; }
public virtual string StripeApiKey { get; set; }
public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings();
public virtual SqlServerSettings SqlServer { get; set; } = new SqlServerSettings();
public virtual MailSettings Mail { get; set; } = new MailSettings();
public virtual StorageSettings Storage { get; set; } = new StorageSettings();
@ -18,9 +16,16 @@
public virtual NotificationHubSettings NotificationHub { get; set; } = new NotificationHubSettings();
public virtual YubicoSettings Yubico { get; set; } = new YubicoSettings();
public virtual DuoSettings Duo { get; set; } = new DuoSettings();
public virtual U2fSettings U2f { get; set; } = new U2fSettings();
public virtual BraintreeSettings Braintree { get; set; } = new BraintreeSettings();
public class BaseServiceUriSettings
{
public string Vault { get; set; }
public string Api { get; set; }
public string Identity { get; set; }
public string InternalIdentity { get; set; }
}
public class SqlServerSettings
{
public string ConnectionString { get; set; }
@ -86,11 +91,6 @@
public string AKey { get; set; }
}
public class U2fSettings
{
public string AppId { get; set; }
}
public class BraintreeSettings
{
public bool Production { get; set; }

View File

@ -1,14 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bit.Core.Models.Mail
namespace Bit.Core.Models.Mail
{
public class BaseMailModel
{
private string _webVaultUrl;
public string SiteName { get; set; }
public string WebVaultUrl { get; set; }
public string WebVaultUrl
{
get
{
return _webVaultUrl;
}
set
{
_webVaultUrl = string.Concat(value, "/#");
}
}
}
}

View File

@ -37,7 +37,7 @@ namespace Bit.Core.Services
{
Token = WebUtility.UrlEncode(token),
UserId = userId,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("VerifyEmail", model);
@ -54,7 +54,7 @@ namespace Bit.Core.Services
{
FromEmail = fromEmail,
ToEmail = toEmail,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("ChangeEmailAlreadyExists", model);
@ -68,7 +68,7 @@ namespace Bit.Core.Services
var model = new EmailTokenViewModel
{
Token = token,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("ChangeEmail", model);
@ -84,7 +84,7 @@ namespace Bit.Core.Services
var model = new EmailTokenViewModel
{
Token = token,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("TwoFactorEmail", model);
@ -100,7 +100,7 @@ namespace Bit.Core.Services
var model = new MasterPasswordHintViewModel
{
Hint = hint,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("MasterPasswordHint", model);
@ -113,7 +113,7 @@ namespace Bit.Core.Services
var message = CreateDefaultMessage("Your Master Password Hint", email);
var model = new BaseMailModel
{
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("NoMasterPasswordHint", model);
@ -129,7 +129,7 @@ namespace Bit.Core.Services
{
OrganizationName = organizationName,
UserEmail = userEmail,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("OrganizationUserInvited", model);
@ -143,7 +143,7 @@ namespace Bit.Core.Services
var model = new OrganizationUserConfirmedViewModel
{
OrganizationName = organizationName,
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("OrganizationUserConfirmed", model);
@ -162,7 +162,7 @@ namespace Bit.Core.Services
OrganizationUserId = orgUser.Id.ToString(),
Token = token,
OrganizationNameUrlEncoded = WebUtility.UrlEncode(organizationName),
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("OrganizationUserInvited", model);
@ -175,7 +175,7 @@ namespace Bit.Core.Services
var message = CreateDefaultMessage("Welcome", user.Email);
var model = new BaseMailModel
{
WebVaultUrl = _globalSettings.BaseVaultUri,
WebVaultUrl = _globalSettings.BaseServiceUri.Vault,
SiteName = _globalSettings.SiteName
};
message.HtmlContent = _engine.Parse("Welcome", model);

View File

@ -40,7 +40,7 @@ namespace Bit.Core.Services
"Welcome",
user.Email,
WelcomeTemplateId);
AddCategories(message, new List<string> { AdministrativeCategoryName, "Welcome" });
await _mailDeliveryService.SendEmailAsync(message);
@ -196,7 +196,7 @@ namespace Bit.Core.Services
}
AddSubstitution(message, "{{siteName}}", _globalSettings.SiteName);
AddSubstitution(message, "{{baseVaultUri}}", _globalSettings.BaseVaultUri);
AddSubstitution(message, "{{baseVaultUri}}", string.Concat(_globalSettings.BaseServiceUri.Vault, "/#"));
return message;
}

View File

@ -125,7 +125,7 @@ namespace Bit.Core.Utilities
public static string U2fAppIdUrl(GlobalSettings globalSettings)
{
return globalSettings.U2f.AppId;
return string.Concat(globalSettings.BaseServiceUri.Vault, "/app-id.json");
}
public static string RandomString(int length, bool alpha = true, bool upper = true, bool lower = true,

View File

@ -1,10 +1,10 @@
{
"globalSettings": {
"baseVaultUri": "https://preview-vault.bitwarden.com/#",
"baseApiUri": "https://preview-api.bitwarden.com",
"baseIdentityUri": "https://preview-identity.bitwarden.com",
"u2f": {
"appId": "https://preview-vault.bitwarden.com/app-id.json"
"baseServiceUri": {
"vault": "https://preview-vault.bitwarden.com",
"api": "https://preview-api.bitwarden.com",
"identity": "https://preview-identity.bitwarden.com",
"identityInternal": "https://preview-identity.bitwarden.com"
}
}
}

View File

@ -1,10 +1,10 @@
{
"globalSettings": {
"baseVaultUri": "https://vault.bitwarden.com/#",
"baseApiUri": "https://api.bitwarden.com",
"baseIdentityUri": "https://identity.bitwarden.com",
"u2f": {
"appId": "https://vault.bitwarden.com/app-id.json"
"baseServiceUri": {
"vault": "https://vault.bitwarden.com",
"api": "https://api.bitwarden.com",
"identity": "https://identity.bitwarden.com",
"identityInternal": "https://identity.bitwarden.com"
},
"braintree": {
"production": true

View File

@ -1,10 +1,10 @@
{
"globalSettings": {
"baseVaultUri": "https://vault.bitwarden.com/#",
"baseApiUri": "https://api.bitwarden.com",
"baseIdentityUri": "https://identity.bitwarden.com",
"u2f": {
"appId": "https://vault.bitwarden.com/app-id.json"
"baseServiceUri": {
"vault": "https://vault.bitwarden.com",
"api": "https://api.bitwarden.com",
"identity": "https://identity.bitwarden.com",
"identityInternal": "https://identity.bitwarden.com"
}
}
}

View File

@ -2,9 +2,12 @@
"globalSettings": {
"selfHosted": false,
"siteName": "bitwarden",
"baseVaultUri": "http://localhost:4001/#",
"baseApiUri": "http://localhost:4000",
"baseIdentityUri": "http://localhost:33656",
"baseServiceUri": {
"vault": "http://localhost:4001",
"api": "http://localhost:4000",
"identity": "http://localhost:33656",
"identityInternal": "http://localhost:33656"
},
"stripeApiKey": "SECRET",
"sqlServer": {
"connectionString": "SECRET"
@ -37,9 +40,6 @@
"duo": {
"aKey": "SECRET"
},
"u2f": {
"appId": "https://localhost:4001/app-id.json"
},
"braintree": {
"production": false,
"merchantId": "SECRET",