pub struct AuthConfig {
pub require_auth: bool,
pub realm: String,
pub allow_anonymous_read: bool,
pub enable_basic_auth: bool,
pub enable_bearer_token: bool,
pub api_keys: HashMap<String, ApiKeyEntry>,
pub api_key_header: String,
}Expand description
Authentication configuration
Fields§
§require_auth: boolWhether authentication is required
realm: StringRealm for Basic Auth challenge
allow_anonymous_read: boolAllow anonymous read access
enable_basic_auth: boolEnable Basic Auth (username:password)
enable_bearer_token: boolEnable Bearer Token (session ID lookup)
api_keys: HashMap<String, ApiKeyEntry>API Keys (key -> ApiKeyEntry mapping)
api_key_header: StringCustom API key header name (default: X-API-Key)
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn with_anonymous_read(self, allow: bool) -> Self
pub fn with_anonymous_read(self, allow: bool) -> Self
Create config with anonymous read access
Sourcepub fn with_basic_auth(self, enable: bool) -> Self
pub fn with_basic_auth(self, enable: bool) -> Self
Enable/disable Basic Auth
Sourcepub fn with_bearer_token(self, enable: bool) -> Self
pub fn with_bearer_token(self, enable: bool) -> Self
Enable/disable Bearer Token (session lookup)
Sourcepub fn with_api_keys(self, keys: Vec<ApiKeyEntry>) -> Self
pub fn with_api_keys(self, keys: Vec<ApiKeyEntry>) -> Self
Add API keys for authentication
Sourcepub fn add_api_key(
self,
key: impl Into<String>,
principal: impl Into<String>,
) -> Self
pub fn add_api_key( self, key: impl Into<String>, principal: impl Into<String>, ) -> Self
Add a single API key
Sourcepub fn with_api_key_header(self, header: impl Into<String>) -> Self
pub fn with_api_key_header(self, header: impl Into<String>) -> Self
Set custom API key header name
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
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnsafeUnpin 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