Class: Facemock::OAuth::Login

Inherits:
RackMiddleware show all
Defined in:
lib/facemock/oauth/login.rb

Constant Summary collapse

VIEW_DIRECTORY =
File.expand_path("../../../../view", __FILE__)
VIEW_FILE_NAME =
"login.html"
DEFAULT_PATH =
"/facemock/sign_in"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RackMiddleware

#initialize

Constructor Details

This class inherits a constructor from Facemock::OAuth::RackMiddleware

Class Attribute Details

.pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/facemock/oauth/login.rb', line 7

def path
  @path
end

Class Method Details

.viewObject



30
31
32
# File 'lib/facemock/oauth/login.rb', line 30

def self.view
  File.read(filepath)
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/facemock/oauth/login.rb', line 15

def call(env)
  if env["PATH_INFO"] == Login.path
    code   = 200
    body   = [ Login.view ]
    header = { "Content-Type"           => "text/html;charset=utf-8",
               "Content-Length"         => content_length(body).to_s,
               "X-XSS-Protection"       => "1; mode=block",
               "X-Content-Type-Options" => "nosniff",
               "X-Frame-Options"        => "SAMEORIGIN" }
    [code, header, body]
  else
    super
  end
end