Struct yup_oauth2::authenticator::AuthenticatorBuilder
source · [−]pub struct AuthenticatorBuilder<C, F> { /* private fields */ }
Expand description
Configure an Authenticator using the builder pattern.
Implementations
sourceimpl<C, F> AuthenticatorBuilder<C, F>
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");
sourcepub fn with_storage(self, storage: Box<dyn TokenStorage>) -> Self
pub fn with_storage(self, storage: Box<dyn TokenStorage>) -> Self
Use the provided token storage mechanism
sourcepub fn hyper_client<NewC>(
self,
hyper_client: Client<NewC>
) -> AuthenticatorBuilder<Client<NewC>, F>
pub fn hyper_client<NewC>(
self,
hyper_client: Client<NewC>
) -> AuthenticatorBuilder<Client<NewC>, F>
Use the provided hyper client.
sourcepub fn persist_tokens_to_disk<P: Into<PathBuf>>(
self,
path: P
) -> AuthenticatorBuilder<C, F>
pub fn persist_tokens_to_disk<P: Into<PathBuf>>(
self,
path: P
) -> AuthenticatorBuilder<C, F>
Persist tokens to disk in the provided filename.
sourceimpl<C> AuthenticatorBuilder<C, DeviceFlow>
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");
sourcepub fn device_code_url(self, url: impl Into<Cow<'static, str>>) -> Self
pub fn device_code_url(self, url: impl Into<Cow<'static, str>>) -> Self
Use the provided device code url.
sourcepub fn flow_delegate(self, flow_delegate: Box<dyn DeviceFlowDelegate>) -> Self
pub fn flow_delegate(self, flow_delegate: Box<dyn DeviceFlowDelegate>) -> Self
Use the provided DeviceFlowDelegate.
sourcepub fn grant_type(self, grant_type: impl Into<Cow<'static, str>>) -> Self
pub fn grant_type(self, grant_type: impl Into<Cow<'static, str>>) -> Self
Use the provided grant type.
sourcepub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
pub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
Create the authenticator.
sourceimpl<C> AuthenticatorBuilder<C, InstalledFlow>
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");
sourcepub fn flow_delegate(
self,
flow_delegate: Box<dyn InstalledFlowDelegate>
) -> Self
pub fn flow_delegate(
self,
flow_delegate: Box<dyn InstalledFlowDelegate>
) -> Self
Use the provided InstalledFlowDelegate.
sourcepub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
pub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
Create the authenticator.
sourceimpl<C> AuthenticatorBuilder<C, ServiceAccountFlowOpts>
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");
sourcepub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
pub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
Create the authenticator.
sourceimpl<C> AuthenticatorBuilder<C, ApplicationDefaultCredentialsFlowOpts>
impl<C> AuthenticatorBuilder<C, ApplicationDefaultCredentialsFlowOpts>
sourcepub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
pub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
Create the authenticator.
sourceimpl<C> AuthenticatorBuilder<C, AuthorizedUserFlow>
impl<C> AuthenticatorBuilder<C, AuthorizedUserFlow>
sourcepub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
pub async fn build(self) -> Result<Authenticator<C::Connector>> where
C: HyperClientBuilder,
Create the authenticator.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more