aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base/http_authentication.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-05-13 01:10:37 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-05-13 12:00:15 -0700
commite8550ee0329586b32de425e905c7af7e65bc78a8 (patch)
tree0cdfe0f9f0d3fb010280ff0453fc553ab6ff2d92 /actionpack/lib/action_controller/base/http_authentication.rb
parentfa5da8ad54d68ea0484825845eb6f6a8e8bca361 (diff)
downloadrails-e8550ee0329586b32de425e905c7af7e65bc78a8.tar.gz
rails-e8550ee0329586b32de425e905c7af7e65bc78a8.tar.bz2
rails-e8550ee0329586b32de425e905c7af7e65bc78a8.zip
Cherry-pick core extensions
Diffstat (limited to 'actionpack/lib/action_controller/base/http_authentication.rb')
-rw-r--r--actionpack/lib/action_controller/base/http_authentication.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/base/http_authentication.rb b/actionpack/lib/action_controller/base/http_authentication.rb
index b6b5267c66..fa8ecea408 100644
--- a/actionpack/lib/action_controller/base/http_authentication.rb
+++ b/actionpack/lib/action_controller/base/http_authentication.rb
@@ -1,3 +1,5 @@
+require 'active_support/base64'
+
module ActionController
module HttpAuthentication
# Makes it dead easy to do HTTP Basic authentication.
@@ -276,7 +278,7 @@ module ActionController
t = time.to_i
hashed = [t, secret_key]
digest = ::Digest::MD5.hexdigest(hashed.join(":"))
- Base64.encode64("#{t}:#{digest}").gsub("\n", '')
+ ActiveSupport::Base64.encode64("#{t}:#{digest}").gsub("\n", '')
end
# Might want a shorter timeout depending on whether the request
@@ -285,7 +287,7 @@ module ActionController
# allow a user to use new nonce without prompting user again for their
# username and password.
def validate_nonce(request, value, seconds_to_timeout=5*60)
- t = Base64.decode64(value).split(":").first.to_i
+ t = ActiveSupport::Base64.decode64(value).split(":").first.to_i
nonce(t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout
end