aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-04-23 14:40:40 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-04-23 14:40:40 -0300
commitd949460f9bb1c1fc81777b886b00d1a8a9826765 (patch)
treeb82a124782105a5c8e650e5d5bf846806bad60d6 /actionpack
parent6f37d7e117d8a27d622002b1921218cdc60611fa (diff)
parentf92f5b706b01a83e881a28ddef8ddd741144c6d4 (diff)
downloadrails-d949460f9bb1c1fc81777b886b00d1a8a9826765.tar.gz
rails-d949460f9bb1c1fc81777b886b00d1a8a9826765.tar.bz2
rails-d949460f9bb1c1fc81777b886b00d1a8a9826765.zip
Merge pull request #19823 from sbhatore/doc_fix_1
[ci skip] Description inside Signed and Encrypted CookieJars added
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/middleware/cookies.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb
index b1f0f5fc28..12e61308a3 100644
--- a/actionpack/lib/action_dispatch/middleware/cookies.rb
+++ b/actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -454,12 +454,16 @@ module ActionDispatch
@verifier = ActiveSupport::MessageVerifier.new(secret, digest: digest, serializer: ActiveSupport::MessageEncryptor::NullSerializer)
end
+ # Returns the value of the cookie by +name+ if it is untampered,
+ # returns +nil+ otherwise or if no such cookie exists.
def [](name)
if signed_message = @parent_jar[name]
deserialize name, verify(signed_message)
end
end
+ # Signs and Sets the cookie named +name+. The second argument may be the cookie's
+ # value or a hash of options as documented above.
def []=(name, options)
if options.is_a?(Hash)
options.symbolize_keys!
@@ -511,12 +515,16 @@ module ActionDispatch
@encryptor = ActiveSupport::MessageEncryptor.new(secret, sign_secret, digest: digest, serializer: ActiveSupport::MessageEncryptor::NullSerializer)
end
+ # Returns the value of the cookie by +name+ if it is untampered,
+ # returns +nil+ otherwise or if no such cookie exists.
def [](name)
if encrypted_message = @parent_jar[name]
deserialize name, decrypt_and_verify(encrypted_message)
end
end
+ # Encrypts and Sets the cookie named +name+. The second argument may be the cookie's
+ # value or a hash of options as documented above.
def []=(name, options)
if options.is_a?(Hash)
options.symbolize_keys!