Struct yup_oauth2::authenticator::AuthenticatorBuilder[][src]

pub struct AuthenticatorBuilder<C, F> { /* fields omitted */ }

Configure an Authenticator using the builder pattern.

Implementations

impl<C, F> AuthenticatorBuilder<C, F>[src]

Methods available when building any Authenticator.

    let authenticator = yup_oauth2::DeviceFlowAuthenticator::builder(app_secret)
        .hyper_client(custom_hyper_client)
        .persist_tokens_to_disk("/tmp/tokenfile.json")
        .build()
        .await
        .expect("failed to create authenticator");

pub fn hyper_client<NewC>(
    self,
    hyper_client: Client<NewC>
) -> AuthenticatorBuilder<Client<NewC>, F>
[src]

Use the provided hyper client.

pub fn persist_tokens_to_disk<P: Into<PathBuf>>(
    self,
    path: P
) -> AuthenticatorBuilder<C, F>
[src]

Persist tokens to disk in the provided filename.

impl<C> AuthenticatorBuilder<C, DeviceFlow>[src]

Methods available when building a device flow Authenticator.

    let authenticator = yup_oauth2::DeviceFlowAuthenticator::builder(app_secret)
        .device_code_url("foo")
        .flow_delegate(Box::new(custom_flow_delegate))
        .grant_type("foo")
        .build()
        .await
        .expect("failed to create authenticator");

pub fn device_code_url(self, url: impl Into<Cow<'static, str>>) -> Self[src]

Use the provided device code url.

pub fn flow_delegate(self, flow_delegate: Box<dyn DeviceFlowDelegate>) -> Self[src]

Use the provided DeviceFlowDelegate.

pub fn grant_type(self, grant_type: impl Into<Cow<'static, str>>) -> Self[src]

Use the provided grant type.

pub async fn build(self) -> Result<Authenticator<C::Connector>> where
    C: HyperClientBuilder
[src]

Create the authenticator.

impl<C> AuthenticatorBuilder<C, InstalledFlow>[src]

Methods available when building an installed flow Authenticator.

    let authenticator = yup_oauth2::InstalledFlowAuthenticator::builder(
        app_secret,
        InstalledFlowReturnMethod::HTTPRedirect,
    )
    .flow_delegate(Box::new(custom_flow_delegate))
    .build()
    .await
    .expect("failed to create authenticator");

pub fn flow_delegate(
    self,
    flow_delegate: Box<dyn InstalledFlowDelegate>
) -> Self
[src]

Use the provided InstalledFlowDelegate.

pub async fn build(self) -> Result<Authenticator<C::Connector>> where
    C: HyperClientBuilder
[src]

Create the authenticator.

impl<C> AuthenticatorBuilder<C, ServiceAccountFlowOpts>[src]

Methods available when building a service account authenticator.

    let authenticator = yup_oauth2::ServiceAccountAuthenticator::builder(
        service_account_key,
    )
    .subject("mysubject")
    .build()
    .await
    .expect("failed to create authenticator");

pub fn subject(self, subject: impl Into<String>) -> Self[src]

Use the provided subject.

pub async fn build(self) -> Result<Authenticator<C::Connector>> where
    C: HyperClientBuilder
[src]

Create the authenticator.

Auto Trait Implementations

impl<C, F> RefUnwindSafe for AuthenticatorBuilder<C, F> where
    C: RefUnwindSafe,
    F: RefUnwindSafe
[src]

impl<C, F> Send for AuthenticatorBuilder<C, F> where
    C: Send,
    F: Send
[src]

impl<C, F> Sync for AuthenticatorBuilder<C, F> where
    C: Sync,
    F: Sync
[src]

impl<C, F> Unpin for AuthenticatorBuilder<C, F> where
    C: Unpin,
    F: Unpin
[src]

impl<C, F> UnwindSafe for AuthenticatorBuilder<C, F> where
    C: UnwindSafe,
    F: UnwindSafe
[src]

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

impl<T> Instrument 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.