Skip to main content

renew_token_expiry

Function renew_token_expiry 

Source
pub fn renew_token_expiry(
    now_ms: i64,
    requested_ms: i64,
    default_renew_period_ms: i64,
    current_expiry_ms: i64,
    max_timestamp_ms: i64,
) -> TokenRenewDecision
Expand description

Derive a renewed expiry.

Matches DelegationTokenControlManager.renewDelegationToken in Kafka trunk: a token whose expiry or maximum timestamp is strictly before now is Expired. Otherwise the renew period is the configured delegation.token.expiry.time.ms for a request of 0 or less and the smaller of the two for a positive request, and the new expiry is now plus that period, capped at the maximum timestamp. The new expiry replaces the current one even when it is earlier. A non-positive configured period is Invalid.