Class: ActionDispatch::Session::EncryptedCookieStore
- Inherits:
-
CookieStore
- Object
- CookieStore
- ActionDispatch::Session::EncryptedCookieStore
- Defined in:
- lib/encrypted_cookie_store.rb
Constant Summary collapse
- EXPIRE_AFTER_KEY =
"encrypted_cookie_store.session_expire_after"- OpenSSLCipherError =
OpenSSL::Cipher.const_defined?(:CipherError) ? OpenSSL::Cipher::CipherError : OpenSSL::CipherError
Class Attribute Summary collapse
-
.data_cipher_type ⇒ Object
Returns the value of attribute data_cipher_type.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ EncryptedCookieStore
constructor
A new instance of EncryptedCookieStore.
Constructor Details
#initialize(app, options = {}) ⇒ EncryptedCookieStore
Returns a new instance of EncryptedCookieStore.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/encrypted_cookie_store.rb', line 20 def initialize(app, = {}) @digest = .delete(:digest) || 'SHA1' @compress = [:compress] @compress = true if @compress.nil? @secret = .delete(:secret) @secret = @secret.call if @secret.respond_to?(:call) @secret.freeze @encryption_key = unhex(@secret).freeze ensure_encryption_key_secure @data_cipher = OpenSSL::Cipher::Cipher.new(EncryptedCookieStore.data_cipher_type) [:refresh_interval] ||= 5.minutes super(app, ) end |
Class Attribute Details
.data_cipher_type ⇒ Object
Returns the value of attribute data_cipher_type.
12 13 14 |
# File 'lib/encrypted_cookie_store.rb', line 12 def data_cipher_type @data_cipher_type end |
Instance Method Details
#call(env) ⇒ Object
38 39 40 41 |
# File 'lib/encrypted_cookie_store.rb', line 38 def call(env) @expire_after = env[EXPIRE_AFTER_KEY] super end |