pub enum AuthMethod {
Bearer(BearerAuth),
OAuth(OAuthConfig),
ApiKey(ApiKeyAuth),
Basic(BasicAuth),
Custom(CustomHeaderAuth),
None,
}Expand description
Unified authentication method
Variants§
Bearer(BearerAuth)
OAuth(OAuthConfig)
ApiKey(ApiKeyAuth)
Basic(BasicAuth)
Custom(CustomHeaderAuth)
None
Implementations§
Source§impl AuthMethod
impl AuthMethod
pub fn bearer(token: String) -> AuthMethod
pub fn oauth(config: OAuthConfig) -> AuthMethod
pub fn api_key(api_key: String) -> AuthMethod
pub fn basic(username: String, password: String) -> AuthMethod
pub fn custom() -> AuthMethod
pub fn none() -> AuthMethod
Sourcepub async fn get_headers(&self) -> Result<HashMap<String, String>, AuthError>
pub async fn get_headers(&self) -> Result<HashMap<String, String>, AuthError>
Get authentication headers for HTTP requests
Sourcepub fn requires_refresh(&self) -> bool
pub fn requires_refresh(&self) -> bool
Check if this auth method requires token refresh
Trait Implementations§
Source§impl Clone for AuthMethod
impl Clone for AuthMethod
Source§fn clone(&self) -> AuthMethod
fn clone(&self) -> AuthMethod
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 AuthMethod
impl Debug for AuthMethod
Source§impl Default for AuthMethod
impl Default for AuthMethod
Source§fn default() -> AuthMethod
fn default() -> AuthMethod
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuthMethod
impl !RefUnwindSafe for AuthMethod
impl Send for AuthMethod
impl Sync for AuthMethod
impl Unpin for AuthMethod
impl !UnwindSafe for AuthMethod
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