[−][src]Struct yup_oauth2::Authenticator
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]
D: AuthenticatorDelegate,
S: TokenStorage,
C: BorrowMut<Client>,
pub fn new(
secret: &ApplicationSecret,
delegate: D,
client: C,
storage: S,
flow_type: Option<FlowType>
) -> Authenticator<D, S, C>
[src]
secret: &ApplicationSecret,
delegate: D,
client: C,
storage: S,
flow_type: Option<FlowType>
) -> Authenticator<D, S, C>
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 requestsstorage
- used to cache authorization tokens tokens permanently. However, the implementation doesn't have any particular semantic requirement, which is whyNullStorage
andMemoryStorage
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]
D: AuthenticatorDelegate,
S: TokenStorage,
C: BorrowMut<Client>,
fn token<'b, I, T>(&mut self, scopes: I) -> Result<Token, Box<dyn Error>> where
T: AsRef<str> + Ord + 'b,
I: IntoIterator<Item = &'b T>,
[src]
T: AsRef<str> + Ord + 'b,
I: IntoIterator<Item = &'b T>,
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.
fn api_key(&mut self) -> Option<String>
[src]
Auto Trait Implementations
impl<D, S, C> Sync for Authenticator<D, S, C> where
C: Sync,
D: Sync,
S: Sync,
C: Sync,
D: Sync,
S: Sync,
impl<D, S, C> Send for Authenticator<D, S, C> where
C: Send,
D: Send,
S: Send,
C: Send,
D: Send,
S: Send,
impl<D, S, C> Unpin for Authenticator<D, S, C> where
C: Unpin,
D: Unpin,
S: Unpin,
C: Unpin,
D: Unpin,
S: Unpin,
impl<D, S, C> RefUnwindSafe for Authenticator<D, S, C> where
C: RefUnwindSafe,
D: RefUnwindSafe,
S: RefUnwindSafe,
C: RefUnwindSafe,
D: RefUnwindSafe,
S: RefUnwindSafe,
impl<D, S, C> UnwindSafe for Authenticator<D, S, C> where
C: UnwindSafe,
D: UnwindSafe,
S: UnwindSafe,
C: UnwindSafe,
D: UnwindSafe,
S: UnwindSafe,
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,
impl<T> Typeable for T where
T: Any,
T: Any,