diff --git a/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs b/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs index e8133706b2..0118f18fd6 100644 --- a/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs +++ b/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs @@ -42,6 +42,10 @@ namespace Tgstation.Server.Host.Security.OAuth var securityConfiguration = securityConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(securityConfigurationOptions)); var validatorsBuilder = new List(); + validators = validatorsBuilder; + + if (securityConfiguration.OAuth == null) + return; if (securityConfiguration.OAuth.TryGetValue(OAuthProvider.GitHub, out var gitHubConfig)) validatorsBuilder.Add( @@ -73,8 +77,6 @@ namespace Tgstation.Server.Host.Security.OAuth assemblyInformationProvider, loggerFactory.CreateLogger(), keyCloakConfig)); - - validators = validatorsBuilder; } /// diff --git a/tests/Tgstation.Server.Tests/TestingServer.cs b/tests/Tgstation.Server.Tests/TestingServer.cs index 12f04a0b1b..f35f5c38ad 100644 --- a/tests/Tgstation.Server.Tests/TestingServer.cs +++ b/tests/Tgstation.Server.Tests/TestingServer.cs @@ -106,6 +106,8 @@ namespace Tgstation.Server.Tests args.Add($"Security:OAuth:{I}:RedirectUrl=https://fakest.com"); args.Add($"Security:OAuth:{I}:ServerUrl=https://fakestest.com"); } + else + args.Add($"Security:OAuth=null"); // SPECIFICALLY DELETE THE DEV APPSETTINGS, WE DON'T WANT IT IN THE WAY File.Delete("appsettings.Development.json");