Repository navigation
Conversation
JorTurFer
force-pushed
the
feat/identity-pkg
branch
4 times, most recently
from
October 18, 2026 15:33
4c42964 to
5ecee02
Compare
JorTurFer
marked this pull request as ready for review
October 18, 2026 15:37
2 of 11 tasks
JorTurFer
force-pushed
the
feat/identity-pkg
branch
2 times, most recently
from
October 18, 2026 15:43
f0cd9ac to
f0f41ea
Compare
…kenProvider Add core/credentials, a package of modular token providers built on one contract, TokenProvider, which returns an access token and nothing else: - WorkloadIdentityFederationProvider, ServiceAccountKeyProvider, StaticTokenProvider, InstanceMetadataProvider and CLIProvider, one per authentication flow. - ChainedProvider, to try providers in order, and NewDefaultProvider, the default chain: workload identity federation, service account key, static token, instance metadata and, only if enabled, the STACKIT CLI session. - Each provider caches one token per combination of scopes and resources and shares a single refresh between concurrent callers. - The service account key and the private key can be given as content or as a path, in the config or in the environment, and the config wins over the environment. Add config.WithTokenProvider, which makes auth.DefaultAuth authenticate through the given provider. The existing authentication flows are not modified, and options that explicitly choose how to authenticate still take precedence over it. Update the authentication example and the documentation, including a README for the package. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JorTurFer
force-pushed
the
feat/identity-pkg
branch
from
October 18, 2026 15:43
f0f41ea to
7c2486f
Compare
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.
Description
Adds
core/credentials, a package of modular token providers, andconfig.WithTokenProviderto use one of them with any service client. The existing authentication flows are not modified: this is an additive, opt-in way to authenticate.What is added
TokenProviderreturns an access token and nothing else. Each authentication flow is a provider:WorkloadIdentityFederationProvider,ServiceAccountKeyProvider,StaticTokenProvider,InstanceMetadataProviderandCLIProvider.ChainedProvidertries providers in order, andNewDefaultProviderbuilds the default chain: workload identity federation, service account key, static token, instance metadata and, only if enabled (EnableCLIorSTACKIT_USE_CLI=true), the STACKIT CLI session. The CLI is opt-in because it authenticates as the person logged in, not as the application.audof the token (RFC 8707).config.WithTokenProvider. Makesauth.DefaultAuthauthenticate through the provider. Options that explicitly choose how to authenticate (WithToken,WithServiceAccountKey,WithCustomAuth, ...) still take precedence over it.Design notes
credentialsrather thanidentity, so it does not clash with the upcomingservices/identity, and to follow the naming of other SDKs.SetLoggerare exported. Constants, file formats and helpers are private.golang.org/x/sync/singleflight, to keep the dependencies ofcoreto a minimum, since every service module inherits them. Usingx/syncwould replace it with aGroup.DoChancall whose fetch runs oncontext.WithoutCancel.coremodule and is versioned with it (core/VERSIONis bumped tov0.27.0).Out of scope
STACKIT_TOKEN_BASEURLis not supported by the new package.Checklist
[x] Issue was linked above-> Internal dicussioncorewas adjustedcorewas adjustedexamples/directory)go test ./...incoregolangci-lint run --config golang-ci.yaml ./...incore🤖 Generated with Claude Code