mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Deprecate cookie_verifier_secret in favor of config.cookie_secret allowing signed cookies to work again.
This commit is contained in:
parent
c10958fbdd
commit
62151dd272
4 changed files with 16 additions and 5 deletions
|
@ -66,6 +66,18 @@ module ActionController
|
||||||
Rails.application.config.action_dispatch.ip_spoofing_check
|
Rails.application.config.action_dispatch.ip_spoofing_check
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cookie_verifier_secret=(value)
|
||||||
|
ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret= is deprecated. " <<
|
||||||
|
"Please configure it on your application with config.cookie_secret=", caller
|
||||||
|
ActionController::Base.config.secret = value
|
||||||
|
end
|
||||||
|
|
||||||
|
def cookie_verifier_secret
|
||||||
|
ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret is deprecated. " <<
|
||||||
|
"Please use ActionController::Base.config.secret instead.", caller
|
||||||
|
ActionController::Base.config.secret
|
||||||
|
end
|
||||||
|
|
||||||
def trusted_proxies=(value)
|
def trusted_proxies=(value)
|
||||||
ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies= is deprecated. " <<
|
ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies= is deprecated. " <<
|
||||||
"Please configure it on your application with config.action_dispatch.trusted_proxies=", caller
|
"Please configure it on your application with config.action_dispatch.trusted_proxies=", caller
|
||||||
|
|
|
@ -6,7 +6,6 @@ module ActionController #:nodoc:
|
||||||
|
|
||||||
included do
|
included do
|
||||||
helper_method :cookies
|
helper_method :cookies
|
||||||
cattr_accessor :cookie_verifier_secret
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -168,12 +168,12 @@ module ActionDispatch
|
||||||
|
|
||||||
class SignedCookieJar < CookieJar #:nodoc:
|
class SignedCookieJar < CookieJar #:nodoc:
|
||||||
def initialize(parent_jar)
|
def initialize(parent_jar)
|
||||||
unless ActionController::Base.cookie_verifier_secret
|
unless ActionController::Base.config.secret
|
||||||
raise "You must set ActionController::Base.cookie_verifier_secret to use signed cookies"
|
raise "You must set ActionController::Base.config.secret"
|
||||||
end
|
end
|
||||||
|
|
||||||
@parent_jar = parent_jar
|
@parent_jar = parent_jar
|
||||||
@verifier = ActiveSupport::MessageVerifier.new(ActionController::Base.cookie_verifier_secret)
|
@verifier = ActiveSupport::MessageVerifier.new(ActionController::Base.config.secret)
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](name)
|
def [](name)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'abstract_unit'
|
require 'abstract_unit'
|
||||||
|
|
||||||
ActionController::Base.cookie_verifier_secret = "thisISverySECRET123"
|
ActionController::Base.config.secret = "thisISverySECRET123"
|
||||||
|
|
||||||
class CookieTest < ActionController::TestCase
|
class CookieTest < ActionController::TestCase
|
||||||
class TestController < ActionController::Base
|
class TestController < ActionController::Base
|
||||||
|
|
Loading…
Reference in a new issue