forked from Mirrors/oauth2
Remove Sts prefix in the request name as it is duplicate with the package
This commit is contained in:
parent
c50beac896
commit
6e2aaff345
|
@ -208,7 +208,7 @@ func (ts tokenSource) Token() (*oauth2.Token, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
stsRequest := stsexchange.StsTokenExchangeRequest{
|
stsRequest := stsexchange.TokenExchangeRequest{
|
||||||
GrantType: "urn:ietf:params:oauth:grant-type:token-exchange",
|
GrantType: "urn:ietf:params:oauth:grant-type:token-exchange",
|
||||||
Audience: conf.Audience,
|
Audience: conf.Audience,
|
||||||
Scope: conf.Scopes,
|
Scope: conf.Scopes,
|
||||||
|
|
|
@ -28,7 +28,7 @@ func defaultHeader() http.Header {
|
||||||
// The first 4 fields are all mandatory. headers can be used to pass additional
|
// 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
|
// headers beyond the bare minimum required by the token exchange. options can
|
||||||
// be used to pass additional JSON-structured options to the remote server.
|
// 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 := url.Values{}
|
||||||
data.Set("audience", request.Audience)
|
data.Set("audience", request.Audience)
|
||||||
data.Set("grant_type", "urn:ietf:params:oauth:grant-type:token-exchange")
|
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
|
return &stsResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StsTokenExchangeRequest contains fields necessary to make an oauth2 token exchange.
|
// TokenExchangeRequest contains fields necessary to make an oauth2 token exchange.
|
||||||
type StsTokenExchangeRequest struct {
|
type TokenExchangeRequest struct {
|
||||||
ActingParty struct {
|
ActingParty struct {
|
||||||
ActorToken string
|
ActorToken string
|
||||||
ActorTokenType string
|
ActorTokenType string
|
||||||
|
|
|
@ -22,7 +22,7 @@ var auth = ClientAuthentication{
|
||||||
ClientSecret: clientSecret,
|
ClientSecret: clientSecret,
|
||||||
}
|
}
|
||||||
|
|
||||||
var exchangeTokenRequest = StsTokenExchangeRequest{
|
var exchangeTokenRequest = TokenExchangeRequest{
|
||||||
ActingParty: struct {
|
ActingParty: struct {
|
||||||
ActorToken string
|
ActorToken string
|
||||||
ActorTokenType string
|
ActorTokenType string
|
||||||
|
|
Loading…
Reference in New Issue