pub struct ServiceAuthManager { /* private fields */ }Expand description
Manages service authentication
Implementations§
Source§impl ServiceAuthManager
impl ServiceAuthManager
pub fn new() -> Self
pub fn with_session_duration(self, duration: Duration) -> Self
Sourcepub fn create_service_account(
&self,
account: ServiceAccount,
) -> ServiceAuthResult<()>
pub fn create_service_account( &self, account: ServiceAccount, ) -> ServiceAuthResult<()>
Create a new service account
Sourcepub fn get_service_account(&self, name: &str) -> Option<ServiceAccount>
pub fn get_service_account(&self, name: &str) -> Option<ServiceAccount>
Get a service account
Sourcepub fn disable_service_account(&self, name: &str) -> ServiceAuthResult<()>
pub fn disable_service_account(&self, name: &str) -> ServiceAuthResult<()>
Disable a service account (revokes all sessions)
Sourcepub fn create_api_key(
&self,
service_account: &str,
description: Option<&str>,
expires_in: Option<Duration>,
permissions: Vec<String>,
) -> ServiceAuthResult<String>
pub fn create_api_key( &self, service_account: &str, description: Option<&str>, expires_in: Option<Duration>, permissions: Vec<String>, ) -> ServiceAuthResult<String>
Create a new API key for a service account
Sourcepub fn revoke_api_key(&self, key_id: &str) -> ServiceAuthResult<()>
pub fn revoke_api_key(&self, key_id: &str) -> ServiceAuthResult<()>
Revoke an API key
Sourcepub fn list_api_keys(&self, service_account: &str) -> Vec<ApiKey>
pub fn list_api_keys(&self, service_account: &str) -> Vec<ApiKey>
List API keys for a service account (without secrets)
Sourcepub fn authenticate_api_key(
&self,
key_string: &str,
client_ip: &str,
) -> ServiceAuthResult<ServiceSession>
pub fn authenticate_api_key( &self, key_string: &str, client_ip: &str, ) -> ServiceAuthResult<ServiceSession>
Authenticate using an API key
Sourcepub fn authenticate_certificate(
&self,
cert_subject: &str,
client_ip: &str,
) -> ServiceAuthResult<ServiceSession>
pub fn authenticate_certificate( &self, cert_subject: &str, client_ip: &str, ) -> ServiceAuthResult<ServiceSession>
Authenticate using mTLS certificate
Sourcepub fn validate_session(&self, session_id: &str) -> Option<ServiceSession>
pub fn validate_session(&self, session_id: &str) -> Option<ServiceSession>
Validate a session
Sourcepub fn invalidate_session(&self, session_id: &str)
pub fn invalidate_session(&self, session_id: &str)
Invalidate a session
Sourcepub fn cleanup_expired_sessions(&self)
pub fn cleanup_expired_sessions(&self)
Cleanup expired sessions
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ServiceAuthManager
impl !RefUnwindSafe for ServiceAuthManager
impl Send for ServiceAuthManager
impl Sync for ServiceAuthManager
impl Unpin for ServiceAuthManager
impl UnwindSafe for ServiceAuthManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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