mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-06 20:17:38 +01:00
- Add Credentials.IsExpired() and SessionInfo.IsExpired() in new file session_helpers.go. - Update TestSTSSessionClaimsToSessionInfoCredentialExpiration to use helpers for clearer intent.
21 lines
414 B
Go
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)
|
|
}
|