pub struct OAuth2ConfigBuilder { /* private fields */ }Available on crate feature
oauth2 only.Expand description
Builder for OAuth2 configuration.
Implementations§
Source§impl OAuth2ConfigBuilder
impl OAuth2ConfigBuilder
Sourcepub fn new(
client_id: impl Into<String>,
token_url: impl AsRef<str>,
) -> Result<Self, OAuth2Error>
pub fn new( client_id: impl Into<String>, token_url: impl AsRef<str>, ) -> Result<Self, OAuth2Error>
Creates a new builder with required parameters.
Sourcepub fn with_client_secret(self, secret: impl Into<SecureString>) -> Self
pub fn with_client_secret(self, secret: impl Into<SecureString>) -> Self
Sets the client secret.
Sourcepub fn with_auth_url(
self,
auth_url: impl AsRef<str>,
) -> Result<Self, OAuth2Error>
pub fn with_auth_url( self, auth_url: impl AsRef<str>, ) -> Result<Self, OAuth2Error>
Sets the authorization URL (optional, for documentation).
Sourcepub fn add_scopes(
self,
scopes: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn add_scopes( self, scopes: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Adds multiple scopes.
Sourcepub fn with_auto_refresh(self, auto_refresh: bool) -> Self
pub fn with_auto_refresh(self, auto_refresh: bool) -> Self
Sets whether to automatically refresh tokens.
Sourcepub fn with_refresh_threshold(self, threshold: Duration) -> Self
pub fn with_refresh_threshold(self, threshold: Duration) -> Self
Sets the refresh threshold (how long before expiry to refresh).
Sourcepub fn build(self) -> Result<OAuth2Config, OAuth2Error>
pub fn build(self) -> Result<OAuth2Config, OAuth2Error>
Builds the OAuth2 configuration.
Trait Implementations§
Source§impl Clone for OAuth2ConfigBuilder
impl Clone for OAuth2ConfigBuilder
Source§fn clone(&self) -> OAuth2ConfigBuilder
fn clone(&self) -> OAuth2ConfigBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OAuth2ConfigBuilder
impl RefUnwindSafe for OAuth2ConfigBuilder
impl Send for OAuth2ConfigBuilder
impl Sync for OAuth2ConfigBuilder
impl Unpin for OAuth2ConfigBuilder
impl UnwindSafe for OAuth2ConfigBuilder
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