lib/omniauth/strategies/open_id.rb in oa-openid-0.0.1 vs lib/omniauth/strategies/open_id.rb in oa-openid-0.0.2

- old
+ new

@@ -43,25 +43,40 @@ def identifier request[:identifier] end def request_phase - return fail!(:missing_information) unless identifier + identifier ? start : get_identifier + end + + def start openid = Rack::OpenID.new(dummy_app, @store) response = openid.call(env) case env['rack.openid.response'] when Rack::OpenID::MissingResponse, Rack::OpenID::TimeoutResponse fail :connection_failed else response end end + def get_identifier + response = app.call(env) + if response[0] < 400 + response + else + OmniAuth::Form.build('OpenID Authentication') do + text_field('OpenID Identifier', 'identifier') + end.to_response + end + end + def callback_phase + env['REQUEST_METHOD'] = 'GET' + openid = Rack::OpenID.new(lambda{|env| [200,{},[]]}, @store) openid.call(env) resp = env.delete('rack.openid.response') - case resp.status when :failure fail!(:invalid_credentials) when :success request['auth'] = auth_hash(resp) \ No newline at end of file