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>
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, String>,
) -> AuthenticatorBuilder<Client<NewC, String>, F>
pub fn hyper_client<NewC>( self, hyper_client: Client<NewC, String>, ) -> AuthenticatorBuilder<Client<NewC, String>, 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.
source§impl<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.
source§impl<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 fn force_account_selection(self, force: bool) -> Self
pub fn force_account_selection(self, force: bool) -> Self
Force the user to select an account on the initial request
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.
source§impl<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.
source§impl<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.
source§impl<C> AuthenticatorBuilder<C, AuthorizedUserFlow>
impl<C> AuthenticatorBuilder<C, AuthorizedUserFlow>
§Methods available when building an authorized user flow 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.
source§impl<C> AuthenticatorBuilder<C, ExternalAccountFlow>
impl<C> AuthenticatorBuilder<C, ExternalAccountFlow>
§Methods available when building an external account flow 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.
source§impl<C> AuthenticatorBuilder<C, ServiceAccountImpersonationFlow>
impl<C> AuthenticatorBuilder<C, ServiceAccountImpersonationFlow>
§Methods available when building a service account impersonation 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.
sourcepub fn request_id_token(self) -> Self
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>
impl<C> AuthenticatorBuilder<C, AccessTokenFlow>
§Methods available when building an access token flow 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.
Auto Trait Implementations§
impl<C, F> Freeze for AuthenticatorBuilder<C, F>
impl<C, F> !RefUnwindSafe for AuthenticatorBuilder<C, F>
impl<C, F> Send for AuthenticatorBuilder<C, F>
impl<C, F> Sync for AuthenticatorBuilder<C, F>
impl<C, F> Unpin for AuthenticatorBuilder<C, F>
impl<C, F> !UnwindSafe for AuthenticatorBuilder<C, F>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more