Class: Rack::Protection::RemoteToken
- Inherits:
-
AuthenticityToken
- Object
- Base
- AuthenticityToken
- Rack::Protection::RemoteToken
- Defined in:
- lib/rack/protection/remote_token.rb
Overview
- Prevented attack
-
CSRF
- Supported browsers
-
all
- More infos
Only accepts unsafe HTTP requests if a given access token matches the token included in the session or the request comes from the same origin.
Compatible with rack-csrf.
Constant Summary
Constants inherited from AuthenticityToken
AuthenticityToken::TOKEN_LENGTH
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from AuthenticityToken
#mask_authenticity_token, random_token, token
Methods inherited from Base
#call, #default_options, default_options, default_reaction, #deny, #drop_session, #encrypt, #html?, #initialize, #instrument, #origin, #random_string, #react, #referrer, #report, #safe?, #secure_compare, #session, #session?, #warn
Constructor Details
This class inherits a constructor from Rack::Protection::Base
Instance Method Details
#accepts?(env) ⇒ Boolean
19 20 21 |
# File 'lib/rack/protection/remote_token.rb', line 19 def accepts?(env) super or referrer(env) == Request.new(env).host end |