Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the externalID in the cache key #316

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion iam/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ func (iam *Client) EndpointFor(service, region string, optFns ...func(*endpoints
// AssumeRole returns an IAM role Credentials using AWS STS.
func (iam *Client) AssumeRole(roleARN, externalID string, remoteIP string, sessionTTL time.Duration) (*Credentials, error) {
hitCache := true
item, err := cache.Fetch(roleARN, sessionTTL, func() (interface{}, error) {
cacheKey := fmt.Sprintf("externalID/%s/roleARN/%s", externalID, roleARN)
item, err := cache.Fetch(cacheKey, sessionTTL, func() (interface{}, error) {
hitCache = false

// Set up a prometheus timer to track the AWS request duration. It stores the timer value when
Expand Down