Skip to content

Commit

Permalink
Remove ExpiredAt() and use previousCreds.Expires
Browse files Browse the repository at this point in the history
  • Loading branch information
mikutas committed Mar 18, 2022
1 parent aaf4ea8 commit 08656cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 2 additions & 4 deletions cmd/saml2aws/commands/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ func Login(loginFlags *flags.LoginExecFlags) error {

if !sharedCreds.Expired() && !loginFlags.Force {
logger.Debug("Credentials are not expired. Skipping.")
expiredAt := sharedCreds.ExpiredAt()
if expiredAt != nil {
logger.Debug("Credentials will expire at ", expiredAt)
}
previousCreds, err := sharedCreds.Load()
if err != nil {
log.Println("Unable to load cached credentials.")
} else {
logger.Debug("Credentials will expire at ", previousCreds.Expires)
}
if loginFlags.CredentialProcess {
err = PrintCredentialProcess(previousCreds)
Expand Down
9 changes: 0 additions & 9 deletions pkg/awsconfig/awsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ func (p *CredentialsProvider) Expired() bool {
return time.Now().After(creds.Expires)
}

func (p *CredentialsProvider) ExpiredAt() *time.Time {
creds, err := p.Load()
if err != nil {
return nil
}

return &creds.Expires
}

// ensureConfigExists verify that the config file exists
func (p *CredentialsProvider) ensureConfigExists() error {
filename, err := p.resolveFilename()
Expand Down

0 comments on commit 08656cf

Please sign in to comment.