Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Conductor/Client/Authentication/TokenHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down Expand Up @@ -80,4 +96,4 @@ private string GetTokenFromServer(OrkesAuthenticationSettings authenticationSett
throw new Exception("Failed to refresh authentication token");
}
}
}
}
Loading