From 6e2aaff345711d007f913a7c22dc6da750732938 Mon Sep 17 00:00:00 2001 From: Jin Qin Date: Thu, 28 Sep 2023 00:42:26 +0000 Subject: [PATCH] Remove Sts prefix in the request name as it is duplicate with the package --- google/internal/externalaccount/basecredentials.go | 2 +- google/internal/stsexchange/sts_exchange.go | 6 +++--- google/internal/stsexchange/sts_exchange_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/google/internal/externalaccount/basecredentials.go b/google/internal/externalaccount/basecredentials.go index 596bb69ba..33288d367 100644 --- a/google/internal/externalaccount/basecredentials.go +++ b/google/internal/externalaccount/basecredentials.go @@ -208,7 +208,7 @@ func (ts tokenSource) Token() (*oauth2.Token, error) { if err != nil { return nil, err } - stsRequest := stsexchange.StsTokenExchangeRequest{ + stsRequest := stsexchange.TokenExchangeRequest{ GrantType: "urn:ietf:params:oauth:grant-type:token-exchange", Audience: conf.Audience, Scope: conf.Scopes, diff --git a/google/internal/stsexchange/sts_exchange.go b/google/internal/stsexchange/sts_exchange.go index 1fa2cf156..1a0bebd15 100644 --- a/google/internal/stsexchange/sts_exchange.go +++ b/google/internal/stsexchange/sts_exchange.go @@ -28,7 +28,7 @@ func defaultHeader() http.Header { // The first 4 fields are all mandatory. headers can be used to pass additional // headers beyond the bare minimum required by the token exchange. options can // be used to pass additional JSON-structured options to the remote server. -func ExchangeToken(ctx context.Context, endpoint string, request *StsTokenExchangeRequest, authentication ClientAuthentication, headers http.Header, options map[string]interface{}) (*Response, error) { +func ExchangeToken(ctx context.Context, endpoint string, request *TokenExchangeRequest, authentication ClientAuthentication, headers http.Header, options map[string]interface{}) (*Response, error) { data := url.Values{} data.Set("audience", request.Audience) data.Set("grant_type", "urn:ietf:params:oauth:grant-type:token-exchange") @@ -99,8 +99,8 @@ func makeRequest(ctx context.Context, endpoint string, data url.Values, authenti return &stsResp, nil } -// StsTokenExchangeRequest contains fields necessary to make an oauth2 token exchange. -type StsTokenExchangeRequest struct { +// TokenExchangeRequest contains fields necessary to make an oauth2 token exchange. +type TokenExchangeRequest struct { ActingParty struct { ActorToken string ActorTokenType string diff --git a/google/internal/stsexchange/sts_exchange_test.go b/google/internal/stsexchange/sts_exchange_test.go index f6a7de1eb..895b9bcf9 100644 --- a/google/internal/stsexchange/sts_exchange_test.go +++ b/google/internal/stsexchange/sts_exchange_test.go @@ -22,7 +22,7 @@ var auth = ClientAuthentication{ ClientSecret: clientSecret, } -var exchangeTokenRequest = StsTokenExchangeRequest{ +var exchangeTokenRequest = TokenExchangeRequest{ ActingParty: struct { ActorToken string ActorTokenType string