@@ -20,15 +20,34 @@ var now = func() time.Time {
2020
2121// Config stores the configuration for fetching tokens with external credentials.
2222type Config struct {
23+ // Audience is the Secure Token Service (STS) audience which contains the resource name for the workload
24+ // identity pool or the workforce pool and the provider identifier in that pool.
2325 Audience string
26+ // SubjectTokenType is the STS token type based on the Oauth2.0 token exchange spec
27+ // e.g. `urn:ietf:params:oauth:token-type:jwt`.
2428 SubjectTokenType string
29+ // TokenURL is the STS token exchange endpoint.
2530 TokenURL string
31+ // TokenInfoURL is the token_info endpoint used to retrieve the account related information (
32+ // user attributes like account identifier, eg. email, username, uid, etc). This is
33+ // needed for gCloud session account identification.
2634 TokenInfoURL string
35+ // ServiceAccountImpersonationURL is the URL for the service account impersonation request. This is only
36+ // required for workload identity pools when APIs to be accessed have not integrated with UberMint.
2737 ServiceAccountImpersonationURL string
38+ // ClientSecret is currently only required if token_info endpoint also
39+ // needs to be called with the generated GCP access token. When provided, STS will be
40+ // called with additional basic authentication using client_id as username and client_secret as password.
2841 ClientSecret string
42+ // ClientID is only required in conjunction with ClientSecret, as described above.
2943 ClientID string
44+ // CredentialSource contains the necessary information to retrieve the token itself, as well
45+ // as some environmental information.
3046 CredentialSource CredentialSource
47+ // QuotaProjectID is injected by gCloud. If the value is non-empty, the Auth libraries
48+ // will set the x-goog-user-project which overrides the project associated with the credentials.
3149 QuotaProjectID string
50+ // Scopes contains the desired scopes for the returned access token.
3251 Scopes []string
3352}
3453
@@ -66,6 +85,8 @@ type format struct {
6685}
6786
6887// CredentialSource stores the information necessary to retrieve the credentials for the STS exchange.
88+ // Either the File or the URL field should be filled, depending on the kind of credential in question.
89+ // The EnvironmentID should start with AWS if being used for an AWS credential.
6990type CredentialSource struct {
7091 File string `json:"file"`
7192
@@ -107,7 +128,7 @@ type baseCredentialSource interface {
107128 subjectToken () (string , error )
108129}
109130
110- // tokenSource is the source that handles external credentials.
131+ // tokenSource is the source that handles external credentials. It is used to retrieve Tokens.
111132type tokenSource struct {
112133 ctx context.Context
113134 conf * Config
0 commit comments