diff options
author | Lisa Ugray <lisa.ugray@shopify.com> | 2017-07-10 15:44:12 -0400 |
---|---|---|
committer | Lisa Ugray <lisa.ugray@shopify.com> | 2017-07-10 16:23:48 -0400 |
commit | 73b944eca721be750e1263c15d221f153d1396d0 (patch) | |
tree | 4f873f87925fbeb931bf580bf24d10e6e210d7fe /actionpack/lib/action_controller/metal | |
parent | ec4a836919c021c0a5cf9ebeebb4db5e02104a55 (diff) | |
download | rails-73b944eca721be750e1263c15d221f153d1396d0.tar.gz rails-73b944eca721be750e1263c15d221f153d1396d0.tar.bz2 rails-73b944eca721be750e1263c15d221f153d1396d0.zip |
Add ActionController::Base.skip_forgery_protection
Since we now default to `protect_from_forgery with: :exception`,
provide a wrapper to `skip_before_action :verify_authenticity_token`
for disabling forgery protection.
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/request_forgery_protection.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb index 117dee2219..027dae60fa 100644 --- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb +++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb @@ -132,6 +132,15 @@ module ActionController #:nodoc: append_after_action :verify_same_origin_request end + # Turn off request forgery protection. This is a wrapper for: + # + # skip_before_action :verify_authenticity_token + # + # See +skip_before_action+ for allowed options. + def skip_forgery_protection(options = {}) + skip_before_action :verify_authenticity_token, options + end + private def protection_method_class(name) |