pub enum AnyTokenProvider {
Static(StaticToken),
Profile(ProfileTokenProvider),
Azure(AzureTokenProvider),
Gcp(GcpTokenProvider),
AwsSts(AwsStsTokenProvider),
}Expand description
Type-erased token provider.
Variants§
Static(StaticToken)
Static key, never refreshed.
Profile(ProfileTokenProvider)
Driven by a loaded [oauth] table.
Azure(AzureTokenProvider)
Azure AD client credentials.
Gcp(GcpTokenProvider)
GCP service-account JWT bearer.
AwsSts(AwsStsTokenProvider)
AWS STS AssumeRole (not a Bearer API key).
Implementations§
Source§impl AnyTokenProvider
impl AnyTokenProvider
Sourcepub fn without_http_refresh(&self)
pub fn without_http_refresh(&self)
Skip token-URL POSTs on later TokenProvider::get_token calls.
No-op for static / cloud STS providers.
Sourcepub fn quota_project_id(&self) -> Option<&str>
pub fn quota_project_id(&self) -> Option<&str>
ADC quota_project_id for Vertex, if this is a GCP authorized_user grant.
Sourcepub async fn offline_block(&self) -> Option<String>
pub async fn offline_block(&self) -> Option<String>
Local reason TokenProvider::get_token would fail with no network.
None for static keys and for a profile token that is still inside
its lifetime or that has a refresh token. Status uses this so it does
not call the token URL.
Sourcepub fn can_refresh(&self) -> bool
pub fn can_refresh(&self) -> bool
True when a 401 can be retried after TokenProvider::mark_stale
and another get_token.
Static keys never refresh. AWS STS session keys are not a bearer
token: get_token always fails, and mark_stale only affects
get_credentials.
Trait Implementations§
Source§impl Clone for AnyTokenProvider
impl Clone for AnyTokenProvider
Source§impl Debug for AnyTokenProvider
impl Debug for AnyTokenProvider
Source§impl From<AwsStsTokenProvider> for AnyTokenProvider
Available on crate feature net only.
impl From<AwsStsTokenProvider> for AnyTokenProvider
net only.Source§fn from(t: AwsStsTokenProvider) -> Self
fn from(t: AwsStsTokenProvider) -> Self
Source§impl From<AzureTokenProvider> for AnyTokenProvider
Available on crate feature net only.
impl From<AzureTokenProvider> for AnyTokenProvider
net only.Source§fn from(t: AzureTokenProvider) -> Self
fn from(t: AzureTokenProvider) -> Self
Source§impl From<GcpTokenProvider> for AnyTokenProvider
Available on crate feature net only.
impl From<GcpTokenProvider> for AnyTokenProvider
net only.Source§fn from(t: GcpTokenProvider) -> Self
fn from(t: GcpTokenProvider) -> Self
Source§impl From<ProfileTokenProvider> for AnyTokenProvider
Available on crate feature net only.
impl From<ProfileTokenProvider> for AnyTokenProvider
net only.Source§fn from(t: ProfileTokenProvider) -> Self
fn from(t: ProfileTokenProvider) -> Self
Source§impl From<StaticToken> for AnyTokenProvider
Available on crate feature net only.
impl From<StaticToken> for AnyTokenProvider
net only.Source§fn from(t: StaticToken) -> Self
fn from(t: StaticToken) -> Self
Source§impl TokenProvider for AnyTokenProvider
Available on crate feature net only.
impl TokenProvider for AnyTokenProvider
net only.Source§fn mark_stale(&self)
fn mark_stale(&self)
TokenProvider::get_token refreshes.Source§fn wake(&self)
fn wake(&self)
TokenProvider::mark_stale.