pub struct SessionConfig {
pub store_session_in_database: Option<bool>,
pub preserve_session_in_database: Option<bool>,
pub expires_in: Option<Duration>,
pub update_age: Option<Duration>,
pub disable_session_refresh: Option<bool>,
pub defer_session_refresh: bool,
pub fresh_age: Option<Duration>,
pub cookie_cache: Option<CookieCacheConfig>,
pub bearer: Option<BearerConfig>,
pub additional_fields: Option<IndexMap<String, SessionFieldConfig>>,
}Expand description
Session-specific configuration
Fields§
§store_session_in_database: Option<bool>Persist sessions in the database as well as secondary storage.
preserve_session_in_database: Option<bool>Keep ended database sessions for audit and disable database fallback on cache misses.
expires_in: Option<Duration>Session expiration duration. Omission uses seven days.
update_age: Option<Duration>How often to refresh the session expiry (as a Duration).
Refresh when the remaining lifetime falls below expires_in - update_age.
Omission uses one day. Zero refreshes on every authoritative read.
disable_session_refresh: Option<bool>If true, sessions are never automatically refreshed on access.
defer_session_refresh: boolReport needsRefresh on GET /get-session and refresh on POST /get-session.
Upstream rejects the POST form with 405 unless this is enabled.
fresh_age: Option<Duration>Session freshness window. A session younger than this is considered “fresh” (useful for step-up auth or sensitive operations).
Optional cookie-based session cache to avoid DB lookups.
When enabled, session data is cached in a signed/encrypted cookie.
SessionManager checks the cookie cache before hitting the database.
bearer: Option<BearerConfig>Enable the upstream Bearer plugin behavior for session tokens. API keys use their own plugin configuration.
additional_fields: Option<IndexMap<String, SessionFieldConfig>>Application session fields accepted by /update-session and included in session responses.
None preserves omission; an explicitly empty map remains configured.
Implementations§
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn expires_in(&self) -> Duration
pub fn expires_in(&self) -> Duration
Read the effective session lifetime. Omission and zero use seven days.
Sourcepub fn update_age(&self) -> Duration
pub fn update_age(&self) -> Duration
Read the effective refresh interval. Omission uses one day; zero refreshes on every read.
Sourcepub fn disable_session_refresh(&self) -> bool
pub fn disable_session_refresh(&self) -> bool
Read the effective refresh policy. Omission permits refresh.
Sourcepub fn store_session_in_database(&self) -> bool
pub fn store_session_in_database(&self) -> bool
Read the database persistence policy used with secondary storage.
Sourcepub fn preserve_session_in_database(&self) -> bool
pub fn preserve_session_in_database(&self) -> bool
Read the ended-session retention policy. Omission permits deletion.
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn fields(&self) -> &IndexMap<String, SessionFieldConfig>
pub fn fields(&self) -> &IndexMap<String, SessionFieldConfig>
Runtime fields. An omitted map has no fields.
Sourcepub fn fields_mut(&mut self) -> &mut IndexMap<String, SessionFieldConfig>
pub fn fields_mut(&mut self) -> &mut IndexMap<String, SessionFieldConfig>
Configure fields, creating an explicitly present map when omitted.
pub fn field_schema(&self) -> UserConfig
Sourcepub fn default_fields(&self) -> AuthResult<FieldMap>
pub fn default_fields(&self) -> AuthResult<FieldMap>
Evaluate creation defaults without validating or transforming session input.