Skip to content

Commit

Permalink
Merge pull request Versent#653 from myw/revert_and_fix_time_format
Browse files Browse the repository at this point in the history
Revert changes to time format in Versent#651, use named format specifier
  • Loading branch information
Mark Wolfe authored Apr 14, 2021
2 parents df32ca6 + 77433ad commit 7090ac3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmd/saml2aws/commands/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
Expand Down Expand Up @@ -370,7 +371,7 @@ func CredentialsToCredentialProcess(awsCreds *awsconfig.AWSCredentials) (string,
AccessKeyId: awsCreds.AWSAccessKey,
SecretAccessKey: awsCreds.AWSSecretKey,
SessionToken: awsCreds.AWSSessionToken,
Expiration: awsCreds.Expires.Format("2006-01-02T15:04:05-07:00"),
Expiration: awsCreds.Expires.Format(time.RFC3339),
}

p, err := json.Marshal(cred_process)
Expand Down
2 changes: 1 addition & 1 deletion cmd/saml2aws/commands/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestCredentialsToCredentialProcess(t *testing.T) {
AWSSessionToken: "somesessiontoken",
Expires: time.Date(2020, time.January, 20, 22, 50, 0, 0, time.UTC),
}
aws_json_expected_output := "{\"Version\":1,\"AccessKeyId\":\"someawsaccesskey\",\"SecretAccessKey\":\"somesecretkey\",\"SessionToken\":\"somesessiontoken\",\"Expiration\":\"2020-01-20T22:50:00+00:00\"}"
aws_json_expected_output := "{\"Version\":1,\"AccessKeyId\":\"someawsaccesskey\",\"SecretAccessKey\":\"somesecretkey\",\"SessionToken\":\"somesessiontoken\",\"Expiration\":\"2020-01-20T22:50:00Z\"}"

json, err := CredentialsToCredentialProcess(aws_creds)
assert.Empty(t, err)
Expand Down

0 comments on commit 7090ac3

Please sign in to comment.