fix: skip token exchange when no credentials configured (OSS Conductor auth)#148
Closed
manan164 wants to merge 1 commit into
Closed
fix: skip token exchange when no credentials configured (OSS Conductor auth)#148manan164 wants to merge 1 commit into
manan164 wants to merge 1 commit into
Conversation
When no KeyId/KeySecret are provided in OrkesAuthenticationSettings, calling GetToken() would proceed to POST /api/token which returns 404/405 on OSS Conductor, causing an unhandled exception. Fix: return null early in both GetToken() and RefreshToken() when credentials are null or empty, so unauthenticated OSS deployments work without throwing.
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Collaborator
Author
|
Closing — the Agentspan SDK sets AuthenticationSettings = null for OSS Conductor, which is already handled correctly in 1.1.4. This fix would only apply if someone passes OrkesAuthenticationSettings with empty credentials, which is not our use case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
OrkesAuthenticationSettingsis not configured (nullKeyId/KeySecret), accessingConfiguration.AccessTokencallsTokenHandler.GetToken()which unconditionally proceeds toPOST /api/token. On OSS Conductor this endpoint returns 404/405, causing an unhandled exception and preventing the SDK from being used against unauthenticated OSS deployments at all.Fix
Added early-return guards in both
GetToken()andRefreshToken()inTokenHandler.cs: ifauthenticationSettingsis null or eitherKeyId/KeySecretis null or empty, returnnullimmediately without attempting the token exchange.This is safe because:
Configuration.AccessTokenproperty already returnsnullwhenAuthenticationSettings is null, so downstream code already handlesnulltokens.Changes
Conductor/Client/Authentication/TokenHandler.csGetToken(): returnnullearly when credentials are absentRefreshToken(): returnnullearly when credentials are absentTesting
To reproduce the bug before this fix: create a
Configurationwith noAuthenticationSettings, call any API method, observe the404/405exception fromTokenHandler. After this fix the call proceeds without a token (appropriate for OSS Conductor).