Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing oauth2 code and specs after last pull

  • Loading branch information...
commit 3129095aebe6bd3cdaa9e7917fec83202b79aa43 1 parent c240908
@NoamB authored
View
2  Gemfile
@@ -3,7 +3,7 @@ source "http://rubygems.org"
# Example:
# gem "activesupport", ">= 2.3.5"
gem 'oauth', "~> 0.4.4"
-gem 'oauth2', "~> 0.5.0"
+gem 'oauth2', "~> 0.5.1"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
View
10 Gemfile.lock
@@ -43,7 +43,7 @@ GEM
faraday (0.7.4)
addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
- rack (>= 1.1.0, < 2)
+ rack (< 2, >= 1.1.0)
git (1.2.5)
hike (1.2.1)
i18n (0.6.0)
@@ -68,9 +68,9 @@ GEM
multi_json (1.0.3)
multipart-post (1.1.3)
oauth (0.4.5)
- oauth2 (0.5.0)
- faraday (>= 0.6.1, < 0.8)
- multi_json (~> 1.0.0)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
polyglot (0.3.2)
rack (1.3.3)
rack-cache (1.0.3)
@@ -150,7 +150,7 @@ DEPENDENCIES
json (>= 1.5.1)
mongoid (~> 2.0)
oauth (~> 0.4.4)
- oauth2 (~> 0.5.0)
+ oauth2 (~> 0.5.1)
rails (>= 3.0.0)
rspec (~> 2.5.0)
rspec-rails (~> 2.5.0)
View
2  Rakefile
@@ -27,7 +27,7 @@ Jeweler::Tasks.new do |gem|
# gem.add_development_dependency 'rspec', '> 1.2.3'
gem.add_runtime_dependency 'bcrypt-ruby', '~> 3.0.0'
gem.add_runtime_dependency 'oauth', '~> 0.4.4'
- gem.add_runtime_dependency 'oauth2', '~> 0.4.1'
+ gem.add_runtime_dependency 'oauth2', '~> 0.5.1'
end
Jeweler::RubygemsDotOrgTasks.new
View
4 lib/sorcery/controller/submodules/external/protocols/oauth2.rb
@@ -15,12 +15,12 @@ def authorize_url(options = {})
:ssl => { :ca_file => Config.ca_file }
}
client = ::OAuth2::Client.new(@key, @secret, defaults.merge!(options))
- client.web_server.authorize_url(:redirect_uri => @callback_url, :scope => @scope)
+ client.authorize_url(:redirect_uri => @callback_url, :scope => @scope)
end
def get_access_token(args)
client = ::OAuth2::Client.new(@key, @secret, :site => @site, :ssl => { :ca_file => Config.ca_file })
- client.web_server.get_access_token(args[:code], :redirect_uri => @callback_url)
+ client.get_token(args[:code], :redirect_uri => @callback_url)
end
end
end
View
2  spec/Gemfile
@@ -4,7 +4,7 @@ gem "rails", '3.0.3'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem "sorcery", '>= 0.1.0', :path => '../'
gem 'oauth', "~> 0.4.4"
-gem 'oauth2', "~> 0.4.1"
+gem 'oauth2', "~> 0.5.1"
group :development do
gem "rspec", "~> 2.5.0"
gem 'ruby-debug19'
View
16 spec/Gemfile.lock
@@ -4,9 +4,7 @@ PATH
sorcery (0.6.1)
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
- oauth (~> 0.4.4)
- oauth2 (~> 0.4.1)
- oauth2 (~> 0.4.1)
+ oauth2 (~> 0.5.0)
GEM
remote: http://rubygems.org/
@@ -47,8 +45,8 @@ GEM
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
- faraday (0.6.1)
- addressable (~> 2.2.4)
+ faraday (0.7.4)
+ addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
i18n (0.6.0)
@@ -63,9 +61,9 @@ GEM
multi_json (1.0.3)
multipart-post (1.1.3)
oauth (0.4.5)
- oauth2 (0.4.1)
- faraday (~> 0.6.1)
- multi_json (>= 0.0.5)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
polyglot (0.3.2)
rack (1.2.3)
rack-mount (0.6.14)
@@ -119,7 +117,7 @@ PLATFORMS
DEPENDENCIES
bcrypt-ruby
oauth (~> 0.4.4)
- oauth2 (~> 0.4.1)
+ oauth2 (~> 0.5.1)
rails (= 3.0.3)
rspec (~> 2.5.0)
ruby-debug19
View
14 spec/rails3/Gemfile.lock
@@ -4,9 +4,7 @@ PATH
sorcery (0.6.1)
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
- oauth (~> 0.4.4)
- oauth2 (~> 0.4.1)
- oauth2 (~> 0.4.1)
+ oauth2 (~> 0.5.0)
GEM
remote: http://rubygems.org/
@@ -56,8 +54,8 @@ GEM
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
- faraday (0.6.1)
- addressable (~> 2.2.4)
+ faraday (0.7.4)
+ addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
ffi (1.0.9)
@@ -77,9 +75,9 @@ GEM
multipart-post (1.1.3)
nokogiri (1.4.4)
oauth (0.4.5)
- oauth2 (0.4.1)
- faraday (~> 0.6.1)
- multi_json (>= 0.0.5)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
View
10 spec/rails3/spec/controller_oauth2_spec.rb
@@ -5,9 +5,7 @@ def stub_all_oauth2_requests!
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
OAuth2::Client.stub!(:new).and_return(@client)
@acc_token = OAuth2::AccessToken.new(@client, "asd", {})
- @webby = @client.web_server
- OAuth2::Strategy::WebServer.stub!(:new).and_return(@webby)
- @webby.stub!(:get_access_token).and_return(@acc_token)
+ @client.stub!(:get_token).and_return(@acc_token)
@acc_token.stub!(:get).and_return({"id"=>"123", "name"=>"Noam Ben Ari", "first_name"=>"Noam", "last_name"=>"Ben Ari", "link"=>"http://www.facebook.com/nbenari1", "hometown"=>{"id"=>"110619208966868", "name"=>"Haifa, Israel"}, "location"=>{"id"=>"106906559341067", "name"=>"Pardes Hanah, Hefa, Israel"}, "bio"=>"I'm a new daddy, and enjoying it!", "gender"=>"male", "email"=>"nbenari@gmail.com", "timezone"=>2, "locale"=>"en_US", "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}], "verified"=>true, "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
end
@@ -43,8 +41,7 @@ def stub_all_oauth2_requests!
create_new_user
get :login_at_test2
response.should be_a_redirect
- #response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
- response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&response_type=code")
+ response.should redirect_to("http://myapi.com/oauth/authorize?redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access")
end
it "'login_from' logins if user exists" do
@@ -66,8 +63,7 @@ def stub_all_oauth2_requests!
create_new_user
get :login_at_test3
response.should be_a_redirect
- #response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
- response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=&response_type=code")
+ response.should redirect_to("http://myapi.com/oauth/authorize?redirect_uri=http%3A%2F%2Fblabla.com&scope=")
end
it "'login_from' logins if user exists (github)" do
View
14 spec/rails3_mongoid/Gemfile.lock
@@ -4,9 +4,7 @@ PATH
sorcery (0.6.1)
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
- oauth (~> 0.4.4)
- oauth2 (~> 0.4.1)
- oauth2 (~> 0.4.1)
+ oauth2 (~> 0.5.0)
GEM
remote: http://rubygems.org/
@@ -49,8 +47,8 @@ GEM
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
- faraday (0.6.1)
- addressable (~> 2.2.4)
+ faraday (0.7.4)
+ addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
i18n (0.5.0)
@@ -72,9 +70,9 @@ GEM
multi_json (1.0.3)
multipart-post (1.1.3)
oauth (0.4.5)
- oauth2 (0.4.1)
- faraday (~> 0.6.1)
- multi_json (>= 0.0.5)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
View
14 spec/sinatra/Gemfile.lock
@@ -4,9 +4,7 @@ PATH
sorcery (0.6.1)
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
- oauth (~> 0.4.4)
- oauth2 (~> 0.4.1)
- oauth2 (~> 0.4.1)
+ oauth2 (~> 0.5.0)
GEM
remote: http://rubygems.org/
@@ -44,8 +42,8 @@ GEM
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
- faraday (0.6.1)
- addressable (~> 2.2.4)
+ faraday (0.7.4)
+ addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
i18n (0.5.0)
@@ -60,9 +58,9 @@ GEM
multi_json (1.0.3)
multipart-post (1.1.3)
oauth (0.4.5)
- oauth2 (0.4.1)
- faraday (~> 0.6.1)
- multi_json (>= 0.0.5)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.14)
View
9 spec/sinatra/spec/controller_oauth2_spec.rb
@@ -4,10 +4,8 @@
def stub_all_oauth2_requests!
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
OAuth2::Client.stub!(:new).and_return(@client)
- @acc_token = OAuth2::AccessToken.new(@client, "", "asd", nil, {})
- @webby = @client.web_server
- OAuth2::Strategy::WebServer.stub!(:new).and_return(@webby)
- @webby.stub!(:get_access_token).and_return(@acc_token)
+ @acc_token = OAuth2::AccessToken.new(@client, "asd", {})
+ @client.stub!(:get_token).and_return(@acc_token)
@acc_token.stub!(:get).and_return({"id"=>"123", "name"=>"Noam Ben Ari", "first_name"=>"Noam", "last_name"=>"Ben Ari", "link"=>"http://www.facebook.com/nbenari1", "hometown"=>{"id"=>"110619208966868", "name"=>"Haifa, Israel"}, "location"=>{"id"=>"106906559341067", "name"=>"Pardes Hanah, Hefa, Israel"}, "bio"=>"I'm a new daddy, and enjoying it!", "gender"=>"male", "email"=>"nbenari@gmail.com", "timezone"=>2, "locale"=>"en_US", "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}], "verified"=>true, "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
end
@@ -40,8 +38,7 @@ def stub_all_oauth2_requests!
create_new_user
get "/login_at_test2"
last_response.should be_a_redirect
- #last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
- last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&response_type=code")
+ last_response.should redirect_to("http://myapi.com/oauth/authorize?redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access")
end
it "'login_from' logins if user exists" do
View
14 spec/sinatra_modular/Gemfile.lock
@@ -4,9 +4,7 @@ PATH
sorcery (0.6.1)
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
- oauth (~> 0.4.4)
- oauth2 (~> 0.4.1)
- oauth2 (~> 0.4.1)
+ oauth2 (~> 0.5.0)
GEM
remote: http://rubygems.org/
@@ -44,8 +42,8 @@ GEM
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
- faraday (0.6.1)
- addressable (~> 2.2.4)
+ faraday (0.7.4)
+ addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
i18n (0.5.0)
@@ -60,9 +58,9 @@ GEM
multi_json (1.0.3)
multipart-post (1.1.3)
oauth (0.4.5)
- oauth2 (0.4.1)
- faraday (~> 0.6.1)
- multi_json (>= 0.0.5)
+ oauth2 (0.5.1)
+ faraday (~> 0.7.4)
+ multi_json (~> 1.0.3)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.14)
View
9 spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb
@@ -4,10 +4,8 @@
def stub_all_oauth2_requests!
@client = OAuth2::Client.new("key","secret", :site => "http://myapi.com")
OAuth2::Client.stub!(:new).and_return(@client)
- @acc_token = OAuth2::AccessToken.new(@client, "", "asd", nil, {})
- @webby = @client.web_server
- OAuth2::Strategy::WebServer.stub!(:new).and_return(@webby)
- @webby.stub!(:get_access_token).and_return(@acc_token)
+ @acc_token = OAuth2::AccessToken.new(@client, "asd", {})
+ @client.stub!(:get_token).and_return(@acc_token)
@acc_token.stub!(:get).and_return({"id"=>"123", "name"=>"Noam Ben Ari", "first_name"=>"Noam", "last_name"=>"Ben Ari", "link"=>"http://www.facebook.com/nbenari1", "hometown"=>{"id"=>"110619208966868", "name"=>"Haifa, Israel"}, "location"=>{"id"=>"106906559341067", "name"=>"Pardes Hanah, Hefa, Israel"}, "bio"=>"I'm a new daddy, and enjoying it!", "gender"=>"male", "email"=>"nbenari@gmail.com", "timezone"=>2, "locale"=>"en_US", "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}], "verified"=>true, "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
end
@@ -40,8 +38,7 @@ def stub_all_oauth2_requests!
create_new_user
get "/login_at_test2"
last_response.should be_a_redirect
- #last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&type=web_server")
- last_response.should redirect_to("http://myapi.com/oauth/authorize?client_id=key&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&response_type=code")
+ last_response.should redirect_to("http://myapi.com/oauth/authorize?redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access")
end
it "'login_from' logins if user exists" do
Please sign in to comment.
Something went wrong with that request. Please try again.