Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Default :return_to is Request#url.

Reordering of finish vs check to prevent recursive oid checks.
Additional $DEBUG output
  • Loading branch information...
commit 0a895a25938c668a57b0221d3984b2de999c90a7 1 parent 227ebe8
@scytrin scytrin authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/rack/auth/openid.rb
View
14 lib/rack/auth/openid.rb
@@ -211,10 +211,10 @@ def call(env)
request = Rack::Request.new env
consumer = ::OpenID::Consumer.new session, @options[:store]
- if request.params[@options[:openid_param]]
- check consumer, session, request
- elsif request.params['openid.mode']
+ if request.params['openid.mode']
finish consumer, session, request
+ elsif request.params[@options[:openid_param]]
+ check consumer, session, request
else
env['rack.errors'].puts "No valid params provided."
bad_request
@@ -258,6 +258,7 @@ def check(consumer, session, req)
# SETUP_NEEDED check!
# see OpenID::Consumer::CheckIDRequest docs
query_args = [@realm, *@options.values_at(:return_to, :immediate)]
+ query_args[1] ||= req.url
query_args[2] = false if session.key? :setup_needed
pp query_args if $DEBUG
@@ -268,10 +269,17 @@ def check(consumer, session, req)
if oid.send_redirect?(*query_args)
redirect = oid.redirect_url(*query_args)
+ if $DEBUG
+ pp redirect
+ pp Rack::Utils.parse_query(URI(redirect).query)
+ end
[ 303, {'Location'=>redirect}, [] ]
else
# check on 'action' option.
formbody = oid.form_markup(*query_args)
+ if $DEBUG
+ pp formbody
+ end
body = HTML % ['Confirm...', formbody]
[ 200, {'Content-Type'=>'text/html'}, body.to_a ]
end
Please sign in to comment.
Something went wrong with that request. Please try again.