1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Reverts #123 due to it causing problems with OAuth 2 providers. This functionality can be provided via session storage, query saving is unnecessary.

This commit is contained in:
Michael Bleigh 2011-01-05 09:40:00 -06:00
parent 48e37f038d
commit dc36ba8a35
4 changed files with 4 additions and 39 deletions

View file

@ -63,11 +63,7 @@ module OmniAuth
end end
def query_string def query_string
request.query_string.empty? ? "" : "?#{filter_callback_params(request.query_string)}" request.query_string.empty? ? "" : "?#{request.query_string}"
end
def filter_callback_params(query_string)
query_string
end end
def call_app! def call_app!

View file

@ -48,10 +48,6 @@ module OmniAuth
'extra' => {'user_hash' => user_data} 'extra' => {'user_hash' => user_data}
}) })
end end
def filter_callback_params(query_string)
"&#{query_string}".gsub(/(&code=[^&]*)/, '')[1..-1].to_s
end
end end
end end
end end

View file

@ -37,7 +37,7 @@ module OmniAuth
def callback_phase def callback_phase
request_token = ::OAuth::RequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret')) request_token = ::OAuth::RequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret'))
opts = {:oauth_verifier => request.params['oauth_verifier']} opts = {}
opts[:oauth_callback] = callback_url if session['oauth']['callback_confirmed'] opts[:oauth_callback] = callback_url if session['oauth']['callback_confirmed']
@access_token = request_token.get_access_token(opts) @access_token = request_token.get_access_token(opts)
super super

View file

@ -2,31 +2,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe OmniAuth::Strategies::Facebook do describe OmniAuth::Strategies::Facebook do
it_should_behave_like "an oauth2 strategy" it_should_behave_like "an oauth2 strategy"
context "filter_params" do
let(:app){ lambda{|env| [200, {}, ['Awesome']]}}
let(:strategy) { OmniAuth::Strategies::Facebook.new(app) }
subject { strategy.filter_callback_params(query_params) }
context "no query parameters" do
let(:query_params) { "" }
it { should == "" }
end
context "query params other than 'code'" do
let(:query_params) { "id=123&foo=bar" }
it { should == "id=123&foo=bar" }
end
context "only param is 'code'" do
let(:query_params) { "code=123abc" }
it { should == "" }
end
context "multiple params including 'code'" do
let(:query_params) { "id=1&code=123abc&foo=bar" }
it { should == "id=1&foo=bar" }
end
end
end end