@@ -22,9 +22,6 @@ import (
2222 "strings"
2323 "time"
2424
25- { {#hasOAuthMethods} }
26- "golang.org/x/oauth2"
27- { {/hasOAuthMethods} }
2825 { {#withAWSV4Signature} }
2926 awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4"
3027 awscredentials "github.com/aws/aws-sdk-go/aws/credentials"
@@ -363,65 +360,6 @@ func (c *APIClient) prepareRequest(
363360 if ctx != nil {
364361 // add context to the request
365362 localVarRequest = localVarRequest.WithContext(ctx)
366-
367- // Walk through any authentication.
368-
369- { { #hasOAuthMethods} }
370- // OAuth2 authentication
371- if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
372- // We were able to grab an oauth2 token from the context
373- var latestToken *oauth2.Token
374- if latestToken, err = tok.Token(); err != nil {
375- return nil, err
376- }
377-
378- latestToken.SetAuthHeader(localVarRequest)
379- }
380-
381- { { /hasOAuthMethods} }
382- { { #hasHttpBasicMethods} }
383- // Basic HTTP Authentication
384- if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
385- localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
386- }
387-
388- { { /hasHttpBasicMethods} }
389- { { #hasHttpBearerMethods} }
390- // AccessToken Authentication
391- if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
392- localVarRequest.Header.Add(" Authorization" , " Bearer " +auth)
393- }
394-
395- { { /hasHttpBearerMethods} }
396- { { #withAWSV4Signature} }
397- // AWS Signature v4 Authentication
398- if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok {
399- creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, auth.SessionToken)
400- signer := awsv4.NewSigner(creds)
401- var reader *strings.Reader
402- if body == nil {
403- reader = strings.NewReader(" " )
404- } else {
405- reader = strings.NewReader(body.String())
406- }
407-
408- // Define default values for region and service to maintain backward compatibility
409- region := auth.Region
410- if region == " " {
411- region = " eu-west-2"
412- }
413- service := auth.Service
414- if service == " " {
415- service = " oapi"
416- }
417-
418- timestamp := time.Now()
419- _, err := signer.Sign(localVarRequest, reader, service, region, timestamp)
420- if err != nil {
421- return nil, err
422- }
423- }
424- { { /withAWSV4Signature} }
425363 }
426364
427365 for header, value := range c.cfg.DefaultHeader {
0 commit comments