pub struct AuthService(/* private fields */);Expand description
Shared authentication service.
Coordinates between the identity catalog, authentication providers, and token/challenge stores. All transports and embedded mode call through this single service.
Cheap to clone — uses Arc internally.
Implementations§
Source§impl AuthService
impl AuthService
Sourcepub fn authenticate(
&self,
method: &str,
credentials: HashMap<String, String>,
) -> Result<AuthResponse, Error>
pub fn authenticate( &self, method: &str, credentials: HashMap<String, String>, ) -> Result<AuthResponse, Error>
Authenticate an identity with the given method and credentials.
For single-step methods (password, token), returns Authenticated or Failed.
For challenge-response methods, may return Challenge first, then Authenticated
on the second call with the challenge response.
For Solana authentication, if the identity does not exist and the credentials contain
a public_key, the identity and authentication method are auto-provisioned before
proceeding with the challenge-response flow.
Source§impl AuthService
impl AuthService
Sourcepub fn validate_token(&self, token: &str) -> Option<Token>
pub fn validate_token(&self, token: &str) -> Option<Token>
Validate a bearer token and return the associated token definition.
Checks in order:
- Persisted session tokens (from login)
- Catalog tokens (from
CREATE AUTHENTICATION ... { method: token })
Sourcepub fn revoke_token(&self, token: &str) -> bool
pub fn revoke_token(&self, token: &str) -> bool
Revoke a specific session token.
Sourcepub fn revoke_all(&self, identity: IdentityId)
pub fn revoke_all(&self, identity: IdentityId)
Revoke all session tokens for a given identity.
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Clean up expired sessions and challenges.
Source§impl AuthService
impl AuthService
pub fn new( engine: Arc<dyn AuthEngine>, auth_registry: Arc<AuthenticationRegistry>, rng: SystemRng, clock: Clock, config: AuthServiceConfig, ) -> Self
Trait Implementations§
Source§impl Clone for AuthService
impl Clone for AuthService
Source§fn clone(&self) -> AuthService
fn clone(&self) -> AuthService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AuthService
impl !RefUnwindSafe for AuthService
impl Send for AuthService
impl Sync for AuthService
impl Unpin for AuthService
impl UnsafeUnpin for AuthService
impl !UnwindSafe for AuthService
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
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>
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>
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