mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
pass nil function for auth/aws when no externalID supplied (#27858)
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
|
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
@@ -130,7 +132,12 @@ func (b *backend) getClientConfig(ctx context.Context, s logical.Storage, region
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
assumedCredentials := stscreds.NewCredentials(sess, stsRole, func(p *stscreds.AssumeRoleProvider) { p.ExternalID = aws.String(externalID) })
|
var assumedCredentials *credentials.Credentials
|
||||||
|
if externalID != "" {
|
||||||
|
assumedCredentials = stscreds.NewCredentials(sess, stsRole, func(p *stscreds.AssumeRoleProvider) { p.ExternalID = aws.String(externalID) })
|
||||||
|
} else {
|
||||||
|
assumedCredentials = stscreds.NewCredentials(sess, stsRole)
|
||||||
|
}
|
||||||
// Test that we actually have permissions to assume the role
|
// Test that we actually have permissions to assume the role
|
||||||
if _, err = assumedCredentials.Get(); err != nil {
|
if _, err = assumedCredentials.Get(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
3
changelog/27858.txt
Normal file
3
changelog/27858.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
auth/aws: fixes an issue where not supplying an external id was interpreted as an empty external id
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user