pub struct TestAuthProvider { /* private fields */ }Expand description
Test authentication provider for generating test tokens and sessions
Implementations§
Source§impl TestAuthProvider
impl TestAuthProvider
Sourcepub fn with_jwt_secret(secret: impl Into<String>) -> Self
pub fn with_jwt_secret(secret: impl Into<String>) -> Self
Create with custom JWT secret
Sourcepub fn generate_jwt_token(&self, user: &User) -> TestResult<String>
pub fn generate_jwt_token(&self, user: &User) -> TestResult<String>
Generate a test JWT token for a user
Sourcepub fn generate_jwt_with_claims(
&self,
claims: TestJwtClaims,
) -> TestResult<String>
pub fn generate_jwt_with_claims( &self, claims: TestJwtClaims, ) -> TestResult<String>
Generate a test JWT token with custom claims
Sourcepub fn generate_admin_token(&self, user: &User) -> TestResult<String>
pub fn generate_admin_token(&self, user: &User) -> TestResult<String>
Generate an admin JWT token
Sourcepub fn create_session(&mut self, user: &User) -> TestResult<String>
pub fn create_session(&mut self, user: &User) -> TestResult<String>
Create a test session
Sourcepub fn create_admin_session(&mut self, user: &User) -> TestResult<String>
pub fn create_admin_session(&mut self, user: &User) -> TestResult<String>
Create an admin session
Sourcepub fn get_session(&self, session_id: &str) -> Option<&TestSession>
pub fn get_session(&self, session_id: &str) -> Option<&TestSession>
Get session by ID
Sourcepub fn validate_jwt_token(&self, token: &str) -> TestResult<TestJwtClaims>
pub fn validate_jwt_token(&self, token: &str) -> TestResult<TestJwtClaims>
Validate JWT token (mock implementation)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestAuthProvider
impl RefUnwindSafe for TestAuthProvider
impl Send for TestAuthProvider
impl Sync for TestAuthProvider
impl Unpin for TestAuthProvider
impl UnwindSafe for TestAuthProvider
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