Skip to content

Commit

Permalink
Merge pull request #11 from kastenhq/s3-role
Browse files Browse the repository at this point in the history
Add session token support
  • Loading branch information
Hakan Memisoglu authored Sep 11, 2019
2 parents 52da149 + f63fd9a commit 3cd55b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions s3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (

// ConfigToken is an optional argument which is required when providing
// credentials with temporary access.
// ConfigToken = "token"
ConfigToken = "token"

// ConfigRegion represents the region/availability zone of the session.
ConfigRegion = "region"
Expand Down Expand Up @@ -101,7 +101,7 @@ func newS3Client(config stow.Config) (client *s3.S3, endpoint string, err error)
authType, _ := config.Config(ConfigAuthType)
accessKeyID, _ := config.Config(ConfigAccessKeyID)
secretKey, _ := config.Config(ConfigSecretKey)
// token, _ := config.Config(ConfigToken)
token, _ := config.Config(ConfigToken)

if authType == "" {
authType = "accesskey"
Expand Down Expand Up @@ -131,7 +131,7 @@ func newS3Client(config stow.Config) (client *s3.S3, endpoint string, err error)
}

if authType == "accesskey" {
awsConfig.WithCredentials(credentials.NewStaticCredentials(accessKeyID, secretKey, ""))
awsConfig.WithCredentials(credentials.NewStaticCredentials(accessKeyID, secretKey, token))
}

endpoint, ok = config.Config(ConfigEndpoint)
Expand Down

0 comments on commit 3cd55b7

Please sign in to comment.