[−][src]Struct yup_oauth2::Authenticator
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]
client: Client<C>,
inner: T,
delegate: AD
) -> Authenticator<T, MemoryStorage, AD, C>
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]
client: Client<C>,
inner: T,
delegate: AD,
token_storage_path: P
) -> Result<Authenticator<T, DiskTokenStorage, AD, C>>
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.
fn token<I, T>(
&mut self,
scopes: I
) -> Box<dyn Future<Item = Token, Error = RequestError> + Send> where
T: Into<String>,
I: IntoIterator<Item = T>,
[src]
&mut self,
scopes: I
) -> Box<dyn Future<Item = Token, Error = RequestError> + Send> where
T: Into<String>,
I: IntoIterator<Item = T>,
Auto Trait Implementations
impl<T, S, AD, C> Sync for Authenticator<T, S, AD, C> where
AD: Sync,
S: Send,
T: Send,
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,
AD: Send,
S: Send,
T: Send,
impl<T, S, AD, C> Unpin for Authenticator<T, S, AD, C> where
AD: Unpin,
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]
U: From<T>,
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,