Class: ActionDispatch::Cookies::EncryptedCookieJar
- Inherits:
-
AbstractCookieJar
- Object
- AbstractCookieJar
- ActionDispatch::Cookies::EncryptedCookieJar
- Includes:
- SerializedCookieJars
- Defined in:
- actionpack/lib/action_dispatch/middleware/cookies.rb
Overview
:nodoc:
Direct Known Subclasses
UpgradeLegacyEncryptedCookieJar, UpgradeLegacyHmacAesCbcCookieJar
Constant Summary
Constants included from SerializedCookieJars
SerializedCookieJars::MARSHAL_SIGNATURE
Instance Method Summary collapse
-
#initialize(parent_jar) ⇒ EncryptedCookieJar
constructor
A new instance of EncryptedCookieJar.
Methods inherited from AbstractCookieJar
Methods included from ChainedCookieJars
#encrypted, #permanent, #signed, #signed_or_encrypted
Constructor Details
#initialize(parent_jar) ⇒ EncryptedCookieJar
Returns a new instance of EncryptedCookieJar.
601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
# File 'actionpack/lib/action_dispatch/middleware/cookies.rb', line 601 def initialize(parent_jar) super if ActiveSupport::LegacyKeyGenerator === key_generator raise "You didn't set secrets.secret_key_base, which is required for this cookie jar. " \ "Read the upgrade documentation to learn more about this new config option." end cipher = "aes-256-gcm" key_len = ActiveSupport::MessageEncryptor.key_len(cipher) secret = key_generator.generate_key(request. || "")[0, key_len] @encryptor = ActiveSupport::MessageEncryptor.new(secret, cipher: cipher, serializer: ActiveSupport::MessageEncryptor::NullSerializer) end |