refactor(sts): remove unused IsExpired() helper functions

The session_helpers.go file contained two unused IsExpired() methods:
- Credentials.IsExpired()
- SessionInfo.IsExpired()

These were never called anywhere in the codebase. The actual expiration
checks use:
- isCredentialExpired() in weed/s3api/auth_credentials.go (S3 auth)
- Direct time.Now().After() checks

Removing unused code improves code clarity and reduces maintenance burden.
This commit is contained in:
Chris Lu
2026-01-02 21:22:00 -08:00
parent 00c37387db
commit 9dd87aa80a
-29
View File
@@ -1,29 +0,0 @@
package sts
import "time"
// IsExpired returns true if the credentials have expired
func (c *Credentials) IsExpired() bool {
if c == nil {
return true
}
// Treat zero-time expiration as expired (uninitialized credentials)
// This prevents treating uninitialized credentials as valid
if c.Expiration.IsZero() {
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
}
// Treat zero-time expiration as expired (uninitialized session)
if s.ExpiresAt.IsZero() {
return true
}
return time.Now().After(s.ExpiresAt)
}