module ActionDispatch::Cookies::VerifyAndUpgradeLegacySignedMessage
Passing the ActiveSupport::MessageEncryptor::NullSerializer downstream to the Message{Encryptor,Verifier} allows us to handle the (de)serialization step within the cookie jar, which gives us the opportunity to detect and migrate legacy cookies.
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/action_dispatch/middleware/cookies.rb, line 185 def initialize(*args) super @legacy_verifier = ActiveSupport::MessageVerifier.new(@options[:secret_token], serializer: ActiveSupport::MessageEncryptor::NullSerializer) end
Public Instance Methods
verify_and_upgrade_legacy_signed_message(name, signed_message)
click to toggle source
# File lib/action_dispatch/middleware/cookies.rb, line 190 def verify_and_upgrade_legacy_signed_message(name, signed_message) deserialize(name, @legacy_verifier.verify(signed_message)).tap do |value| self[name] = { value: value } end rescue ActiveSupport::MessageVerifier::InvalidSignature nil end