Skip to content

Commit 8c8e2b0

Browse files
committed
add settings to ConfigResponseModel
1 parent f9c0cec commit 8c8e2b0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Api/Models/Response/ConfigResponseModel.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class ConfigResponseModel : ResponseModel
1818
public EnvironmentConfigResponseModel Environment { get; set; }
1919
public IDictionary<string, object> FeatureStates { get; set; }
2020
public PushSettings Push { get; set; }
21+
public CommunicationSettings Communication { get; set; }
2122
public ServerSettingsResponseModel Settings { get; set; }
2223

2324
public ConfigResponseModel() : base("config")
@@ -48,6 +49,7 @@ IGlobalSettings globalSettings
4849
FeatureStates = featureService.GetAll();
4950
var webPushEnabled = FeatureStates.TryGetValue(FeatureFlagKeys.WebPush, out var webPushEnabledValue) ? (bool)webPushEnabledValue : false;
5051
Push = PushSettings.Build(webPushEnabled, globalSettings);
52+
Communication = CommunicationSettings.Build(globalSettings);
5153
Settings = new ServerSettingsResponseModel
5254
{
5355
DisableUserRegistration = globalSettings.DisableUserRegistration
@@ -88,6 +90,36 @@ public static PushSettings Build(bool webPushEnabled, IGlobalSettings globalSett
8890
}
8991
}
9092

93+
public class CommunicationSettings
94+
{
95+
public string Type { get; private init; }
96+
public string IdpLoginUrl { get; private init; }
97+
public string CookieName { get; private init; }
98+
public string CookieDomain { get; private init; }
99+
100+
public static CommunicationSettings Build(IGlobalSettings globalSettings)
101+
{
102+
var bootstrap = globalSettings.Communication?.Bootstrap?.ToLowerInvariant();
103+
104+
if (string.IsNullOrEmpty(bootstrap) || bootstrap == "none")
105+
{
106+
return null;
107+
}
108+
109+
return bootstrap switch
110+
{
111+
"ssocookievendor" => new CommunicationSettings
112+
{
113+
Type = "ssoCookieVendor",
114+
IdpLoginUrl = globalSettings.Communication?.SsoCookieVendor?.IdpLoginUrl,
115+
CookieName = globalSettings.Communication?.SsoCookieVendor?.CookieName,
116+
CookieDomain = globalSettings.Communication?.SsoCookieVendor?.CookieDomain
117+
},
118+
_ => null
119+
};
120+
}
121+
}
122+
91123
public class ServerSettingsResponseModel
92124
{
93125
public bool DisableUserRegistration { get; set; }

0 commit comments

Comments
 (0)