pub struct AuthConfig {
pub method: AuthMethod,
pub scopes: Vec<String>,
}Expand description
Authentication configuration wrapper
Fields§
§method: AuthMethodThe authentication method
scopes: Vec<String>Optional scopes or permissions
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn api_key(
header_name: impl Into<String>,
api_key: impl Into<String>,
) -> Self
pub fn api_key( header_name: impl Into<String>, api_key: impl Into<String>, ) -> Self
Create API key authentication
Sourcepub fn api_key_with_prefix(
header_name: impl Into<String>,
api_key: impl Into<String>,
prefix: impl Into<String>,
) -> Self
pub fn api_key_with_prefix( header_name: impl Into<String>, api_key: impl Into<String>, prefix: impl Into<String>, ) -> Self
Create API key authentication with prefix
Sourcepub fn basic(username: impl Into<String>, password: impl Into<String>) -> Self
pub fn basic(username: impl Into<String>, password: impl Into<String>) -> Self
Create Basic authentication
Sourcepub fn bearer_token(token: impl Into<String>) -> Self
pub fn bearer_token(token: impl Into<String>) -> Self
Create Bearer token authentication
Sourcepub fn custom_headers(headers: HashMap<String, String>) -> Self
pub fn custom_headers(headers: HashMap<String, String>) -> Self
Create custom header authentication
Sourcepub fn oauth2_client_credentials(
token_url: impl Into<String>,
client_id: impl Into<String>,
client_secret: impl Into<String>,
) -> Self
pub fn oauth2_client_credentials( token_url: impl Into<String>, client_id: impl Into<String>, client_secret: impl Into<String>, ) -> Self
Create OAuth2 authentication with client credentials
Create OAuth2 authentication with authorization code
Sourcepub fn oauth2_with_tokens(
token_url: impl Into<String>,
client_id: impl Into<String>,
client_secret: Option<String>,
access_token: impl Into<String>,
refresh_token: impl Into<String>,
) -> Self
pub fn oauth2_with_tokens( token_url: impl Into<String>, client_id: impl Into<String>, client_secret: Option<String>, access_token: impl Into<String>, refresh_token: impl Into<String>, ) -> Self
Create OAuth2 authentication with existing tokens
Sourcepub fn with_scopes(self, scopes: Vec<String>) -> Self
pub fn with_scopes(self, scopes: Vec<String>) -> Self
Add scopes to authentication
Sourcepub fn build_headers(&self) -> Result<HeaderMap>
pub fn build_headers(&self) -> Result<HeaderMap>
Build request headers from authentication config
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
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 moreSource§impl Debug for AuthConfig
impl Debug for AuthConfig
Source§impl Default for AuthConfig
impl Default for AuthConfig
Source§impl<'de> Deserialize<'de> for AuthConfig
impl<'de> Deserialize<'de> for AuthConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnwindSafe for AuthConfig
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