Browse Source

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.
pull/7944/head
Chris Lu 1 month ago
parent
commit
9dd87aa80a
  1. 29
      weed/iam/sts/session_helpers.go

29
weed/iam/sts/session_helpers.go

@ -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)
}
Loading…
Cancel
Save