27 lines
708 B
Go
27 lines
708 B
Go
package tokenmanager
|
|
|
|
import "time"
|
|
|
|
// Config holds configuration for the token manager
|
|
type Config struct {
|
|
// RefreshBeforeExpiry is how long before expiry to refresh the token
|
|
// Default: 1 minute
|
|
RefreshBeforeExpiry time.Duration
|
|
|
|
// CheckInterval is how often to check if refresh is needed
|
|
// Default: 30 seconds
|
|
CheckInterval time.Duration
|
|
|
|
// MaxConsecutiveFailures is how many consecutive refresh failures before forcing logout
|
|
// Default: 3
|
|
MaxConsecutiveFailures int
|
|
}
|
|
|
|
// DefaultConfig returns the default configuration
|
|
func DefaultConfig() Config {
|
|
return Config{
|
|
RefreshBeforeExpiry: 1 * time.Minute,
|
|
CheckInterval: 30 * time.Second,
|
|
MaxConsecutiveFailures: 3,
|
|
}
|
|
}
|