class
Session::Base
- Session::Base
- Reference
- Object
Overview
Base class for session data
Subclass this to define your session's data structure.
Override #authenticated? to reflect your authentication logic.
Example:
class UserSession < Session::Base
property? authenticated : Bool = false
property username : String? = nil
def authenticated? : Bool
@authenticated
end
end
Included Modules
- JSON::Serializable
Defined in:
base.crConstructors
Instance Method Summary
- #==(other : Base)
- #authenticated? : Bool
-
#client_fingerprint : ClientFingerprint | Nil
The client the session was first used from, when session binding is enabled.
-
#client_fingerprint=(client_fingerprint : ClientFingerprint | Nil)
The client the session was first used from, when session binding is enabled.
- #created_at : Time
- #expired?
-
#expires_at : Time
Required in a stored or signed payload (see
after_initialize): the default is for.newonly. -
#expires_at=(expires_at : Time)
Required in a stored or signed payload (see
after_initialize): the default is for.newonly. -
#flash : Flash
Messages for the next request.
- #session_id : String
-
#time_until_expiry : Time::Span
Get time remaining until session expires
-
#touch : Nil
Extend the session expiration time (for sliding expiration)
- #valid?
Constructor Detail
Instance Method Detail
The client the session was first used from, when session binding is enabled.
The client the session was first used from, when session binding is enabled.
Required in a stored or signed payload (see after_initialize): the default is for .new only.
Required in a stored or signed payload (see after_initialize): the default is for .new only.
Messages for the next request. They belong to the session, so they are saved with it and reach only the visitor they were meant for.