mars-server · auth::session_store
Public declarations and documentation for mars-server::auth::session_store.
Package: mars-server · Workspace version: 0.1.0 · Module: auth::session_store
This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.
auth::session_store::IssuedSession
Newly established session. The token is disclosed only in this result.
#[derive(Clone, PartialEq, Eq)]
pub struct IssuedSession {
pub token: String,
pub principal: Principal
}Source line: 32.
auth::session_store::SessionStore
Async session persistence boundary used by auth handlers and middleware.
#[async_trait]
pub trait SessionStore: Send + Sync {
/// Persist a principal under a new cryptographically random bearer token.
async fn issue(&self, principal: Principal) -> Result<IssuedSession, AuthError>;
/// Resolve an active, non-revoked session at server-controlled `now_ms`.
async fn lookup(&self, token: &str, now_ms: i64) -> Result<Option<Principal>, AuthError>;
/// Revoke a token immediately. Returns whether an active row was changed.
async fn revoke(&self, token: &str, revoked_at_ms: i64) -> Result<bool, AuthError>;
/// Delete expired and revoked records. Returns rows removed.
async fn cleanup(&self, now_ms: i64) -> Result<u64, AuthError>;
/// Whether records survive process restart and replica replacement.
fn is_durable(&self) -> bool;
}Source line: 49.
auth::session_store::InMemorySessionStore
Process-local session store for tests and explicitly opted-in development.
Tokens are hashed here too, keeping test/dev semantics aligned with the production persistence contract.
#[derive(Debug, Default)]
pub struct InMemorySessionStore {
}Source line: 77.
auth::session_store::InMemorySessionStore::new
pub fn new() -> Self;Source line: 82.
auth::session_store::PostgresSessionStore
Production PostgreSQL session store.
#[cfg(feature = "postgres")]
#[derive(Debug, Clone)]
pub struct PostgresSessionStore {
}Source line: 157.
auth::session_store::PostgresSessionStore::new
#[cfg(feature = "postgres")]
pub fn new(pool: PgPool) -> Self;Source line: 163.
Source provenance
Source: mars-server/src/auth/session_store.rs · SHA-256 39cd9fb562e6ed809c6c80fef102eefba3cc0ddaac69faf233ca534c2bf8043e. Package overview.