gitlab-org--gitlab-foss/lib/gitlab/request_forgery_protection.rb

24 lines
458 B
Ruby
Raw Normal View History

2017-06-21 02:52:54 -04:00
# A module to check CSRF tokens in requests.
# It's used in API helpers and OmniAuth.
# Usage: GitLab::RequestForgeryProtection.call(env)
2017-06-21 02:52:54 -04:00
module GitLab
2015-12-08 08:41:19 -05:00
module RequestForgeryProtection
class Controller < ActionController::Base
protect_from_forgery with: :exception
2015-12-08 08:41:19 -05:00
def index
head :ok
end
end
2015-12-08 08:41:19 -05:00
def self.app
@app ||= Controller.action(:index)
end
2015-12-08 08:41:19 -05:00
def self.call(env)
app.call(env)
end
end
end