Class: Rots::IdentityPageApp

Inherits:
Object
  • Object
show all
Defined in:
lib/rots/identity_page_app.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, server_options) ⇒ IdentityPageApp

Returns a new instance of IdentityPageApp.



8
9
10
11
# File 'lib/rots/identity_page_app.rb', line 8

def initialize(config, server_options)
  @server_options = server_options
  @config = config
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rots/identity_page_app.rb', line 13

def call(env)
  @request = Rack::Request.new(env)
  Rack::Response.new do |response|
    response.write <<-HERE
<html>
<head>
<link rel="openid2.provider" href="#{op_endpoint}" />
<link rel="openid.server" href="#{op_endpoint}" />
</head>
<body>
  <h1>This is #{@config['identity']} identity page</h1>
</body>
</html>
    HERE
  end.finish
end

#op_endpointObject



30
31
32
33
34
# File 'lib/rots/identity_page_app.rb', line 30

def op_endpoint
  "http://%s:%d/server/%s" % [@request.host, 
                         @request.port, 
                         (@request.params['openid.success'] ? '?openid.success=true' : '')]
end