Skip to content

Commit

Permalink
Doing some improvements on the op_endpoint generation in the identity…
Browse files Browse the repository at this point in the history
… page app
  • Loading branch information
roman committed Mar 23, 2009
1 parent 2cd19d1 commit 426d0dd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/rots/identity_page_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ def initialize(config, server_options)
end

def call(env)
request = Rack::Request.new(env)
flag = request.params['openid.success'] == 'true' ? '?openid.success=true' : ''
@request = Rack::Request.new(env)
Rack::Response.new do |response|
response.write <<-HERE
<html>
<head>
<link rel="openid2.provider" href="http://localhost:#{@server_options[:port]}/server/#{flag}" />
<link rel="openid.server" href="http://localhost:#{@server_options[:port]}/server/#{flag}" />
<link rel="openid2.provider" href="#{op_endpoint}" />
<link rel="openid.server" href="#{op_endpoint}" />
</head>
<body>
<h1>This is #{@config['identity']} identity page</h1>
Expand All @@ -28,4 +27,10 @@ def call(env)
end.finish
end

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

end

0 comments on commit 426d0dd

Please sign in to comment.