Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore<S: AuthSchema>: Send + Sync {
Show 31 methods // Required methods fn create_session<'life0, 'async_trait>( &'life0 self, create_session: CreateSession, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_user_sessions<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_session_expiry<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_user_sessions<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_expired_sessions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn update_session_active_organization<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, organization_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; // Provided methods fn prepare_secondary_session_creation<'life0, 'async_trait>( &'life0 self, _input: CreateSession, _persist: bool, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn complete_secondary_session_creation<'life0, 'life1, 'async_trait>( &'life0 self, _session: &'life1 S::Session, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn prepare_secondary_session_update<'life0, 'async_trait>( &'life0 self, _session: S::Session, _expires_at: Option<DateTime<Utc>>, _fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<(S::Session, FieldValues)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn complete_secondary_session_update<'life0, 'async_trait>( &'life0 self, _session: S::Session, _expires_at: Option<DateTime<Utc>>, _fields: FieldValues, _persist: bool, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn end_session_preserving<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn end_user_sessions_preserving<'life0, 'life1, 'async_trait>( &'life0 self, _user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_session_user<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::User>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_session_user_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::User>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn create_session_record<'life0, 'async_trait>( &'life0 self, create_session: CreateSession, ) -> Pin<Box<dyn Future<Output = AuthResult<AdapterRecord<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn get_session_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::Session>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_sessions_by_tokens_record<'life0, 'life1, 'async_trait>( &'life0 self, tokens: &'life1 [String], ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<AdapterRecord<S::Session>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_user_sessions_record<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<AdapterRecord<S::Session>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_active_user_sessions_record<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<AdapterRecord<S::Session>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn refresh_session_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::Session>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn update_session_fields_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::Session>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn update_session_active_organization_record<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, organization_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<AdapterRecord<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn update_session_active_team_record<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, team_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<AdapterRecord<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn update_session_fields<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, _fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_session_by_id<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_sessions_by_tokens<'life0, 'life1, 'async_trait>( &'life0 self, tokens: &'life1 [String], ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn refresh_session_with_fields<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn refresh_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn update_session_active_team<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _token: &'life1 str, _team_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... }
}

Required Methods§

Source

fn create_session<'life0, 'async_trait>( &'life0 self, create_session: CreateSession, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_user_sessions<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn update_session_expiry<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete_user_sessions<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete_expired_sessions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn update_session_active_organization<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, organization_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provided Methods§

Source

fn prepare_secondary_session_creation<'life0, 'async_trait>( &'life0 self, _input: CreateSession, _persist: bool, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stage a secondary session through creation hooks and optional physical persistence. The caller publishes the cache before completing its after hooks.

Source

fn complete_secondary_session_creation<'life0, 'life1, 'async_trait>( &'life0 self, _session: &'life1 S::Session, ) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Complete creation hooks after the actual secondary writes succeed.

Source

fn prepare_secondary_session_update<'life0, 'async_trait>( &'life0 self, _session: S::Session, _expires_at: Option<DateTime<Utc>>, _fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<(S::Session, FieldValues)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Bind a trusted secondary update once, retaining hook-mutated fields for physical publication.

Source

fn complete_secondary_session_update<'life0, 'async_trait>( &'life0 self, _session: S::Session, _expires_at: Option<DateTime<Utc>>, _fields: FieldValues, _persist: bool, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish the staged physical update and run after hooks exactly once.

Source

fn end_session_preserving<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

End a still-live physical session without deleting its audit row. Returns false when no live row matched or a delete hook vetoed the end.

Source

fn end_user_sessions_preserving<'life0, 'life1, 'async_trait>( &'life0 self, _user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

End all live session rows for one owner while retaining audit history. Returns false when a delete hook vetoed the bulk mutation.

Source

fn get_session_user<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::User>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A typed user snapshot belonging to an authenticated session. The default signals that the caller must use its physical user store.

Source

fn get_session_user_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::User>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retain declared adapter output for a secondary-backed session owner.

Source

fn create_session_record<'life0, 'async_trait>( &'life0 self, create_session: CreateSession, ) -> Pin<Box<dyn Future<Output = AuthResult<AdapterRecord<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn get_session_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn get_sessions_by_tokens_record<'life0, 'life1, 'async_trait>( &'life0 self, tokens: &'life1 [String], ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<AdapterRecord<S::Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn get_user_sessions_record<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<AdapterRecord<S::Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn get_active_user_sessions_record<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<AdapterRecord<S::Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return active physical sessions after declared output transforms. Expiry selection runs before application callbacks, without trusting output fields.

Source

fn refresh_session_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn update_session_fields_record<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<AdapterRecord<S::Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn update_session_active_organization_record<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, organization_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<AdapterRecord<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn update_session_active_team_record<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 str, team_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<AdapterRecord<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Return a retained adapter record. The default is the physical model’s serialized snapshot; initialized stores apply their declared output policy.

Source

fn update_session_fields<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, _fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist already authorized fields for the currently authenticated token.

Source

fn get_session_by_id<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 str, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the physical session row by its ID for signed-token liveness.

Source

fn get_sessions_by_tokens<'life0, 'life1, 'async_trait>( &'life0 self, tokens: &'life1 [String], ) -> Pin<Box<dyn Future<Output = AuthResult<Vec<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch matching sessions once each, including expired rows. The bundled SQLite adapter returns token-index order rather than request order.

Source

fn refresh_session_with_fields<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, fields: FieldValues, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Refresh expiry and configured fields in one physical update. Adapters supporting additional values must override this operation so their actual before hooks precede binding and their after hooks see the final row. The fallback preserves plain refresh and fails closed on additional writes.

Source

fn refresh_session<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = AuthResult<Option<S::Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Refresh the persisted expiry and return the updated snapshot. A session removed before the update returns None, never its old credentials.

Source

fn update_session_active_team<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _token: &'life1 str, _team_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = AuthResult<S::Session>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§