Athena::Framework::Bundle::Schema::Session#
Configures sessions, which store data about the client across requests, such as flash messages.
ATH.configure({
framework: {
session: {
enabled: true,
},
},
})
The session of the current request is available via AHTTP::Request#session, or by typing an action parameter as AHTTP::Session.
See AHK::Listeners::Session for more information on how it is persisted.
Configuration Properties
enabled#
Bool
false
If false, sessions are disabled and the related types are not included in the resulting binary.
handler_id#
String | ::Nil
nil
The ID of the service used to persist sessions, which must implement AHTTP::Session::Storage::Handler::Interface.
If nil, an AHTTP::Session::Storage::Handler::File storing sessions in the #save_path directory is used.
save_path#
String | ::Nil
nil
The directory the default AHTTP::Session::Storage::Handler::File stores sessions in, which is created if it does not exist.
If nil, a directory called athena_sessions within the system's tempdir is used.
It must be owned by the user running the application, without permissions for its group and others.
name#
String
athena_session_id
The name of the session cookie.
Prefixing it with __Host- keeps other subdomains from setting a cookie with the same name, which browsers only accept if it is secure, its #cookie_path is /, and it has no #cookie_domain.
cookie_lifetime#
Int32
0
The lifetime of the session cookie in seconds, 0 meaning until the browser is closed.
cookie_domain#
String | ::Nil
nil
The domain the session cookie is sent to.
If nil, only the host that set it.
cookie_secure#
Bool | ::Nil
nil
If the session cookie is only sent over HTTPS.
If nil, only if the request that set it was made over HTTPS, as determined by AHTTP::Request#secure?.
Behind a reverse proxy, this requires trusted proxies to be configured.
cookie_samesite#
::HTTP::Cookie::SameSite
lax
If the session cookie is sent along with cross-site requests.
gc_maxlifetime#
Int32
1440
How many seconds a session may go unused before it expires.
gc_probability#
Int32
1
Expired sessions are removed on #gc_probability / #gc_divisor of the requests starting a session.
metadata_update_threshold#
Int32
60
How many seconds to wait before updating when the session was last used. Otherwise each request using the session would write it, even if its data did not change.