Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
allow combined ARNs from SAML to come in either order
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hopkins committed Dec 8, 2016
1 parent 8f61fc0 commit 940677e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@ func assumeFirstRole(acfg AwsConfig, saml *OktaSamlResponse) (*credentials.Crede
}

parts := strings.Split(arns, ",")
roleArn, principalArn := parts[0], parts[1]

if len(parts) != 2 {
return nil, emptyExpire, errors.New("invalid initial role ARN")
}

var roleArn, principalArn string
for _, part := range parts {
if strings.Contains(part, "saml-provider") {
principalArn = part
} else {
roleArn = part
}
}

res, err := scl.AssumeRoleWithSAML(
&sts.AssumeRoleWithSAMLInput{
Expand Down

0 comments on commit 940677e

Please sign in to comment.