Skip to content

Commit

Permalink
Fix SSO_START_URL lookup for credential exports (#572)
Browse files Browse the repository at this point in the history
Use `profile.SSOStartURL()` instead of `profile.AWSConfig.SSOSessionName`
when trying to export credentials. This will fail when the
config does nont have `SSO_START_URL` set on their config.

The `profile.SSOStartURL()` finds it from the session block
which provides the correct URL.

Fix for #571.
  • Loading branch information
cedieio committed Dec 19, 2023
1 parent 494bb0d commit 2960bc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cfaws/cred-exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ExportCredsToProfile(profileName string, creds aws.Credentials) error {
func ExportAccessTokenToCache(profile *Profile) error {
secureSSOTokenStorage := securestorage.NewSecureSSOTokenStorage()
// Find the access token for the SSOStartURL and SSOSessionName
tokenKey := profile.AWSConfig.SSOStartURL + profile.AWSConfig.SSOSessionName
tokenKey := profile.SSOStartURL() + profile.AWSConfig.SSOSessionName
cachedToken := secureSSOTokenStorage.GetValidSSOToken(tokenKey)
ssoPlainTextOut := CreatePlainTextSSO(profile.AWSConfig, cachedToken)
err := ssoPlainTextOut.DumpToCacheDirectory()
Expand Down

0 comments on commit 2960bc4

Please sign in to comment.