Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding some changes to the test_server and server_app

  • Loading branch information...
commit 5ed8b6fd7e57807e2adde0bfaee24504baf1d210 1 parent c7fc4e9
@roman authored
View
4 Rakefile
@@ -25,8 +25,8 @@ def git_tree_version
# @tree_version << ".0" unless @tree_version.count('.') == 2
#else
$: << "lib"
- require 'ruby_openid_test_server'
- @tree_version = RubyOpenIdTestServer.release
+ require 'rots'
+ @tree_version = Rots.release
#end
@tree_version
end
View
6 bin/rots
@@ -5,7 +5,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "rubygems"
require "optparse"
require "rack"
-require "ruby_openid_test_server"
+require "rots"
server_options = {
:debugger => false,
@@ -79,10 +79,10 @@ server = Rack::Builder.new do
use Rack::ShowExceptions
end
map ("/%s" % config['identity']) do
- run RubyOpenIdTestServer::MockIdentityPage.new(config, server_options)
+ run Rots::IdentityPageApp.new(config, server_options)
end
map "/server" do
- run RubyOpenIdTestServer::ServerApp.new(config, server_options)
+ run Rots::ServerApp.new(config, server_options)
end
end
View
12 lib/rots/server_app.rb
@@ -48,7 +48,7 @@ def on_openid_request(env)
def create_wrappers(env)
@request = Rack::Request.new(env)
- @server = OpenID::Server::Server.new(storage, @request.host)
+ @server = OpenID::Server::Server.new(storage, op_endpoint)
@openid_request = @server.decode_request(@request.params)
@openid_sreg_request = OpenID::SReg::Request.from_openid_request(@openid_request) unless @openid_request.nil?
end
@@ -131,6 +131,16 @@ def storage
def success(text="")
Rack::Response.new(text).finish
end
+
+ def op_endpoint
+ if @request.url =~ /(.*\?openid.success=true)/
+ $1
+ elsif @request.url =~ /([^?]*)/
+ $1
+ else
+ nil
+ end
+ end
end
View
20 lib/rots/test_helper.rb
@@ -1,31 +1,11 @@
require "openid/consumer"
require "openid/consumer/checkid_request.rb"
require "net/http"
-#require "rots/server_app"
module Rots::TestHelper
- def self.included(base)
- #base.class_eval do
- # cattr_accessor :rots_config
- # cattr_accessor :rots_server_options
- #end
- #[:verify_discovery_results, :check_signature].each do |method_name|
- # OpenID::Consumer::IdResHandler.class_eval { define_method(method_name) { } }
- #end
- end
-
def openid_request(openid_request_uri)
openid_response = Net::HTTP.get_response(URI.parse(openid_request_uri))
-
- #handler = RubyOpenIdTestServer::ServerApp.new(self.rots_config, self.rots_server_options)
- #openid_request = Rack::MockRequest.new(handler)
-
- #openid_response = openid_request.get(openid_request_uri)
- #openid_response_uri = URI(openid_response.headers['Location'])
- #openid_response_qs = Rack::Utils.parse_query(openid_response_uri.query)
-
- openid_response = Net::HTTP.get_response(URI.parse(openid_request_uri))
openid_response_uri = URI(openid_response['Location'])
openid_response_qs = Rack::Utils.parse_query(openid_response_uri.query)
Please sign in to comment.
Something went wrong with that request. Please try again.