mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-20 13:30:46 +02:00
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:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user