class
Amber::Router::Session::AdapterSessionStore
Overview
Session store implementation that uses the pluggable adapter system.
This replaces the hardcoded Redis/Cookie stores with a flexible adapter-based approach that allows users to implement custom session storage backends.
The session adapter handles the low-level storage operations while this class provides the higher-level session management logic including session ID generation, cookie handling, and expiration.
Defined in:
amber/router/session/adapter_session_store.crConstructors
Class Method Summary
Instance Method Summary
- #[](key : String | Symbol)
- #[]=(key : String | Symbol, value)
- #[]?(key : String | Symbol)
- #adapter : Amber::Adapters::SessionAdapter
- #changed? : Bool
- #cookies : Amber::Router::Cookies::Store
- #cookies=(cookies : Amber::Router::Cookies::Store)
- #current_session
- #delete(key : String | Symbol)
- #destroy
- #empty?
- #expires : Int32
- #expires=(expires : Int32)
- #expires_at
- #fetch(key : String | Symbol, default = nil)
- #has_key?(key : String | Symbol) : Bool
- #id
- #key : String
- #key=(key : String)
- #keys
-
#regenerate_id : String
Regenerates the session ID to prevent session fixation attacks.
- #session_id : String
- #session_id=(session_id : String)
- #set_session
- #to_h
-
#touch
Resets the session TTL for sliding expiration.
- #update(hash : Hash(String | Symbol, String))
- #values
Instance methods inherited from class Amber::Router::Session::AbstractStore
current_session
current_session,
destroy
destroy,
id
id,
set_session
set_session,
update(hash : Hash(String | Symbol, String))
update
Constructor Detail
Class Method Detail
Instance Method Detail
Regenerates the session ID to prevent session fixation attacks. Copies all existing session data to a new session, destroys the old session, and updates the cookie with the new session ID.
This should be called after successful authentication or any privilege escalation to ensure the user gets a fresh session ID.
Returns the new session ID.
Resets the session TTL for sliding expiration. Called on each request to extend the session lifetime when idle_timeout is configured.