Session::Base
Inherits JSON::Serializable < Reference < Object
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
Constructors
new(pull : JSON::PullParser)
Sourcenew
Sourcenew(*, __pull_for_json_serializable pull : JSON::PullParser)
SourceInstance methods
==(other : Base)
Sourceauthenticated?
Sourceclient_fingerprint
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
Sourceexpired?
Sourceexpires_at
Required in a stored or signed payload (see after_initialize): the default is for new only.
expires_at=(expires_at : Time)
Required in a stored or signed payload (see after_initialize): the default is for new only.
flash
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.
session_id
Sourcevalid?
Source