@@ -57,17 +57,6 @@ class InvalidCrossOriginRequest < ActionControllerError # :nodoc:
57
57
module RequestForgeryProtection
58
58
extend ActiveSupport ::Concern
59
59
60
- class DisabledSessionError < StandardError
61
- MESSAGE = <<~EOS . squish
62
- Request forgery protection requires a working session store but your application has sessions disabled.
63
- You need to either disable request forgery protection, or configure a working session store.
64
- EOS
65
-
66
- def initialize ( message = MESSAGE )
67
- super
68
- end
69
- end
70
-
71
60
include AbstractController ::Helpers
72
61
include AbstractController ::Callbacks
73
62
@@ -101,11 +90,6 @@ def initialize(message = MESSAGE)
101
90
config_accessor :default_protect_from_forgery
102
91
self . default_protect_from_forgery = false
103
92
104
- # Controls whether trying to use forgery protection without a working session store
105
- # issues a warning or raises an error.
106
- config_accessor :silence_disabled_session_errors
107
- self . silence_disabled_session_errors = true
108
-
109
93
# Controls whether URL-safe CSRF tokens are generated.
110
94
config_accessor :urlsafe_csrf_tokens , instance_writer : false
111
95
self . urlsafe_csrf_tokens = false
@@ -469,20 +453,7 @@ def form_authenticity_param # :doc:
469
453
470
454
# Checks if the controller allows forgery protection.
471
455
def protect_against_forgery? # :doc:
472
- allow_forgery_protection && ensure_session_is_enabled!
473
- end
474
-
475
- def ensure_session_is_enabled!
476
- if !session . respond_to? ( :enabled? ) || session . enabled?
477
- true
478
- else
479
- if silence_disabled_session_errors
480
- ActiveSupport ::Deprecation . warn ( DisabledSessionError ::MESSAGE )
481
- false
482
- else
483
- raise DisabledSessionError
484
- end
485
- end
456
+ allow_forgery_protection && ( !session . respond_to? ( :enabled? ) || session . enabled? )
486
457
end
487
458
488
459
NULL_ORIGIN_MESSAGE = <<~MSG
0 commit comments