Class: ActionDispatch::Session::EncryptedCookieStore
- Inherits:
-
Rack::Session::Cookie
- Object
- Rack::Session::Cookie
- ActionDispatch::Session::EncryptedCookieStore
- Includes:
- Compatibility, StaleSessionCheck
- Defined in:
- lib/encrypted_cookie_store/encrypted_cookie_store.rb
Constant Summary collapse
- OpenSSLCipherError =
OpenSSL::Cipher.const_defined?(:CipherError) ? OpenSSL::Cipher::CipherError : OpenSSL::CipherError
- ENCRYPTION_KEY_SIZE =
32
Class Attribute Summary collapse
-
.data_cipher_type ⇒ Object
Returns the value of attribute data_cipher_type.
-
.iv_cipher_type ⇒ Object
Returns the value of attribute iv_cipher_type.
Instance Method Summary collapse
-
#destroy_session(env, session_id, options) ⇒ Object
Override rack’s method.
-
#initialize(app, options = {}) ⇒ EncryptedCookieStore
constructor
A new instance of EncryptedCookieStore.
Constructor Details
#initialize(app, options = {}) ⇒ EncryptedCookieStore
Returns a new instance of EncryptedCookieStore.
22 23 24 25 26 27 28 |
# File 'lib/encrypted_cookie_store/encrypted_cookie_store.rb', line 22 def initialize(app, = {}) ensure_encryption_key_secure([:encryption_key]) @encryption_key = unhex([:encryption_key]).freeze @iv_cipher = OpenSSL::Cipher::Cipher.new(EncryptedCookieStore.iv_cipher_type) @data_cipher = OpenSSL::Cipher::Cipher.new(EncryptedCookieStore.data_cipher_type) super(app, ) end |
Class Attribute Details
.data_cipher_type ⇒ Object
Returns the value of attribute data_cipher_type.
16 17 18 |
# File 'lib/encrypted_cookie_store/encrypted_cookie_store.rb', line 16 def data_cipher_type @data_cipher_type end |
.iv_cipher_type ⇒ Object
Returns the value of attribute iv_cipher_type.
15 16 17 |
# File 'lib/encrypted_cookie_store/encrypted_cookie_store.rb', line 15 def iv_cipher_type @iv_cipher_type end |
Instance Method Details
#destroy_session(env, session_id, options) ⇒ Object
Override rack’s method
31 32 33 34 35 36 |
# File 'lib/encrypted_cookie_store/encrypted_cookie_store.rb', line 31 def destroy_session(env, session_id, ) new_sid = super # Reset hash and Assign the new session id env["action_dispatch.request.unsigned_session_cookie"] = new_sid ? { "session_id" => new_sid } : {} new_sid end |