refactor(orgadm): use token-exchange/store for API key management#88
Merged
robertodauria merged 1 commit intomainfrom Jan 27, 2026
Merged
refactor(orgadm): use token-exchange/store for API key management#88robertodauria merged 1 commit intomainfrom
robertodauria merged 1 commit intomainfrom
Conversation
Replace local Datastore types and API Keys client with the shared
token-exchange/store package. This ensures orgadm uses the correct
namespace ("platform-credentials") for storing API keys, matching
what the token-exchange service expects.
Changes:
- Remove apikeys client and locateProject flag (no longer needed)
- Import github.com/m-lab/token-exchange/store
- Use store.NewAutojoinManager() with namespace "platform-credentials"
- Use store.GenerateAPIKey() and am.CreateAPIKeyWithValue() directly
- Remove Keys interface from adminx.Org
- Update tests accordingly
Collaborator
Pull Request Test Coverage Report for Build 21377258026Details
💛 - Coveralls |
robertodauria
added a commit
that referenced
this pull request
Jan 27, 2026
Consolidating credential storage under platform-credentials namespace The autojoin API supports two authentication flows: 1. Direct API key flow - Client sends API key directly to autojoin for validation 2. JWT flow - Client obtains JWT from token-exchange service, autojoin validates JWT signature Previously, these flows used separate Datastore namespaces in different GCP projects: - mlab-autojoin / "autojoin" namespace - credentials for direct API key flow - mlab-oti / "platform-credentials" namespace - credentials for JWT flow (via token-exchange) This meant organizations and API keys had to be provisioned in both places. The consolidation plan: 1. PR #88: Make orgadm tool use token-exchange/store with "platform-credentials" namespace 2. This PR: Make autojoin service use token-exchange/store with "platform-credentials" namespace 3. Remove duplicated internal/adminx/datastore.go code After this, both authentication flows validate credentials against the same "platform-credentials" namespace, providing a single source of truth for organization credentials. * refactor: consolidate platform-credentials on token-exchange/store - Use token-exchange/store.AutojoinManager in main service (fixes namespace mismatch: was "autojoin", now "platform-credentials") - Remove duplicated internal/adminx/datastore.go (now uses token-exchange/store) - Remove dead code: internal/adminx/apikeys.go (unused GCP API Keys system) - Remove dead code: internal/adminx/keysiface/keys.go * feat: add credentials-project flag for cross-project Datastore access Add -credentials-project flag to allow autojoin to read credentials from a different GCP project (mlab-oti) than where it runs (mlab-autojoin). This enables both authentication flows (direct API key and JWT via token-exchange) to use the same credential store in platform-credentials namespace.
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.
Replace local Datastore types and API Keys client with the shared
token-exchange/store package. This ensures orgadm uses the correct
namespace ("platform-credentials") for storing API keys, matching
what the token-exchange service expects.
Changes:
This change is