diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-06 17:59:10 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-08 20:27:05 +0200 |
commit | c9efdb582a81d84d5f4ee1f2e3123f59d68b00fe (patch) | |
tree | 71172fcdc682a3e44d9b0300f97f400ab8be62d2 | |
parent | c17649e062c95c841afe8efbc1962cc0e2df886e (diff) | |
download | rails-c9efdb582a81d84d5f4ee1f2e3123f59d68b00fe.tar.gz rails-c9efdb582a81d84d5f4ee1f2e3123f59d68b00fe.tar.bz2 rails-c9efdb582a81d84d5f4ee1f2e3123f59d68b00fe.zip |
Call super to remove the decrypt_and_verify method
The `EncryptedCookieJar` already calls it for us, so just delegate to its `parse` implementation.
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 0f3de18aa0..12c19d0098 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -551,7 +551,9 @@ module ActionDispatch private def parse(name, encrypted_message) - deserialize name, decrypt_and_verify(encrypted_message) + deserialize name, @encryptor.decrypt_and_verify(encrypted_message) + rescue ActiveSupport::MessageVerifier::InvalidSignature, ActiveSupport::MessageEncryptor::InvalidMessage + nil end def commit(options) @@ -559,12 +561,6 @@ module ActionDispatch raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE end - - def decrypt_and_verify(encrypted_message) - @encryptor.decrypt_and_verify(encrypted_message) - rescue ActiveSupport::MessageVerifier::InvalidSignature, ActiveSupport::MessageEncryptor::InvalidMessage - nil - end end # UpgradeLegacyEncryptedCookieJar is used by ActionDispatch::Session::CookieStore @@ -576,7 +572,7 @@ module ActionDispatch private def parse(name, encrypted_or_signed_message) - deserialize(name, decrypt_and_verify(encrypted_or_signed_message)) || verify_and_upgrade_legacy_signed_message(name, encrypted_or_signed_message) + super || verify_and_upgrade_legacy_signed_message(name, encrypted_or_signed_message) end end |