Struct yup_oauth2::Authenticator[][src]

pub struct Authenticator<D, S, C> { /* fields omitted */ }

A generalized authenticator which will keep tokens valid and store them.

It is the go-to helper to deal with any kind of supported authentication flow, which will be kept valid and usable.

Device Flow

This involves polling the authentication server in the given intervals until there is a definitive result.

These results will be passed the DeviceFlowHelperDelegate implementation to deal with

  • presenting the user code
  • inform the user about the progress or errors
  • abort the operation

Usage

Please have a look at the library's landing page.

Methods

impl<D, S, C> Authenticator<D, S, C> where
    D: AuthenticatorDelegate,
    S: TokenStorage,
    C: BorrowMut<Client>, 
[src]

Returns a new Authenticator instance

Arguments

  • secret - usually obtained from a client secret file produced by the [developer console][dev-con]
  • delegate - Used to further refine the flow of the authentication.
  • client - used for all authentication https requests
  • storage - used to cache authorization tokens tokens permanently. However, the implementation doesn't have any particular semantic requirement, which is why NullStorage and MemoryStorage can be used as well.
  • flow_type - the kind of authentication to use to obtain a token for the required scopes. If unset, it will be derived from the secret. [dev-con]: https://console.developers.google.com

Trait Implementations

impl<D, S, C> GetToken for Authenticator<D, S, C> where
    D: AuthenticatorDelegate,
    S: TokenStorage,
    C: BorrowMut<Client>, 
[src]

Blocks until a token was retrieved from storage, from the server, or until the delegate decided to abort the attempt, or the user decided not to authorize the application. In any failure case, the delegate will be provided with additional information, and the caller will be informed about storage related errors. Otherwise it is guaranteed to be valid for the given scopes.

Auto Trait Implementations

impl<D, S, C> Send for Authenticator<D, S, C> where
    C: Send,
    D: Send,
    S: Send

impl<D, S, C> Sync for Authenticator<D, S, C> where
    C: Sync,
    D: Sync,
    S: Sync