Class: ActionController::RequestForgeryProtection::ProtectionMethods::NullSession
- Inherits:
-
Object
- Object
- ActionController::RequestForgeryProtection::ProtectionMethods::NullSession
- Defined in:
- actionpack/lib/action_controller/metal/request_forgery_protection.rb
Defined Under Namespace
Classes: NullCookieJar, NullSessionHash
Instance Method Summary collapse
-
#handle_unverified_request ⇒ Object
This is the method that defines the application behavior when a request is found to be unverified.
-
#initialize(controller) ⇒ NullSession
constructor
A new instance of NullSession.
Constructor Details
#initialize(controller) ⇒ NullSession
Returns a new instance of NullSession.
105 106 107 |
# File 'actionpack/lib/action_controller/metal/request_forgery_protection.rb', line 105 def initialize(controller) @controller = controller end |
Instance Method Details
#handle_unverified_request ⇒ Object
This is the method that defines the application behavior when a request is found to be unverified.
110 111 112 113 114 115 116 |
# File 'actionpack/lib/action_controller/metal/request_forgery_protection.rb', line 110 def handle_unverified_request request = @controller.request request.session = NullSessionHash.new(request.env) request.env['action_dispatch.request.flash_hash'] = nil request.env['rack.session.options'] = { skip: true } request.env['action_dispatch.cookies'] = NullCookieJar.build(request) end |