Skip to content

Commit

Permalink
Truncate username for GetFederationToken (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
avinson authored and mtibben committed Jun 11, 2019
1 parent 438ec49 commit 0f3b73d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ func getFederationToken(creds credentials.Value, d time.Duration, region string)
return nil, err
}

// truncate the username if it's longer than 32 characters or else GetFederationToken will fail. see: https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html
if len(currentUsername) > 32 {
currentUsername = currentUsername[0:32]
}

params := &sts.GetFederationTokenInput{
Name: aws.String(currentUsername),
DurationSeconds: aws.Int64(int64(d.Seconds())),
Expand Down

0 comments on commit 0f3b73d

Please sign in to comment.