pub struct OptionalAuth { /* private fields */ }Expand description
Optional authentication guard - authentication failure is allowed
Implementations§
Source§impl OptionalAuth
impl OptionalAuth
Sourcepub fn with_config(config: AuthGuardConfig) -> Self
pub fn with_config(config: AuthGuardConfig) -> Self
Create with custom configuration
Sourcepub fn skip_paths<I, S>(self, paths: I) -> Self
pub fn skip_paths<I, S>(self, paths: I) -> Self
Add multiple paths to skip authentication
Trait Implementations§
Source§impl AuthGuard for OptionalAuth
impl AuthGuard for OptionalAuth
Source§fn should_skip_path(&self, path: &str) -> bool
fn should_skip_path(&self, path: &str) -> bool
Check if the path should skip authentication
Source§fn is_optional(&self) -> bool
fn is_optional(&self) -> bool
Check if authentication is optional
Source§fn validate_user(&self, _user: &UserContext) -> AuthResult<()>
fn validate_user(&self, _user: &UserContext) -> AuthResult<()>
Validate user context against guard requirements
Source§fn config(&self) -> &AuthGuardConfig
fn config(&self) -> &AuthGuardConfig
Get guard configuration
Source§fn validate_user_with_rbac(&self, user: &UserContext) -> AuthResult<()>
fn validate_user_with_rbac(&self, user: &UserContext) -> AuthResult<()>
Validate user context with RBAC resource-action permissions
Source§fn validate_resource_actions(&self, user: &UserContext) -> AuthResult<()>
fn validate_resource_actions(&self, user: &UserContext) -> AuthResult<()>
Validate resource-action permissions
Source§impl Clone for OptionalAuth
impl Clone for OptionalAuth
Source§fn clone(&self) -> OptionalAuth
fn clone(&self) -> OptionalAuth
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 OptionalAuth
impl Debug for OptionalAuth
Auto Trait Implementations§
impl Freeze for OptionalAuth
impl RefUnwindSafe for OptionalAuth
impl Send for OptionalAuth
impl Sync for OptionalAuth
impl Unpin for OptionalAuth
impl UnsafeUnpin for OptionalAuth
impl UnwindSafe for OptionalAuth
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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