Skip to content

Commit 6510e9c

Browse files
Remove SP enabled flag
1 parent 36dcabf commit 6510e9c

File tree

2 files changed

+16
-29
lines changed

2 files changed

+16
-29
lines changed

src/ServiceControl/Authentication/AuthenticationController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public ActionResult<AuthConfig> Configuration()
1515
{
1616
var info = new AuthConfig
1717
{
18-
Enabled = settings.OpenIdConnectSettings.ServicePulseEnabled,
18+
Enabled = settings.OpenIdConnectSettings.Enabled,
1919
ClientId = settings.OpenIdConnectSettings.ServicePulseClientId,
2020
Authority = settings.OpenIdConnectSettings.ServicePulseAuthority,
2121
ApiScope = settings.OpenIdConnectSettings.ServicePulseApiScope

src/ServiceControl/Infrastructure/Settings/OpenIdConnectSettings.cs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ public OpenIdConnectSettings(bool validateConfiguration)
2626
ValidateLifetime = SettingsReader.Read(Settings.SettingsRootNamespace, "Authentication.ValidateLifetime", true);
2727
ValidateIssuerSigningKey = SettingsReader.Read(Settings.SettingsRootNamespace, "Authentication.ValidateIssuerSigningKey", true);
2828
RequireHttpsMetadata = SettingsReader.Read(Settings.SettingsRootNamespace, "Authentication.RequireHttpsMetadata", true);
29-
30-
ServicePulseEnabled = SettingsReader.Read(Settings.SettingsRootNamespace, "Authentication.ServicePulse.Enabled", false);
31-
32-
if (ServicePulseEnabled)
33-
{
34-
ServicePulseClientId = SettingsReader.Read<string>(Settings.SettingsRootNamespace, "Authentication.ServicePulse.ClientId");
35-
ServicePulseApiScope = SettingsReader.Read<string>(Settings.SettingsRootNamespace, "Authentication.ServicePulse.ApiScope");
36-
ServicePulseAuthority = SettingsReader.Read<string>(Settings.SettingsRootNamespace, "Authentication.ServicePulse.Authority");
37-
}
29+
ServicePulseClientId = SettingsReader.Read<string>(Settings.SettingsRootNamespace, "Authentication.ServicePulse.ClientId");
30+
ServicePulseApiScope = SettingsReader.Read<string>(Settings.SettingsRootNamespace, "Authentication.ServicePulse.ApiScope");
31+
ServicePulseAuthority = SettingsReader.Read<string>(Settings.SettingsRootNamespace, "Authentication.ServicePulse.Authority");
3832

3933
if (validateConfiguration)
4034
{
@@ -66,9 +60,6 @@ public OpenIdConnectSettings(bool validateConfiguration)
6660
[JsonPropertyName("requireHttpsMetadata")]
6761
public bool RequireHttpsMetadata { get; }
6862

69-
[JsonPropertyName("servicePulseEnabled")]
70-
public bool ServicePulseEnabled { get; }
71-
7263
[JsonPropertyName("servicePulseAuthority")]
7364
public string ServicePulseAuthority { get; }
7465

@@ -133,22 +124,19 @@ void Validate()
133124
logger.LogWarning("Authentication.ValidateIssuerSigningKey is set to false. This is a serious security risk and should only be used in development environments");
134125
}
135126

136-
if (ServicePulseEnabled)
127+
if (string.IsNullOrWhiteSpace(ServicePulseClientId))
128+
{
129+
throw new Exception("Authentication.ServicePulse.ClientId is required when Authentication.ServicePulse.Enabled is true.");
130+
}
131+
132+
if (string.IsNullOrWhiteSpace(ServicePulseApiScope))
133+
{
134+
throw new Exception("Authentication.ServicePulse.ApiScope is required when Authentication.ServicePulse.Enabled is true.");
135+
}
136+
137+
if (ServicePulseAuthority != null && !Uri.TryCreate(ServicePulseAuthority, UriKind.Absolute, out _))
137138
{
138-
if (string.IsNullOrWhiteSpace(ServicePulseClientId))
139-
{
140-
throw new Exception("Authentication.ServicePulse.ClientId is required when Authentication.ServicePulse.Enabled is true.");
141-
}
142-
143-
if (string.IsNullOrWhiteSpace(ServicePulseApiScope))
144-
{
145-
throw new Exception("Authentication.ServicePulse.ApiScope is required when Authentication.ServicePulse.Enabled is true.");
146-
}
147-
148-
if (ServicePulseAuthority != null && !Uri.TryCreate(ServicePulseAuthority, UriKind.Absolute, out _))
149-
{
150-
throw new Exception("Authentication.ServicePulse.Authority must be a valid absolute URI if provided.");
151-
}
139+
throw new Exception("Authentication.ServicePulse.Authority must be a valid absolute URI if provided.");
152140
}
153141

154142
logger.LogInformation("Authentication configuration validated successfully");
@@ -159,7 +147,6 @@ void Validate()
159147
logger.LogInformation(" ValidateLifetime: {ValidateLifetime}", ValidateLifetime);
160148
logger.LogInformation(" ValidateIssuerSigningKey: {ValidateIssuerSigningKey}", ValidateIssuerSigningKey);
161149
logger.LogInformation(" RequireHttpsMetadata: {RequireHttpsMetadata}", RequireHttpsMetadata);
162-
logger.LogInformation(" ServicePulseEnabled: {ServicePulseEnabled}", ServicePulseEnabled);
163150
logger.LogInformation(" ServicePulseClientId: {ServicePulseClientId}", ServicePulseClientId);
164151
logger.LogInformation(" ServicePulseAuthority: {ServicePulseAuthority}", ServicePulseAuthority);
165152
logger.LogInformation(" ServicePulseApiScope: {ServicePulseApiScope}", ServicePulseApiScope);

0 commit comments

Comments
 (0)