[][src]Struct yup_oauth2::Authenticator

pub struct Authenticator<T: GetToken, S: TokenStorage, AD: AuthenticatorDelegate, C: Connect> { /* fields omitted */ }

Authenticator abstracts different GetToken implementations behind one type and handles caching received tokens. It's important to use it (instead of the flows directly) because otherwise the user needs to be asked for new authorization every time a token is generated.

ServiceAccountAccess does not need (and does not work) with Authenticator, given that it does not require interaction and implements its own caching. Use it directly.

NOTE: It is recommended to use a client constructed like this in order to prevent functions like hyper::run() from hanging: let client = hyper::Client::builder().keep_alive(false);. Due to token requests being rare, this should not result in a too bad performance problem.

Methods

impl<T: GetToken, AD: AuthenticatorDelegate, C: Connect> Authenticator<T, MemoryStorage, AD, C>[src]

pub fn new(
    client: Client<C>,
    inner: T,
    delegate: AD
) -> Authenticator<T, MemoryStorage, AD, C>
[src]

Create an Authenticator caching tokens for the duration of this authenticator.

impl<T: GetToken, AD: AuthenticatorDelegate, C: Connect> Authenticator<T, DiskTokenStorage, AD, C>[src]

pub fn new_disk<P: AsRef<str>>(
    client: Client<C>,
    inner: T,
    delegate: AD,
    token_storage_path: P
) -> Result<Authenticator<T, DiskTokenStorage, AD, C>>
[src]

Create an Authenticator using the store at path.

Trait Implementations

impl<GT: 'static + GetToken + Send, S: 'static + TokenStorage + Send, AD: 'static + AuthenticatorDelegate + Send, C: 'static + Connect + Clone + Send> GetToken for Authenticator<GT, S, AD, C>[src]

fn api_key(&mut self) -> Option<String>[src]

Returns the API Key of the inner flow.

fn application_secret(&self) -> ApplicationSecret[src]

Returns the application secret of the inner flow.

Auto Trait Implementations

impl<T, S, AD, C> Sync for Authenticator<T, S, AD, C> where
    AD: Sync,
    S: Send,
    T: Send

impl<T, S, AD, C> Send for Authenticator<T, S, AD, C> where
    AD: Send,
    S: Send,
    T: Send

impl<T, S, AD, C> Unpin for Authenticator<T, S, AD, C> where
    AD: Unpin

impl<T, S, AD, C> !RefUnwindSafe for Authenticator<T, S, AD, C>

impl<T, S, AD, C> !UnwindSafe for Authenticator<T, S, AD, C>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T