pub struct AuthProxy { /* private fields */ }Expand description
Authentication proxy facade
High-level facade that combines authentication, authorization, and session management into a single interface.
Implementations§
Source§impl AuthProxy
impl AuthProxy
Sourcepub fn new(
handler: AuthenticationHandler,
role_mapper: RoleMapper,
session_manager: SessionManager,
) -> Self
pub fn new( handler: AuthenticationHandler, role_mapper: RoleMapper, session_manager: SessionManager, ) -> Self
Create a new auth proxy
Sourcepub fn builder() -> AuthProxyBuilder
pub fn builder() -> AuthProxyBuilder
Create a builder
Sourcepub async fn authenticate(
&self,
request: &AuthRequest,
) -> Result<AuthResult, AuthError>
pub async fn authenticate( &self, request: &AuthRequest, ) -> Result<AuthResult, AuthError>
Authenticate a request
Sourcepub async fn authenticate_and_create_session(
&self,
request: &AuthRequest,
) -> Result<(AuthResult, Session), AuthError>
pub async fn authenticate_and_create_session( &self, request: &AuthRequest, ) -> Result<(AuthResult, Session), AuthError>
Authenticate and create session
Sourcepub fn validate_session(&self, token: &str) -> Result<Identity, AuthError>
pub fn validate_session(&self, token: &str) -> Result<Identity, AuthError>
Validate session token
Sourcepub fn get_credentials(
&self,
key: &str,
) -> Result<DatabaseCredential, AuthError>
pub fn get_credentials( &self, key: &str, ) -> Result<DatabaseCredential, AuthError>
Get database credentials for an identity
Sourcepub fn handler(&self) -> &AuthenticationHandler
pub fn handler(&self) -> &AuthenticationHandler
Get authentication handler
Sourcepub fn role_mapper(&self) -> &RoleMapper
pub fn role_mapper(&self) -> &RoleMapper
Get role mapper
Sourcepub fn session_manager(&self) -> &SessionManager
pub fn session_manager(&self) -> &SessionManager
Get session manager
Auto Trait Implementations§
impl Freeze for AuthProxy
impl !RefUnwindSafe for AuthProxy
impl Send for AuthProxy
impl Sync for AuthProxy
impl Unpin for AuthProxy
impl UnsafeUnpin for AuthProxy
impl !UnwindSafe for AuthProxy
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> 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