diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-23 12:02:06 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-23 20:25:44 +0100 |
commit | d411c85a65baaf4ed268b1b1bb4df408cee4981a (patch) | |
tree | b054f3a4b95748b10e70c8d3a952e3b829366f2f /actionpack | |
parent | a5fb1c61755f03a8c75b0a434fb2aca57502293b (diff) | |
download | rails-d411c85a65baaf4ed268b1b1bb4df408cee4981a.tar.gz rails-d411c85a65baaf4ed268b1b1bb4df408cee4981a.tar.bz2 rails-d411c85a65baaf4ed268b1b1bb4df408cee4981a.zip |
Replace references to ActiveSupport::SecureRandom with just SecureRandom, and require 'securerandom' from the stdlib when active support is required.
Diffstat (limited to 'actionpack')
6 files changed, 8 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb index 13044a7450..4d95f07e68 100644 --- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb +++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb @@ -96,7 +96,7 @@ module ActionController #:nodoc: # Sets the token value for the current session. def form_authenticity_token - session[:_csrf_token] ||= ActiveSupport::SecureRandom.base64(32) + session[:_csrf_token] ||= SecureRandom.base64(32) end # The form's authenticity parameter. Override to provide your own. diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 89ff5ba174..2ca9bae073 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -130,7 +130,7 @@ module ActionController super self.session = TestSession.new - self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => ActiveSupport::SecureRandom.hex(16)) + self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => SecureRandom.hex(16)) end class Result < ::Array #:nodoc: diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 0057f64dd3..20e958c767 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -305,7 +305,7 @@ module ActionDispatch if secret.length < SECRET_MIN_LENGTH raise ArgumentError, "Secret should be something secure, " + - "like \"#{ActiveSupport::SecureRandom.hex(16)}\". The value you " + + "like \"#{SecureRandom.hex(16)}\". The value you " + "provided, \"#{secret}\", is shorter than the minimum length " + "of #{SECRET_MIN_LENGTH} characters" end diff --git a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb index 1a811ce1b1..8ad1ad1f2f 100644 --- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb @@ -29,7 +29,7 @@ module ActionDispatch end def generate_sid - sid = ActiveSupport::SecureRandom.hex(16) + sid = SecureRandom.hex(16) sid.encode!('UTF-8') if sid.respond_to?(:encode!) sid end diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index dea80ed887..d94db7f5fb 100644 --- a/actionpack/test/controller/request_forgery_protection_test.rb +++ b/actionpack/test/controller/request_forgery_protection_test.rb @@ -80,7 +80,7 @@ module RequestForgeryProtectionTests def setup @token = "cf50faa3fe97702ca1ae" - ActiveSupport::SecureRandom.stubs(:base64).returns(@token) + SecureRandom.stubs(:base64).returns(@token) ActionController::Base.request_forgery_protection_token = :custom_authenticity_token end @@ -184,7 +184,7 @@ class RequestForgeryProtectionControllerTest < ActionController::TestCase end test 'should emit a csrf-param meta tag and a csrf-token meta tag' do - ActiveSupport::SecureRandom.stubs(:base64).returns(@token + '<=?') + SecureRandom.stubs(:base64).returns(@token + '<=?') get :meta assert_select 'meta[name=?][content=?]', 'csrf-param', 'custom_authenticity_token' assert_select 'meta[name=?][content=?]', 'csrf-token', 'cf50faa3fe97702ca1ae<=?' @@ -207,7 +207,7 @@ class FreeCookieControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new @token = "cf50faa3fe97702ca1ae" - ActiveSupport::SecureRandom.stubs(:base64).returns(@token) + SecureRandom.stubs(:base64).returns(@token) end def test_should_not_render_form_with_token_tag diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index b0efbcef4a..301bf9c6d2 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -6,7 +6,7 @@ class CookieStoreTest < ActionDispatch::IntegrationTest SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33' Verifier = ActiveSupport::MessageVerifier.new(SessionSecret, 'SHA1') - SignedBar = Verifier.generate(:foo => "bar", :session_id => ActiveSupport::SecureRandom.hex(16)) + SignedBar = Verifier.generate(:foo => "bar", :session_id => SecureRandom.hex(16)) class TestController < ActionController::Base def no_session_access |