pub struct CachedTokenRequest {
pub tenant: TenantId,
pub principal: PrincipalId,
pub scope: ScopeSet,
pub force: bool,
pub preemptive_window: Duration,
}Expand description
Shared request parameters for flows that evaluate cached records before contacting the provider.
Fields§
§tenant: TenantIdTenant identifier tied to the request.
principal: PrincipalIdPrincipal identifier tied to the request.
scope: ScopeSetNormalized scope set for the request.
force: boolForces cache bypass when true.
preemptive_window: DurationJittered preemptive window used when refreshing early.
Implementations§
Source§impl CachedTokenRequest
impl CachedTokenRequest
Sourcepub fn new(tenant: TenantId, principal: PrincipalId, scope: ScopeSet) -> Self
pub fn new(tenant: TenantId, principal: PrincipalId, scope: ScopeSet) -> Self
Creates a new request for the provided tenant/principal/scope tuple.
Sourcepub fn force_refresh(self) -> Self
pub fn force_refresh(self) -> Self
Forces the broker to bypass cache checks.
Sourcepub fn with_force(self, force: bool) -> Self
pub fn with_force(self, force: bool) -> Self
Overrides the force flag.
Sourcepub fn with_preemptive_window(self, window: Duration) -> Self
pub fn with_preemptive_window(self, window: Duration) -> Self
Overrides the jittered preemptive window (defaults to 60 seconds).
Sourcepub fn should_refresh(&self, record: &TokenRecord, now: OffsetDateTime) -> bool
pub fn should_refresh(&self, record: &TokenRecord, now: OffsetDateTime) -> bool
Determines whether the cached record should be refreshed.
Trait Implementations§
Source§impl Clone for CachedTokenRequest
impl Clone for CachedTokenRequest
Source§fn clone(&self) -> CachedTokenRequest
fn clone(&self) -> CachedTokenRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for CachedTokenRequest
impl RefUnwindSafe for CachedTokenRequest
impl Send for CachedTokenRequest
impl Sync for CachedTokenRequest
impl Unpin for CachedTokenRequest
impl UnwindSafe for CachedTokenRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more