Class | Merb::CookieSession |
In: |
lib/merb-core/dispatch/session/cookie.rb
|
Parent: | SessionContainer |
If you have more than 4K of session data or don‘t want your data to be visible to the user, pick another session store.
CookieOverflow is raised if you attempt to store more than 4K of data. TamperedWithCookie is raised if the data integrity check fails.
A message digest is included with the cookie to ensure data integrity: a user cannot alter session data without knowing the secret key included in the hash.
To use Cookie Sessions, set in config/merb.yml
:session_secret_key - your secret digest key :session_store - cookie
MAX | = | 4096 | Cookies can typically store 4096 bytes. | |
DIGEST | = | OpenSSL::Digest::Digest.new('SHA1') |
_original_session_data | [RW] | :api: private |
Generates a new session ID and creates a new session.
SessionContainer: | The new session. |
:api: private
Set up a new session on request: make it available on request instance.
request<Merb::Request>: | The Merb::Request that came in from Rack. |
SessionContainer: | a SessionContainer. If no sessions were found, |
a new SessionContainer will be generated.
:api: private
Teardown and/or persist the current session.
If @_destroy is true, clear out the session completely, including removal of the session cookie itself.
request<Merb::Request>: | request object created from Rack environment. |
:api: private
Create the raw cookie string; includes an HMAC keyed message digest.
String: | Cookie value. |
CookieOverflow: | More than 4K of data put into session. |
Session data is converted to a Hash first, since a container might choose to marshal it, which would make it persist attributes like ‘needs_new_cookie’, which it shouldn‘t.
:api: private