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:
parent
48e37f038d
commit
dc36ba8a35
|
@ -63,11 +63,7 @@ module OmniAuth
|
|||
end
|
||||
|
||||
def query_string
|
||||
request.query_string.empty? ? "" : "?#{filter_callback_params(request.query_string)}"
|
||||
end
|
||||
|
||||
def filter_callback_params(query_string)
|
||||
query_string
|
||||
request.query_string.empty? ? "" : "?#{request.query_string}"
|
||||
end
|
||||
|
||||
def call_app!
|
||||
|
|
|
@ -48,10 +48,6 @@ module OmniAuth
|
|||
'extra' => {'user_hash' => user_data}
|
||||
})
|
||||
end
|
||||
|
||||
def filter_callback_params(query_string)
|
||||
"&#{query_string}".gsub(/(&code=[^&]*)/, '')[1..-1].to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -37,7 +37,7 @@ module OmniAuth
|
|||
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'))
|
||||
|
||||
opts = {:oauth_verifier => request.params['oauth_verifier']}
|
||||
opts = {}
|
||||
opts[:oauth_callback] = callback_url if session['oauth']['callback_confirmed']
|
||||
@access_token = request_token.get_access_token(opts)
|
||||
super
|
||||
|
|
|
@ -2,31 +2,4 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|||
|
||||
describe OmniAuth::Strategies::Facebook do
|
||||
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
|
Loading…
Reference in New Issue