func (m *Manager) requiresRefresh(tr *authenticationv1.TokenRequest) bool {
	if tr.Spec.ExpirationSeconds == nil {
		cpy := tr.DeepCopy()
		cpy.Status.Token = ""
		klog.Errorf("expiration seconds was nil for tr: %#v", cpy)
		return false
	}
	now := m.clock.Now()
	exp := tr.Status.ExpirationTimestamp.Time
	iat := exp.Add(-1 * time.Duration(*tr.Spec.ExpirationSeconds) * time.Second)

	if now.After(iat.Add(maxTTL)) {
		return true
	}
	// Require a refresh if within 20% of the TTL from the expiration time.
	if now.After(exp.Add(-1 * time.Duration((*tr.Spec.ExpirationSeconds*20)/100) * time.Second)) {
		return true
	}
	return false
}
// requiresRefresh returns true if the token is older than 80% of its total
// ttl, or if the token is older than 24 hours.
requiresRefresh returns true if the token is older than 80% of its total
ttl, or if the token is older than 24 hours.
// requiresRefresh returns true if the token is older than 80% of its total // ttl or if the token is older than 24 hours .
func (m *Manager) requiresRefresh(tr *authenticationv1.TokenRequest) bool {
	if tr.Spec.ExpirationSeconds == nil {
		cpy := tr.DeepCopy()
		cpy.Status.Token = ""
		klog.Errorf("expiration seconds was nil for tr: %#v", cpy)
		return false
	}
	now := m.clock.Now()
	exp := tr.Status.ExpirationTimestamp.Time
	iat := exp.Add(-1 * time.Duration(*tr.Spec.ExpirationSeconds) * time.Second)
	if now.After(iat.Add(maxTTL)) {
		return true
	}
	if now.After(exp.Add(-1 * time.Duration((*tr.Spec.ExpirationSeconds*20)/100) * time.Second)) {
		return true
	}
	return false
}
func ( m * Manager ) requiresRefresh ( tr * authenticationv1 . TokenRequest ) bool { if tr . Spec . ExpirationSeconds == nil { cpy := tr . DeepCopy ( ) cpy . Status . Token = " " klog . Errorf ( " " , cpy ) return false } now := m . clock . Now ( ) exp := tr . Status . ExpirationTimestamp . Time iat := exp . Add ( - 1 * time . Duration ( * tr . Spec . ExpirationSeconds ) * time . Second ) if now . After ( iat . Add ( maxTTL ) ) { return true } if now . After ( exp . Add ( - 1 * time . Duration ( ( * tr . Spec . ExpirationSeconds * 20 ) / 100 ) * time . Second ) ) { return true } return false }
requiresRefresh returns true if the token is older than 80% of its total
ttl, or if the token is older than 24 hours.
requiresRefresh returns true if the token is older than 80% of its total ttl or if the token is older than 24 hours .
// Require a refresh if within 20% of the TTL from the expiration time.