Skip to content

Commit

Permalink
Merge pull request #393 from reubenmiller/fix-session-encryption
Browse files Browse the repository at this point in the history
fix: check if expiration date is nil before logging
  • Loading branch information
reubenmiller authored Jun 14, 2024
2 parents e780324 + 465ebff commit 9d01d77
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/cmd/sessions/set/set.manual.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,15 @@ func (n *CmdSet) RunE(cmd *cobra.Command, args []string) error {
shouldBeValidFor := cfg.TokenValidFor()
expiresSoon, expiresAt := ShouldRenewToken(tok, shouldBeValidFor)

if expiresSoon {
log.Warnf("Ignoring existing token as it will expire soon. minimumValidFor=%s, tokenExpiresAt=%s", shouldBeValidFor, expiresAt.Format(time.RFC3339))
client.SetToken("")
} else if expiresAt != nil {
log.Infof("Token expiresAt: %s", expiresAt.Format(time.RFC3339))
if expiresAt != nil {
if expiresSoon {
log.Warnf("Ignoring existing token as it will expire soon. minimumValidFor=%s, tokenExpiresAt=%s", shouldBeValidFor, expiresAt.Format(time.RFC3339))
client.SetToken("")
} else {
log.Infof("Token expiresAt: %s", expiresAt.Format(time.RFC3339))
}
} else {
log.Infof("Ignoring invalid token")
}
}
}
Expand Down

0 comments on commit 9d01d77

Please sign in to comment.