class

Alumna::Session

Inherits Reference < Object

Binds a SessionStore to cookie flags. Keep one instance for the rule and for start/stop/rotate so the cookie name and flags stay in sync.

sessions = Alumna::Session.new(Alumna::MemorySessionStore.new(ttl: 24.hours)) app.before sessions.rule sessions.start(ctx, Alumna.hash(user_id: id))

Constants

DEFAULT_COOKIE = "alumna.sid"
DEFAULT_SKIP = ["internal", "local"]
DEFAULT_STORE_KEY = "session"

Constructors

Class methods

rotate(ctx : RuleContext, store : SessionStore, data : Hash(String, AnyData), ttl : Time::Span | Nil = nil) : String
Source
start(ctx : RuleContext, store : SessionStore, data : Hash(String, AnyData), ttl : Time::Span | Nil = nil) : String

Class helpers use the default cookie name and flags. Prefer an instance when you set cookie, secure, or same_site on the rule.

Source
stop(ctx : RuleContext, store : SessionStore) : Nil
Source

Instance methods

rotate(ctx : RuleContext, data : Hash(String, AnyData), ttl : Time::Span | Nil = nil) : String
Source
rule
Source
start(ctx : RuleContext, data : Hash(String, AnyData), ttl : Time::Span | Nil = nil) : String
Source
stop(ctx : RuleContext) : Nil
Source
store
Source
store_key
Source