Struct yup_oauth2::authenticator::AuthenticatorBuilder

source ·
pub struct AuthenticatorBuilder<C, F> { /* private fields */ }
Expand description

Configure an Authenticator using the builder pattern.

Implementations§

source§

impl<C, F> AuthenticatorBuilder<C, F>

§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");
source

pub fn with_storage(self, storage: Box<dyn TokenStorage>) -> Self

Use the provided token storage mechanism

source

pub fn hyper_client<NewC>( self, hyper_client: Client<NewC, String>, ) -> AuthenticatorBuilder<Client<NewC, String>, F>

Use the provided hyper client.

source

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

Persist tokens to disk in the provided filename.

source§

impl<C> AuthenticatorBuilder<C, DeviceFlow>

§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");
source

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

Use the provided device code url.

source

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

Use the provided DeviceFlowDelegate.

source

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

Use the provided grant type.

source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source§

impl<C> AuthenticatorBuilder<C, InstalledFlow>

§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");
source

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

Use the provided InstalledFlowDelegate.

source

pub fn force_account_selection(self, force: bool) -> Self

Force the user to select an account on the initial request

source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source§

impl<C> AuthenticatorBuilder<C, ServiceAccountFlowOpts>

§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");
source

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

Use the provided subject.

source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source§

impl<C> AuthenticatorBuilder<C, ApplicationDefaultCredentialsFlowOpts>

source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source§

impl<C> AuthenticatorBuilder<C, AuthorizedUserFlow>

§Methods available when building an authorized user flow Authenticator.
source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source§

impl<C> AuthenticatorBuilder<C, ExternalAccountFlow>

§Methods available when building an external account flow Authenticator.
source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source§

impl<C> AuthenticatorBuilder<C, ServiceAccountImpersonationFlow>

§Methods available when building a service account impersonation Authenticator.
source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

source

pub fn request_id_token(self) -> Self

Configure this authenticator to impersonate an ID token (rather an an access token, as is the default).

For more on impersonating ID tokens, see google’s docs.

source§

impl<C> AuthenticatorBuilder<C, AccessTokenFlow>

§Methods available when building an access token flow Authenticator.
source

pub async fn build(self) -> Result<Authenticator<C::Connector>>

Create the authenticator.

Auto Trait Implementations§

§

impl<C, F> Freeze for AuthenticatorBuilder<C, F>
where C: Freeze, F: Freeze,

§

impl<C, F> !RefUnwindSafe for AuthenticatorBuilder<C, F>

§

impl<C, F> Send for AuthenticatorBuilder<C, F>
where C: Send, F: Send,

§

impl<C, F> Sync for AuthenticatorBuilder<C, F>
where C: Sync, F: Sync,

§

impl<C, F> Unpin for AuthenticatorBuilder<C, F>
where C: Unpin, F: Unpin,

§

impl<C, F> !UnwindSafe for AuthenticatorBuilder<C, F>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T