Skip to content

Commit

Permalink
catch case where duration is longer than configured
Browse files Browse the repository at this point in the history
  • Loading branch information
bitte-ein-bit committed Jul 3, 2023
1 parent 4b4280f commit 6f10162
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws/sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func AssumeSAMLRole(PrincipalArn, RoleArn, SAMLAssertion, awsRegion string, dura
var ae smithy.APIError
if errors.As(err, &ae) {
// Check if error indicates exceeded duration, no structured error exists so check error message content.
if strings.Contains(ae.ErrorMessage(), "'durationSeconds' failed to satisfy constraint") {
if strings.Contains(ae.ErrorMessage(), "'durationSeconds' failed to satisfy constraint") || ae.ErrorMessage() == ErrInvalidSessionDuration {
// Return a custom error to allow the caller to retry etc.
// TODO Return a custom error type instead of a special value:
// https://dave.cheney.net/2014/12/24/inspecting-errors
Expand Down

0 comments on commit 6f10162

Please sign in to comment.