[−][src]Struct yup_oauth2::Authenticator
An authenticator can be used with InstalledFlow
's or DeviceFlow
's and
will refresh tokens as they expire as well as optionally persist tokens to
disk.
Methods
impl<T> Authenticator<T, MemoryStorage, DefaultAuthenticatorDelegate, DefaultHyperClient> where
T: AuthFlow<<DefaultHyperClient as HyperClientBuilder>::Connector>,
[src]
T: AuthFlow<<DefaultHyperClient as HyperClientBuilder>::Connector>,
pub fn new(
flow: T
) -> Authenticator<T, MemoryStorage, DefaultAuthenticatorDelegate, DefaultHyperClient>
[src]
flow: T
) -> Authenticator<T, MemoryStorage, DefaultAuthenticatorDelegate, DefaultHyperClient>
Create a new authenticator with the provided flow. By default a new hyper::Client will be created the default authenticator delegate will be used, and tokens will not be persisted to disk. Accepted flow types are DeviceFlow and InstalledFlow.
Examples
use std::path::Path; use yup_oauth2::{ApplicationSecret, Authenticator, DeviceFlow}; let creds = ApplicationSecret::default(); let auth = Authenticator::new(DeviceFlow::new(creds)).build().unwrap();
impl<T, S, AD, C> Authenticator<T, S, AD, C> where
T: AuthFlow<C::Connector>,
S: TokenStorage,
AD: AuthenticatorDelegate,
C: HyperClientBuilder,
[src]
T: AuthFlow<C::Connector>,
S: TokenStorage,
AD: AuthenticatorDelegate,
C: HyperClientBuilder,
pub fn hyper_client<NewC>(
self,
hyper_client: Client<NewC>
) -> Authenticator<T, S, AD, Client<NewC>> where
NewC: Connect,
T: AuthFlow<NewC>,
[src]
self,
hyper_client: Client<NewC>
) -> Authenticator<T, S, AD, Client<NewC>> where
NewC: Connect,
T: AuthFlow<NewC>,
Use the provided hyper client.
pub fn persist_tokens_to_disk<P: AsRef<Path>>(
self,
path: P
) -> Authenticator<T, DiskTokenStorage, AD, C>
[src]
self,
path: P
) -> Authenticator<T, DiskTokenStorage, AD, C>
Persist tokens to disk in the provided filename.
pub fn delegate<NewAD: AuthenticatorDelegate>(
self,
delegate: NewAD
) -> Authenticator<T, S, NewAD, C>
[src]
self,
delegate: NewAD
) -> Authenticator<T, S, NewAD, C>
Use the provided authenticator delegate.
pub fn build(self) -> Result<impl GetToken> where
T::TokenGetter: 'static + GetToken + Send,
S: 'static + Send,
AD: 'static + Send,
C::Connector: 'static + Clone + Send,
[src]
T::TokenGetter: 'static + GetToken + Send,
S: 'static + Send,
AD: 'static + Send,
C::Connector: 'static + Clone + Send,
Create the authenticator.
Auto Trait Implementations
impl<T, S, AD, C> Send for Authenticator<T, S, AD, C> where
AD: Send,
C: Send,
S: Send,
T: Send,
AD: Send,
C: Send,
S: Send,
T: Send,
impl<T, S, AD, C> Unpin for Authenticator<T, S, AD, C> where
AD: Unpin,
C: Unpin,
S: Unpin,
T: Unpin,
AD: Unpin,
C: Unpin,
S: Unpin,
T: Unpin,
impl<T, S, AD, C> Sync for Authenticator<T, S, AD, C> where
AD: Sync,
C: Sync,
S: Sync,
T: Sync,
AD: Sync,
C: Sync,
S: Sync,
T: Sync,
impl<T, S, AD, C> !UnwindSafe for Authenticator<T, S, AD, C>
impl<T, S, AD, C> !RefUnwindSafe for Authenticator<T, S, AD, C>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,