Class: Rack::CSRF
- Inherits:
-
Object
- Object
- Rack::CSRF
- Defined in:
- lib/rack/csrf.rb,
lib/rack/csrf/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ CSRF
constructor
A new instance of CSRF.
Constructor Details
#initialize(app, opts = {}) ⇒ CSRF
Returns a new instance of CSRF.
9 10 11 12 13 |
# File 'lib/rack/csrf.rb', line 9 def initialize(app, opts = {}) @app = app @exclude = opts[:exclude] set_trusted_origins(opts) end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 |
# File 'lib/rack/csrf.rb', line 15 def call(env) return @app.call(env) if safe_request?(env) [ 403, {}, ["Forbidden\n"]] end |