Repository navigation
fix: persist refreshed tokens against the context user - #627
Open
dipak0000812 wants to merge 1 commit into
Open
dipak0000812 wants to merge 1 commit into
dipak0000812 wants to merge 1 commit into
Conversation
When automatic token refresh executes, refreshAuthToken resolved the context but called localCfg.UpsertUser using ctxName instead of the referenced user's name (configCtx.User.Name). For contexts created with a custom name (e.g. via microcks login <server> --name <ctx>), the referenced user is keyed by server URL while the context name differs. Using ctxName caused an orphaned user entry to be created with the new tokens while leaving the referenced user with the expired tokens. Fix this by upserting refreshed tokens against configCtx.User.Name and add regression test coverage. Closes microcks#536 Signed-off-by: Dipak Dhangar <[email protected]>
dipak0000812
requested review from
Caesarsage,
Harsh4902,
lbroudoux and
yada
as code owners
November 12, 2026 16:21
This branch had an error being deployed
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.
Fixes #536
Description
When automatic token refresh runs,
refreshAuthTokenuses the context name (ctxName) instead of the referenced user's name (configCtx.User.Name) when persisting refreshed credentials.For contexts created with a custom name, this creates an orphaned user entry while leaving the actual referenced user with expired tokens.
This change updates the existing user entry using
configCtx.User.Name.Tests
TestRefreshAuthToken_PersistsTokensAgainstContextUser.go vet ./pkg/connectors/...pass.git diff --checkpasses.AI Disclosure
AI assistance was used during investigation and test development. I reviewed and validated the changes and take full responsibility for the implementation.