Sha256: 5fdee74adebbd424d9ea1de9e4a7f91a0e1ce644bc6f06e0ff9970e6603794d1
Contents?: true
Size: 737 Bytes
Versions: 155
Compression:
Stored size: 737 Bytes
Contents
require 'rack/protection' module Rack module Protection ## # Prevented attack:: CSRF # Supported browsers:: all # More infos:: http://en.wikipedia.org/wiki/Cross-site_request_forgery # # Only accepts submitted forms if a given access token matches the token # included in the session. Does not expect such a token from Ajax request. # # This middleware is not used when using the Rack::Protection collection, # since it might be a security issue, depending on your application # # Compatible with Rails and rack-csrf. class FormToken < AuthenticityToken def accepts?(env) env["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" or super end end end end
Version data entries
155 entries across 150 versions & 25 rubygems