pub struct ResolverEnvironment {
pub env_lookup: Arc<dyn Fn(&str) -> Option<String> + Sync + Send>,
pub external_resolvers: BTreeMap<String, Arc<dyn ExternalAuthResolverHandle>>,
pub now: Arc<dyn Fn() -> DateTime<Utc> + Sync + Send>,
pub force_refresh: bool,
pub auth_lease_handle: Option<Arc<dyn AuthLeaseHandle>>,
pub token_store: Option<Arc<dyn TokenStore>>,
pub refresh_coord: Option<Arc<dyn RefreshCoordinator>>,
}Expand description
Explicit environment passed to provider resolvers.
env_lookup replaces direct std::env::var calls — the resolution
stack reads env only through this closure. Tests seed a closure that
returns programmed values; production wiring uses
ResolverEnvironment::with_process_env.
token_store + refresh_coord are consulted by OAuth-backed auth
methods (Claude.ai, ChatGPT, Google OAuth-personal) to find a
persisted access/refresh token. Absent store → OAuth paths return
AuthError::InteractiveLoginRequired.
Fields§
§env_lookup: Arc<dyn Fn(&str) -> Option<String> + Sync + Send>§external_resolvers: BTreeMap<String, Arc<dyn ExternalAuthResolverHandle>>§now: Arc<dyn Fn() -> DateTime<Utc> + Sync + Send>§force_refresh: bool§auth_lease_handle: Option<Arc<dyn AuthLeaseHandle>>§token_store: Option<Arc<dyn TokenStore>>§refresh_coord: Option<Arc<dyn RefreshCoordinator>>Implementations§
Source§impl ResolverEnvironment
impl ResolverEnvironment
Sourcepub fn testing() -> ResolverEnvironment
pub fn testing() -> ResolverEnvironment
Testing default — env lookup always returns None, no external
resolvers, now returns the current UTC time.
Sourcepub fn with_process_env() -> ResolverEnvironment
pub fn with_process_env() -> ResolverEnvironment
Wraps std::env::var in a closure so the new stack never reads env
directly.
Sourcepub fn with_token_store(self, store: Arc<dyn TokenStore>) -> ResolverEnvironment
pub fn with_token_store(self, store: Arc<dyn TokenStore>) -> ResolverEnvironment
Attach a token store for OAuth-backed auth methods.
Sourcepub fn with_refresh_coordinator(
self,
coord: Arc<dyn RefreshCoordinator>,
) -> ResolverEnvironment
pub fn with_refresh_coordinator( self, coord: Arc<dyn RefreshCoordinator>, ) -> ResolverEnvironment
Attach a refresh coordinator. If with_token_store is set but no
coordinator is, callers fall back to InMemoryCoordinator::new().
Sourcepub fn with_external_resolver(
self,
handle: impl Into<String>,
resolver: Arc<dyn ExternalAuthResolverHandle>,
) -> ResolverEnvironment
pub fn with_external_resolver( self, handle: impl Into<String>, resolver: Arc<dyn ExternalAuthResolverHandle>, ) -> ResolverEnvironment
Register an external auth resolver under a handle name.
Sourcepub fn with_auth_lease_handle(
self,
handle: Arc<dyn AuthLeaseHandle>,
) -> ResolverEnvironment
pub fn with_auth_lease_handle( self, handle: Arc<dyn AuthLeaseHandle>, ) -> ResolverEnvironment
Attach the session-owned auth lease handle so dynamic cloud authorizers can publish observed token freshness into AuthMachine truth after a lazy token exchange.
Sourcepub fn with_force_refresh(self, force_refresh: bool) -> ResolverEnvironment
pub fn with_force_refresh(self, force_refresh: bool) -> ResolverEnvironment
Force provider runtimes to take their refresh path even when persisted credentials are still fresh.
Sourcepub fn with_env_lookup<F>(self, lookup: F) -> ResolverEnvironment
pub fn with_env_lookup<F>(self, lookup: F) -> ResolverEnvironment
Seed a custom env lookup closure (for tests).
Trait Implementations§
Source§impl Clone for ResolverEnvironment
impl Clone for ResolverEnvironment
Source§fn clone(&self) -> ResolverEnvironment
fn clone(&self) -> ResolverEnvironment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more