Class: Facemock::OAuth::LoginHook
- Inherits:
-
RackMiddleware
- Object
- RackMiddleware
- Facemock::OAuth::LoginHook
- Defined in:
- lib/facemock/oauth/login_hook.rb
Constant Summary collapse
- DEFAULT_PATH =
"/sign_in"
Class Attribute Summary collapse
-
.paths ⇒ Object
Returns the value of attribute paths.
Instance Method Summary collapse
Methods inherited from RackMiddleware
Constructor Details
This class inherits a constructor from Facemock::OAuth::RackMiddleware
Class Attribute Details
.paths ⇒ Object
Returns the value of attribute paths.
5 6 7 |
# File 'lib/facemock/oauth/login_hook.rb', line 5 def paths @paths end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/facemock/oauth/login_hook.rb', line 11 def call(env) res = super if LoginHook.paths.include?(env["PATH_INFO"]) code = 302 body = [] header = { "Content-Type" => "text/html;charset=utf-8", "Location" => location(env, "/facemock/sign_in"), "Content-Length" => content_length(body).to_s, "X-XSS-Protection" => "1; mode=block", "X-Content-Type-Options" => "nosniff", "X-Frame-Options" => "SAMEORIGIN" } res = [ code, header, body ] end res end |