Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,11 @@ func checkTokenExpirationWarning(data *global.Data, commandName string) {

summary := authcmd.ExpirationSummary(status, expires, time.Now())
remediation := authcmd.ExpirationRemediation(at.Type)
text.Warning(data.Output, "Your active token %s. %s\n", summary, remediation)
label := ""
if at.RefreshExpiresAt != "" {
label = "session "
}
text.Warning(data.Output, "Your active token %s%s. %s\n", label, summary, remediation)
}

// isAuthRelatedCommand reports whether commandName belongs to an auth-related
Expand Down
4 changes: 4 additions & 0 deletions pkg/commands/auth/expiry.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func staticExpirationStatus(at *config.AuthToken, now time.Time) (ExpirationStat
// RefreshExpiresAt (the user-actionable deadline) and falls back to
// AccessExpiresAt when refresh info is missing or malformed.
func ssoExpirationStatus(at *config.AuthToken, now time.Time) (ExpirationStatus, time.Time, error) {
if at.RefreshToken != "" && at.RefreshExpiresAt == "" {
return StatusNoExpiry, time.Time{}, nil
}

if at.RefreshExpiresAt != "" {
expires, err := time.Parse(time.RFC3339, at.RefreshExpiresAt)
if err == nil {
Expand Down
10 changes: 8 additions & 2 deletions pkg/commands/auth/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,19 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error {
if err != nil && c.Globals.ErrLog != nil {
c.Globals.ErrLog.Add(err)
}

label := ""
if entry.RefreshExpiresAt != "" {
label = "session "
}

switch status {
case StatusExpiringSoon:
summary := ExpirationSummary(status, expires, now)
expiryStr = " " + text.BoldYellow(fmt.Sprintf("[%s]", summary))
expiryStr = " " + text.BoldYellow(fmt.Sprintf("[%s%s]", label, summary))
case StatusExpired:
summary := ExpirationSummary(status, expires, now)
expiryStr = " " + text.BoldRed(fmt.Sprintf("[%s]", summary))
expiryStr = " " + text.BoldRed(fmt.Sprintf("[%s%s]", label, summary))
case StatusOK, StatusNoExpiry, StatusNeedsReauth:
}
}
Expand Down
Loading