1
0
mirror of https://github.com/bitwarden/server synced 2026-02-11 22:13:24 +00:00

[PM-29144] Add server communication config to /api/config (#6892)

This commit is contained in:
Derek Nance
2026-02-04 08:15:27 -06:00
committed by GitHub
parent 4667af6cf9
commit 52955d1860

View File

@@ -18,6 +18,7 @@ public class ConfigResponseModel : ResponseModel
public EnvironmentConfigResponseModel Environment { get; set; }
public IDictionary<string, object> FeatureStates { get; set; }
public PushSettings Push { get; set; }
public CommunicationSettings Communication { get; set; }
public ServerSettingsResponseModel Settings { get; set; }
public ConfigResponseModel() : base("config")
@@ -48,6 +49,7 @@ public class ConfigResponseModel : ResponseModel
FeatureStates = featureService.GetAll();
var webPushEnabled = FeatureStates.TryGetValue(FeatureFlagKeys.WebPush, out var webPushEnabledValue) ? (bool)webPushEnabledValue : false;
Push = PushSettings.Build(webPushEnabled, globalSettings);
Communication = CommunicationSettings.Build(globalSettings);
Settings = new ServerSettingsResponseModel
{
DisableUserRegistration = globalSettings.DisableUserRegistration
@@ -88,6 +90,40 @@ public class PushSettings
}
}
public class CommunicationSettings
{
public CommunicationBootstrapSettings Bootstrap { get; private init; }
public static CommunicationSettings Build(IGlobalSettings globalSettings)
{
var bootstrap = CommunicationBootstrapSettings.Build(globalSettings);
return bootstrap == null ? null : new() { Bootstrap = bootstrap };
}
}
public class CommunicationBootstrapSettings
{
public string Type { get; private init; }
public string IdpLoginUrl { get; private init; }
public string CookieName { get; private init; }
public string CookieDomain { get; private init; }
public static CommunicationBootstrapSettings Build(IGlobalSettings globalSettings)
{
return globalSettings.Communication?.Bootstrap?.ToLowerInvariant() switch
{
"ssocookievendor" => new()
{
Type = "ssoCookieVendor",
IdpLoginUrl = globalSettings.Communication?.SsoCookieVendor?.IdpLoginUrl,
CookieName = globalSettings.Communication?.SsoCookieVendor?.CookieName,
CookieDomain = globalSettings.Communication?.SsoCookieVendor?.CookieDomain
},
_ => null
};
}
}
public class ServerSettingsResponseModel
{
public bool DisableUserRegistration { get; set; }