aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-11-23 16:33:56 +0100
committerMichael Koziarski <michael@koziarski.com>2008-11-23 16:33:56 +0100
commitf9b1aa7f4c8555c92365327cd9a0c1aa5ebf1070 (patch)
tree502de77d89d8b6579d96d147f4a902df4636bb80 /activesupport
parentd460c9a25560f43e7c3789abadf7b455053eb686 (diff)
downloadrails-f9b1aa7f4c8555c92365327cd9a0c1aa5ebf1070.tar.gz
rails-f9b1aa7f4c8555c92365327cd9a0c1aa5ebf1070.tar.bz2
rails-f9b1aa7f4c8555c92365327cd9a0c1aa5ebf1070.zip
Don't need _message as it's in the class name already
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/message_verifier.rb8
-rw-r--r--activesupport/test/message_verifier_test.rb8
2 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb
index f3f905c15e..304058253c 100644
--- a/activesupport/lib/active_support/message_verifier.rb
+++ b/activesupport/lib/active_support/message_verifier.rb
@@ -6,11 +6,11 @@ module ActiveSupport
# session store isn't suitable or available.
#
# Remember Me:
- # cookies[:remember_me] = @verifier.generate_message([@user.id, 2.weeks.from_now])
+ # cookies[:remember_me] = @verifier.generate([@user.id, 2.weeks.from_now])
#
# In the authentication filter:
#
- # id, time = @verifier.verify_message(cookies[:remember_me])
+ # id, time = @verifier.verify(cookies[:remember_me])
# if time < Time.now
# self.current_user = User.find(id)
# end
@@ -23,7 +23,7 @@ module ActiveSupport
@digest = digest
end
- def verify_message(signed_message)
+ def verify(signed_message)
data, digest = signed_message.split("--")
if digest != generate_digest(data)
raise InvalidSignature
@@ -32,7 +32,7 @@ module ActiveSupport
end
end
- def generate_message(value)
+ def generate(value)
data = ActiveSupport::Base64.encode64s(Marshal.dump(value))
"#{data}--#{generate_digest(data)}"
end
diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb
index c7ea4cb962..2190308856 100644
--- a/activesupport/test/message_verifier_test.rb
+++ b/activesupport/test/message_verifier_test.rb
@@ -7,19 +7,19 @@ class MessageVerifierTest < Test::Unit::TestCase
end
def test_simple_round_tripping
- message = @verifier.generate_message(@data)
- assert_equal @data, @verifier.verify_message(message)
+ message = @verifier.generate(@data)
+ assert_equal @data, @verifier.verify(message)
end
def test_tampered_data_raises
- data, hash = @verifier.generate_message(@data).split("--")
+ data, hash = @verifier.generate(@data).split("--")
assert_not_verified("#{data.reverse}--#{hash}")
assert_not_verified("#{data}--#{hash.reverse}")
end
def assert_not_verified(message)
assert_raises(ActiveSupport::MessageVerifier::InvalidSignature) do
- @verifier.verify_message(message)
+ @verifier.verify(message)
end
end
end