pub enum TokenProviderWrapperInner {
    EndUser(EndUserCredentialsInner),
    Metadata(MetadataServerProviderInner),
    ServiceAccount(ServiceAccountProviderInner),
}
Expand description

Wrapper around the different providers that are supported. Implements both TokenProvider and IdTokenProvider. Should not be used directly as it is not cached. Use TokenProviderWrapper instead.

Variants§

Implementations§

source§

impl TokenProviderWrapperInner

source

pub fn get_default_provider() -> Result<Option<Self>, Error>

Get a TokenProvider following the “Google Default Credentials” flow. Returns a uncached token provider, use TokenProviderWrapper::get_default_provider instead.

source

pub fn kind(&self) -> &'static str

Gets the kind of token provider

source

pub fn is_service_account_provider(&self) -> bool

source

pub fn is_metadata_server_provider(&self) -> bool

source

pub fn is_end_user_credentials_provider(&self) -> bool

Trait Implementations§

source§

impl Debug for TokenProviderWrapperInner

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IdTokenProvider for TokenProviderWrapperInner

source§

fn get_id_token(&self, audience: &str) -> Result<IdTokenOrRequest, Error>

Attempts to retrieve an id token that can be used when communicating via IAP etc.
source§

fn get_id_token_with_access_token<S>( &self, audience: &str, response: AccessTokenResponse<S> ) -> Result<IdTokenRequest, Error>
where S: AsRef<[u8]>,

Some token sources require a access token to be used to generte a id token. If get_id_token returns a AccessTokenResponse, this method should be called.
source§

fn parse_id_token_response<S>( &self, hash: u64, response: Response<S> ) -> Result<IdToken, Error>
where S: AsRef<[u8]>,

Once a IdTokenResponse has been received for an id token request, call this method to deserialize the token.
source§

impl TokenProvider for TokenProviderWrapperInner

source§

fn get_token_with_subject<'a, S, I, T>( &self, subject: Option<T>, scopes: I ) -> Result<TokenOrRequest, Error>
where S: AsRef<str> + 'a, I: IntoIterator<Item = &'a S> + Clone, T: Into<String>,

Like TokenProvider::get_token, but allows the JWT “subject” to be passed in.
source§

fn parse_token_response<S>( &self, hash: u64, response: Response<S> ) -> Result<Token, Error>
where S: AsRef<[u8]>,

Once a response has been received for a token request, call this method to deserialize the token (and potentially store it in a local cache for reuse until it expires).
source§

fn get_token<'a, S, I>(&self, scopes: I) -> Result<TokenOrRequest, Error>
where S: AsRef<str> + 'a, I: IntoIterator<Item = &'a S> + Clone,

Attempts to retrieve a token that can be used in an API request, if we haven’t already retrieved a token for the specified scopes, or the token has expired, an HTTP request is returned that can be used to retrieve a token. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.