Class: ActionDispatch::Cookies::UpgradeLegacyEncryptedCookieJar

Inherits:
EncryptedCookieJar show all
Includes:
VerifyAndUpgradeLegacySignedMessage
Defined in:
lib/action_dispatch/middleware/cookies.rb

Overview

UpgradeLegacyEncryptedCookieJar is used by ActionDispatch::Session::CookieStore instead of EncryptedCookieJar if secrets.secret_token and secrets.secret_key_base are both set. It reads legacy cookies signed with the old dummy key generator and encrypts and re-saves them using the new key generator to provide a smooth upgrade path.

Constant Summary

Constants included from SerializedCookieJars

SerializedCookieJars::MARSHAL_SIGNATURE

Instance Method Summary collapse

Methods included from VerifyAndUpgradeLegacySignedMessage

#initialize, #verify_and_upgrade_legacy_signed_message

Methods inherited from EncryptedCookieJar

#[]=, #initialize

Methods included from ChainedCookieJars

#encrypted, #permanent, #signed, #signed_or_encrypted

Instance Method Details

#[](name) ⇒ Object



550
551
552
553
554
# File 'lib/action_dispatch/middleware/cookies.rb', line 550

def [](name)
  if encrypted_or_signed_message = @parent_jar[name]
    deserialize(name, decrypt_and_verify(encrypted_or_signed_message)) || verify_and_upgrade_legacy_signed_message(name, encrypted_or_signed_message)
  end
end