pub struct TokenBroker { /* private fields */ }Expand description
Fetches short-lived provider credentials from a broker endpoint.
Implementations§
Source§impl TokenBroker
impl TokenBroker
pub fn new(config: TokenBrokerConfig) -> Result<Self, LlmError>
Sourcepub fn cached(
config: TokenBrokerConfig,
) -> Result<CachedCredentials<Self>, LlmError>
pub fn cached( config: TokenBrokerConfig, ) -> Result<CachedCredentials<Self>, LlmError>
A broker wrapped in CachedCredentials (the recommended form).
Trait Implementations§
Source§impl Clone for TokenBroker
impl Clone for TokenBroker
Source§impl CredentialSource for TokenBroker
impl CredentialSource for TokenBroker
Source§fn generation(&self) -> u64
fn generation(&self) -> u64
Tokens minted for one app session must not outlive it: when the app credential source changes (sign-out, new user), cached tokens are dropped.
Source§fn credential<'a>(
&'a self,
provider: &'a str,
) -> BoxFuture<'a, Result<Credential, LlmError>>
fn credential<'a>( &'a self, provider: &'a str, ) -> BoxFuture<'a, Result<Credential, LlmError>>
Credential for
provider (the registry name, e.g. openai).Source§fn invalidate(&self, provider: &str)
fn invalidate(&self, provider: &str)
Called when the provider rejected the last credential (HTTP 401/403), so
cached values can be dropped before one retry.
Auto Trait Implementations§
impl !RefUnwindSafe for TokenBroker
impl !UnwindSafe for TokenBroker
impl Forget for TokenBroker
impl Freeze for TokenBroker
impl Move for TokenBroker
impl Send for TokenBroker
impl Sync for TokenBroker
impl Unpin for TokenBroker
impl UnsafeUnpin for TokenBroker
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