pub struct ApiKeyConfig { /* private fields */ }Expand description
Configuration for API Key authentication.
Implementations§
Source§impl ApiKeyConfig
impl ApiKeyConfig
Sourcepub fn header(name: impl Into<String>) -> Self
pub fn header(name: impl Into<String>) -> Self
Creates a configuration that looks for the API key in a header.
Sourcepub fn query(name: impl Into<String>) -> Self
pub fn query(name: impl Into<String>) -> Self
Creates a configuration that looks for the API key in a query parameter.
Creates a configuration that looks for the API key in the Authorization header.
Sourcepub fn add_location(self, location: ApiKeyLocation) -> Self
pub fn add_location(self, location: ApiKeyLocation) -> Self
Adds a location to look for the API key.
Sourcepub fn locations(self, locations: Vec<ApiKeyLocation>) -> Self
pub fn locations(self, locations: Vec<ApiKeyLocation>) -> Self
Sets the locations to look for the API key.
Sourcepub fn validate_expiration(self, validate: bool) -> Self
pub fn validate_expiration(self, validate: bool) -> Self
Sets whether to validate key expiration.
Sourcepub fn validate_enabled(self, validate: bool) -> Self
pub fn validate_enabled(self, validate: bool) -> Self
Sets whether to check if the key is enabled.
Sourcepub fn realm(self, realm: impl Into<String>) -> Self
pub fn realm(self, realm: impl Into<String>) -> Self
Sets the realm for authentication challenges.
Sourcepub fn get_locations(&self) -> &[ApiKeyLocation]
pub fn get_locations(&self) -> &[ApiKeyLocation]
Returns the locations to check for the API key.
Sourcepub fn should_validate_expiration(&self) -> bool
pub fn should_validate_expiration(&self) -> bool
Returns whether to validate key expiration.
Sourcepub fn should_validate_enabled(&self) -> bool
pub fn should_validate_enabled(&self) -> bool
Returns whether to validate that keys are enabled.
Trait Implementations§
Source§impl Clone for ApiKeyConfig
impl Clone for ApiKeyConfig
Source§fn clone(&self) -> ApiKeyConfig
fn clone(&self) -> ApiKeyConfig
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 ApiKeyConfig
impl Debug for ApiKeyConfig
Auto Trait Implementations§
impl Freeze for ApiKeyConfig
impl RefUnwindSafe for ApiKeyConfig
impl Send for ApiKeyConfig
impl Sync for ApiKeyConfig
impl Unpin for ApiKeyConfig
impl UnwindSafe for ApiKeyConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more