Files
seaweedfs/weed/iam/sts/session_helpers.go
T
Chris Lu 68505d3fd3 feat(sts): Add IsExpired helpers and use them in expiration tests
- Add Credentials.IsExpired() and SessionInfo.IsExpired() in new file session_helpers.go.
- Update TestSTSSessionClaimsToSessionInfoCredentialExpiration to use helpers for clearer intent.
2026-01-02 20:32:32 -08:00

21 lines
414 B
Go

package sts
import "time"
// IsExpired returns true if the credentials have expired
func (c *Credentials) IsExpired() bool {
if c == nil {
return true
}
return time.Now().After(c.Expiration)
}
// IsExpired returns true if the session has expired
func (s *SessionInfo) IsExpired() bool {
// If SessionInfo is nil, consider it expired
if s == nil {
return true
}
return time.Now().After(s.ExpiresAt)
}