diff --git a/Conductor/Client/Authentication/TokenHandler.cs b/Conductor/Client/Authentication/TokenHandler.cs index e743e29a..a1fb8fd2 100644 --- a/Conductor/Client/Authentication/TokenHandler.cs +++ b/Conductor/Client/Authentication/TokenHandler.cs @@ -33,6 +33,14 @@ public TokenHandler() public string GetToken(OrkesAuthenticationSettings authenticationSettings, TokenResourceApi tokenClient) { + // OSS Conductor: if no credentials are configured, skip token exchange entirely. + if (authenticationSettings == null || + string.IsNullOrEmpty(authenticationSettings.KeyId) || + string.IsNullOrEmpty(authenticationSettings.KeySecret)) + { + return null; + } + string token = (string)_memoryCache.Get(authenticationSettings); if (token != null) { @@ -43,6 +51,14 @@ public string GetToken(OrkesAuthenticationSettings authenticationSettings, Token public string RefreshToken(OrkesAuthenticationSettings authenticationSettings, TokenResourceApi tokenClient) { + // OSS Conductor: if no credentials are configured, skip token exchange entirely. + if (authenticationSettings == null || + string.IsNullOrEmpty(authenticationSettings.KeyId) || + string.IsNullOrEmpty(authenticationSettings.KeySecret)) + { + return null; + } + lock (_lockObject) { string token = GetTokenFromServer(authenticationSettings, tokenClient); @@ -80,4 +96,4 @@ private string GetTokenFromServer(OrkesAuthenticationSettings authenticationSett throw new Exception("Failed to refresh authentication token"); } } -} \ No newline at end of file +}