Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix export lookup values when exporting credentials #578

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkg/cfaws/ssotoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ type SSOPlainTextOut struct {
// we'll allow users to export a plaintext token from their keychain for compatibility
// purposes with other AWS tools.
func CreatePlainTextSSO(awsConfig config.SharedConfig, token *securestorage.SSOToken) *SSOPlainTextOut {
ssoRegion := awsConfig.SSORegion
if ssoRegion == "" && awsConfig.SSOSession != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was originally

if awsConfig.SSOSession != nil {
  ssoRegion = awsConfig.SSOSession.SSORegion
  ssoStartURL = awsConfig.SSOSession.SSOStartURL
}

Changed as profile can still have URLs set and the config still uses that

ssoRegion = awsConfig.SSOSession.SSORegion
}

ssoStartURL := awsConfig.SSOStartURL
if ssoStartURL == "" && awsConfig.SSOSession != nil {
ssoStartURL = awsConfig.SSOSession.SSOStartURL
}

return &SSOPlainTextOut{
AccessToken: token.AccessToken,
ExpiresAt: token.Expiry.Format(time.RFC3339),
Region: awsConfig.Region,
Region: ssoRegion,
SSOSessionName: awsConfig.SSOSessionName,
StartUrl: awsConfig.SSOStartURL,
StartUrl: ssoStartURL,
}
}

Expand Down