diff options
author | Michael Koziarski <michael@koziarski.com> | 2012-10-01 15:34:12 +1300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2012-10-01 15:34:12 +1300 |
commit | 0479bff32dfb26a420b9ab4e2c2e6c2ed17550a3 (patch) | |
tree | 4f03089e37cccb8d61417b60cf76629ee0730ef8 /railties/lib | |
parent | def2ccb8e3534e06ec1bb9c33aeee35a52b40138 (diff) | |
download | rails-0479bff32dfb26a420b9ab4e2c2e6c2ed17550a3.tar.gz rails-0479bff32dfb26a420b9ab4e2c2e6c2ed17550a3.tar.bz2 rails-0479bff32dfb26a420b9ab4e2c2e6c2ed17550a3.zip |
Provide access to the application's KeyGenerator
Available both as an env entry for rack and an instance method on Rails::Application for other uses
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 050190cba6..b92b65214f 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -101,6 +101,14 @@ module Rails routes_reloader.reload! end + + # Return the application's KeyGenerator + def key_generator + # number of iterations selected based on consultation with the google security + # team. Details at https://github.com/rails/rails/pull/6952#issuecomment-7661220 + @key_generator ||= ActiveSupport::KeyGenerator.new(config.secret_token, :iterations=>1000) + end + # Stores some of the Rails initial environment parameters which # will be used by middlewares and engines to configure themselves. # Currently stores: @@ -121,7 +129,8 @@ module Rails "action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions, "action_dispatch.show_detailed_exceptions" => config.consider_all_requests_local, "action_dispatch.logger" => Rails.logger, - "action_dispatch.backtrace_cleaner" => Rails.backtrace_cleaner + "action_dispatch.backtrace_cleaner" => Rails.backtrace_cleaner, + "action_dispatch.key_generator" => key_generator }) end |