1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-27 17:47:37 +01:00

Update ACS path to embed Organization ID (#955)

This commit is contained in:
Chad Scharf 2020-10-01 15:05:09 -04:00 committed by GitHub
parent 3b8cbe631f
commit a74778de3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -18,7 +18,8 @@ namespace Bit.Portal.Models
{ {
public SsoConfigDataViewModel() { } public SsoConfigDataViewModel() { }
public SsoConfigDataViewModel(SsoConfigurationData configurationData, GlobalSettings globalSettings) public SsoConfigDataViewModel(SsoConfigurationData configurationData, GlobalSettings globalSettings,
Guid organizationId)
{ {
ConfigType = configurationData.ConfigType; ConfigType = configurationData.ConfigType;
Authority = configurationData.Authority; Authority = configurationData.Authority;
@ -30,7 +31,7 @@ namespace Bit.Portal.Models
RedirectBehavior = configurationData.RedirectBehavior; RedirectBehavior = configurationData.RedirectBehavior;
GetClaimsFromUserInfoEndpoint = configurationData.GetClaimsFromUserInfoEndpoint; GetClaimsFromUserInfoEndpoint = configurationData.GetClaimsFromUserInfoEndpoint;
SpEntityId = configurationData.BuildSaml2ModulePath(globalSettings.BaseServiceUri.Sso); SpEntityId = configurationData.BuildSaml2ModulePath(globalSettings.BaseServiceUri.Sso);
SpAcsUrl = configurationData.BuildSaml2AcsUrl(globalSettings.BaseServiceUri.Sso); SpAcsUrl = configurationData.BuildSaml2AcsUrl(globalSettings.BaseServiceUri.Sso, organizationId.ToString());
IdpEntityId = configurationData.IdpEntityId; IdpEntityId = configurationData.IdpEntityId;
IdpBindingType = configurationData.IdpBindingType; IdpBindingType = configurationData.IdpBindingType;
IdpSingleSignOnServiceUrl = configurationData.IdpSingleSignOnServiceUrl; IdpSingleSignOnServiceUrl = configurationData.IdpSingleSignOnServiceUrl;

View File

@ -41,7 +41,7 @@ namespace Bit.Portal.Models
configurationData = new SsoConfigurationData(); configurationData = new SsoConfigurationData();
} }
Data = new SsoConfigDataViewModel(configurationData, globalSettings); Data = new SsoConfigDataViewModel(configurationData, globalSettings, ssoConfig.OrganizationId);
BuildLists(i18nService); BuildLists(i18nService);
} }

View File

@ -340,7 +340,7 @@ namespace Bit.Core.Business.Sso
var spOptions = new SPOptions var spOptions = new SPOptions
{ {
EntityId = spEntityId, EntityId = spEntityId,
ModulePath = config.BuildSaml2ModulePath(), ModulePath = config.BuildSaml2ModulePath(null, name),
NameIdPolicy = new Saml2NameIdPolicy(allowCreate, GetNameIdFormat(config.SpNameIdFormat)), NameIdPolicy = new Saml2NameIdPolicy(allowCreate, GetNameIdFormat(config.SpNameIdFormat)),
WantAssertionsSigned = config.SpWantAssertionsSigned, WantAssertionsSigned = config.SpWantAssertionsSigned,
AuthenticateRequestSigningBehavior = GetSigningBehavior(config.SpSigningBehavior), AuthenticateRequestSigningBehavior = GetSigningBehavior(config.SpSigningBehavior),

View File

@ -50,14 +50,15 @@ namespace Bit.Core.Models.Data
return BuildSsoUrl(_oidcSignedOutPath, ssoUri); return BuildSsoUrl(_oidcSignedOutPath, ssoUri);
} }
public string BuildSaml2ModulePath(string ssoUri = null) public string BuildSaml2ModulePath(string ssoUri = null, string scheme = null)
{ {
return BuildSsoUrl(_saml2ModulePath, ssoUri); return string.Concat(BuildSsoUrl(_saml2ModulePath, ssoUri),
string.IsNullOrWhiteSpace(scheme) ? string.Empty : $"/{scheme}");
} }
public string BuildSaml2AcsUrl(string ssoUri = null) public string BuildSaml2AcsUrl(string ssoUri = null, string scheme = null)
{ {
return string.Concat(BuildSaml2ModulePath(ssoUri), "/Acs"); return string.Concat(BuildSaml2ModulePath(ssoUri, scheme), "/Acs");
} }
private string BuildSsoUrl(string relativePath, string ssoUri) private string BuildSsoUrl(string relativePath, string ssoUri)