mirror of
https://github.com/bitwarden/server.git
synced 2024-12-26 17:37:36 +01:00
admin base uri setting, applied to login emails
This commit is contained in:
parent
795cf8e20e
commit
dead022e83
@ -38,8 +38,7 @@ namespace Bit.Admin.Controllers
|
||||
{
|
||||
if(ModelState.IsValid)
|
||||
{
|
||||
await _signInManager.PasswordlessSignInAsync(model.Email,
|
||||
Url.Action("Confirm", "Login", new { returnUrl = model.ReturnUrl }, Request.Scheme));
|
||||
await _signInManager.PasswordlessSignInAsync(model.Email, model.ReturnUrl);
|
||||
return RedirectToAction("Index", new
|
||||
{
|
||||
success = "If a valid admin user with this email address exists, " +
|
||||
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
|
@ -8,6 +8,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://preview-vault.bitwarden.com",
|
||||
"api": "https://preview-api.bitwarden.com",
|
||||
"identity": "https://preview-identity.bitwarden.com",
|
||||
"internalIdentity": "https://preview-identity.bitwarden.com",
|
||||
"internalApi": "https://preview-api.bitwarden.com",
|
||||
"internalVault": "https://preview-vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com"
|
||||
},
|
||||
"braintree": {
|
||||
|
@ -8,6 +8,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -34,6 +34,8 @@ namespace Bit.Core
|
||||
public string VaultWithHash => $"{Vault}/#";
|
||||
public string Api { get; set; }
|
||||
public string Identity { get; set; }
|
||||
public string Admin { get; set; }
|
||||
public string InternalAdmin { get; set; }
|
||||
public string InternalIdentity { get; set; }
|
||||
public string InternalApi { get; set; }
|
||||
public string InternalVault { get; set; }
|
||||
|
@ -28,7 +28,7 @@ namespace Bit.Core.Identity
|
||||
_mailService = mailService;
|
||||
}
|
||||
|
||||
public async Task<SignInResult> PasswordlessSignInAsync(string email, string loginConfirmUrl)
|
||||
public async Task<SignInResult> PasswordlessSignInAsync(string email, string returnUrl)
|
||||
{
|
||||
var user = await UserManager.FindByEmailAsync(email);
|
||||
if(user == null)
|
||||
@ -38,7 +38,7 @@ namespace Bit.Core.Identity
|
||||
|
||||
var token = await UserManager.GenerateUserTokenAsync(user, Options.Tokens.PasswordResetTokenProvider,
|
||||
PasswordlessSignInPurpose);
|
||||
await _mailService.SendPasswordlessSignInAsync(loginConfirmUrl, token, email);
|
||||
await _mailService.SendPasswordlessSignInAsync(returnUrl, token, email);
|
||||
return SignInResult.Success;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,6 @@ namespace Bit.Core.Services
|
||||
Task SendOrganizationInviteEmailAsync(string organizationName, OrganizationUser orgUser, string token);
|
||||
Task SendOrganizationAcceptedEmailAsync(string organizationName, string userEmail, IEnumerable<string> adminEmails);
|
||||
Task SendOrganizationConfirmedEmailAsync(string organizationName, string email);
|
||||
Task SendPasswordlessSignInAsync(string baseUrl, string token, string email);
|
||||
Task SendPasswordlessSignInAsync(string returnUrl, string token, string email);
|
||||
}
|
||||
}
|
||||
|
@ -153,16 +153,16 @@ namespace Bit.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SendPasswordlessSignInAsync(string baseUrl, string token, string email)
|
||||
public async Task SendPasswordlessSignInAsync(string returnUrl, string token, string email)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _primaryMailService.SendPasswordlessSignInAsync(baseUrl, token, email);
|
||||
await _primaryMailService.SendPasswordlessSignInAsync(returnUrl, token, email);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
LogError(e);
|
||||
await _backupMailService.SendPasswordlessSignInAsync(baseUrl, token, email);
|
||||
await _backupMailService.SendPasswordlessSignInAsync(returnUrl, token, email);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,19 +171,21 @@ namespace Bit.Core.Services
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendPasswordlessSignInAsync(string baseUrl, string token, string email)
|
||||
public async Task SendPasswordlessSignInAsync(string returnUrl, string token, string email)
|
||||
{
|
||||
var url = CoreHelpers.ExtendQuery(new Uri(baseUrl), new Dictionary<string, string>
|
||||
{
|
||||
["email"] = email,
|
||||
["token"] = token,
|
||||
});
|
||||
var url = CoreHelpers.ExtendQuery(new Uri($"{_globalSettings.BaseServiceUri.Admin}/login/confirm"),
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["returnUrl"] = returnUrl,
|
||||
["email"] = email,
|
||||
["token"] = token,
|
||||
});
|
||||
var model = new Dictionary<string, string>
|
||||
{
|
||||
["url"] = url.ToString()
|
||||
};
|
||||
|
||||
var message = await CreateMessageAsync("Continue Logging In", email, "PasswordlessSignIn", model);
|
||||
var message = await CreateMessageAsync("[Admin] Continue Logging In", email, "PasswordlessSignIn", model);
|
||||
message.MetaData.Add("SendGridBypassListManagement", true);
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
@ -203,15 +203,17 @@ namespace Bit.Core.Services
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendPasswordlessSignInAsync(string baseUrl, string token, string email)
|
||||
public async Task SendPasswordlessSignInAsync(string returnUrl, string token, string email)
|
||||
{
|
||||
var message = CreateDefaultMessage("Continue Logging In", email);
|
||||
var message = CreateDefaultMessage("[Admin] Continue Logging In", email);
|
||||
|
||||
var url = CoreHelpers.ExtendQuery(new Uri(baseUrl), new Dictionary<string, string>
|
||||
{
|
||||
["email"] = email,
|
||||
["token"] = token,
|
||||
});
|
||||
var url = CoreHelpers.ExtendQuery(new Uri($"{_globalSettings.BaseServiceUri.Admin}/login/confirm"),
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["returnUrl"] = returnUrl,
|
||||
["email"] = email,
|
||||
["token"] = token,
|
||||
});
|
||||
var model = new PasswordlessSignInModel
|
||||
{
|
||||
Url = url.ToString()
|
||||
|
@ -62,7 +62,7 @@ namespace Bit.Core.Services
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task SendPasswordlessSignInAsync(string baseUrl, string token, string email)
|
||||
public Task SendPasswordlessSignInAsync(string returnUrl, string token, string email)
|
||||
{
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://preview-vault.bitwarden.com",
|
||||
"api": "https://preview-api.bitwarden.com",
|
||||
"identity": "https://preview-identity.bitwarden.com",
|
||||
"internalIdentity": "https://preview-identity.bitwarden.com",
|
||||
"internalApi": "https://preview-api.bitwarden.com",
|
||||
"internalVault": "https://preview-vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://preview-vault.bitwarden.com",
|
||||
"api": "https://preview-api.bitwarden.com",
|
||||
"identity": "https://preview-identity.bitwarden.com",
|
||||
"internalIdentity": "https://preview-identity.bitwarden.com",
|
||||
"internalApi": "https://preview-api.bitwarden.com",
|
||||
"internalVault": "https://preview-vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://preview-vault.bitwarden.com",
|
||||
"api": "https://preview-api.bitwarden.com",
|
||||
"identity": "https://preview-identity.bitwarden.com",
|
||||
"internalIdentity": "https://preview-identity.bitwarden.com",
|
||||
"internalApi": "https://preview-api.bitwarden.com",
|
||||
"internalVault": "https://preview-vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"globalSettings": {
|
||||
"baseServiceUri": {
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -4,6 +4,8 @@
|
||||
"vault": "https://vault.bitwarden.com",
|
||||
"api": "https://api.bitwarden.com",
|
||||
"identity": "https://identity.bitwarden.com",
|
||||
"admin": "https://admin.bitwarden.com",
|
||||
"internalAdmin": "https://admin.bitwarden.com",
|
||||
"internalIdentity": "https://identity.bitwarden.com",
|
||||
"internalApi": "https://api.bitwarden.com",
|
||||
"internalVault": "https://vault.bitwarden.com"
|
||||
|
@ -8,6 +8,8 @@
|
||||
"vault": "http://localhost:4001",
|
||||
"api": "http://localhost:4000",
|
||||
"identity": "http://localhost:33656",
|
||||
"admin": "http://localhost:62911",
|
||||
"internalAdmin": "http://localhost:62911",
|
||||
"internalIdentity": "http://localhost:33656",
|
||||
"internalApi": "http://localhost:4000",
|
||||
"internalVault": "http://localhost:4001"
|
||||
|
@ -41,6 +41,7 @@ namespace Bit.Setup
|
||||
["globalSettings__baseServiceUri__vault"] = Url,
|
||||
["globalSettings__baseServiceUri__api"] = $"{Url}/api",
|
||||
["globalSettings__baseServiceUri__identity"] = $"{Url}/identity",
|
||||
["globalSettings__baseServiceUri__admin"] = $"{Url}/admin",
|
||||
["globalSettings__sqlServer__connectionString"] = $"\"{ dbConnectionString }\"",
|
||||
["globalSettings__identityServer__certificatePassword"] = IdentityCertPassword,
|
||||
["globalSettings__attachment__baseDirectory"] = $"{OutputDirectory}/core/attachments",
|
||||
@ -126,6 +127,8 @@ globalSettings__selfHosted=true
|
||||
globalSettings__baseServiceUri__vault=http://localhost
|
||||
globalSettings__baseServiceUri__api=http://localhost/api
|
||||
globalSettings__baseServiceUri__identity=http://localhost/identity
|
||||
globalSettings__baseServiceUri__admin=http://localhost/admin
|
||||
globalSettings__baseServiceUri__internalAdmin=http://admin:5000
|
||||
globalSettings__baseServiceUri__internalIdentity=http://identity:5000
|
||||
globalSettings__baseServiceUri__internalApi=http://api:5000
|
||||
globalSettings__baseServiceUri__internalVault=http://web:5000
|
||||
|
Loading…
Reference in New Issue
Block a user