Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update oauth2 #175

Merged
merged 1 commit into from
Dec 23, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source "http://rubygems.org"
# Example:
# gem "activesupport", ">= 2.3.5"
gem 'oauth', "~> 0.4.4"
gem 'oauth2', "~> 0.4.1"
gem 'oauth2', "~> 0.5.1"

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
Expand Down
24 changes: 12 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ GEM
archive-tar-minitar (0.5.2)
arel (2.2.1)
builder (3.0.0)
columnize (0.3.5)
columnize (0.3.6)
diff-lcs (1.1.3)
erubis (2.7.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
faraday (0.7.5)
addressable (~> 2.2.6)
multipart-post (~> 1.1.3)
rack (>= 1.1.0, < 2)
git (1.2.5)
hike (1.2.1)
Expand All @@ -47,20 +47,20 @@ GEM
bundler (~> 1.0.0)
git (>= 1.2.5)
rake
json (1.6.1)
json (1.6.3)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.3)
multi_json (1.0.4)
multipart-post (1.1.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.3)
rack (1.3.5)
rack-cache (1.1)
Expand All @@ -87,7 +87,7 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.11)
rdoc (3.12)
json (~> 1.4)
rspec (2.5.0)
rspec-core (~> 2.5.0)
Expand Down Expand Up @@ -120,7 +120,7 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.4)
sqlite3 (1.3.5)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
Expand All @@ -140,7 +140,7 @@ DEPENDENCIES
jeweler (~> 1.5.2)
json (>= 1.5.1)
oauth (~> 0.4.4)
oauth2 (~> 0.4.1)
oauth2 (~> 0.5.1)
rails (>= 3.0.0)
rspec (~> 2.5.0)
rspec-rails (~> 2.5.0)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def oauth_version

def authorize_url(options = {})
client = build_client(options)
client.web_server.authorize_url(
client.auth_code.authorize_url(
:redirect_uri => @callback_url,
:scope => @scope,
:display => @display
Expand All @@ -20,7 +20,7 @@ def authorize_url(options = {})

def get_access_token(args, options = {})
client = build_client(options)
client.web_server.get_access_token(
client.auth_code.get_access_token(
args[:code],
:redirect_uri => @callback_url
)
Expand Down
12 changes: 6 additions & 6 deletions sorcery.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ Gem::Specification.new do |s|

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
s.add_runtime_dependency(%q<oauth2>, ["~> 0.4.1"])
s.add_runtime_dependency(%q<oauth2>, ["~> 0.5.1"])
s.add_development_dependency(%q<rails>, [">= 3.0.0"])
s.add_development_dependency(%q<json>, [">= 1.5.1"])
s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
Expand All @@ -322,10 +322,10 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<timecop>, [">= 0"])
s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
s.add_runtime_dependency(%q<oauth2>, ["~> 0.4.1"])
s.add_runtime_dependency(%q<oauth2>, ["~> 0.5.1"])
else
s.add_dependency(%q<oauth>, ["~> 0.4.4"])
s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
s.add_dependency(%q<rails>, [">= 3.0.0"])
s.add_dependency(%q<json>, [">= 1.5.1"])
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
Expand All @@ -339,11 +339,11 @@ Gem::Specification.new do |s|
s.add_dependency(%q<timecop>, [">= 0"])
s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
s.add_dependency(%q<oauth>, ["~> 0.4.4"])
s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
end
else
s.add_dependency(%q<oauth>, ["~> 0.4.4"])
s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
s.add_dependency(%q<rails>, [">= 3.0.0"])
s.add_dependency(%q<json>, [">= 1.5.1"])
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
Expand All @@ -357,7 +357,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<timecop>, [">= 0"])
s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
s.add_dependency(%q<oauth>, ["~> 0.4.4"])
s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
end
end

2 changes: 1 addition & 1 deletion spec/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
18 changes: 9 additions & 9 deletions spec/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PATH
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
oauth (~> 0.4.4)
oauth2 (~> 0.4.1)
oauth2 (~> 0.4.1)
oauth2 (~> 0.5.1)
oauth2 (~> 0.5.1)

GEM
remote: http://rubygems.org/
Expand Down Expand Up @@ -47,9 +47,9 @@ GEM
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
faraday (0.7.5)
addressable (~> 2.2.6)
multipart-post (~> 1.1.3)
rack (>= 1.1.0, < 2)
i18n (0.6.0)
linecache19 (0.5.12)
Expand All @@ -63,9 +63,9 @@ GEM
multi_json (1.0.3)
multipart-post (1.1.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.3)
rack (1.2.4)
rack-mount (0.6.14)
Expand Down Expand Up @@ -120,7 +120,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
Expand Down
31 changes: 15 additions & 16 deletions spec/rails3/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PATH
bcrypt-ruby (~> 3.0.0)
oauth (~> 0.4.4)
oauth (~> 0.4.4)
oauth2 (~> 0.4.1)
oauth2 (~> 0.4.1)
oauth2 (~> 0.5.1)
oauth2 (~> 0.5.1)

GEM
remote: http://rubygems.org/
Expand Down Expand Up @@ -50,19 +50,18 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.2.2)
childprocess (0.2.3)
ffi (~> 1.0.6)
columnize (0.3.5)
columnize (0.3.6)
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
faraday (0.7.5)
addressable (~> 2.2.6)
multipart-post (~> 1.1.3)
rack (>= 1.1.0, < 2)
ffi (1.0.11)
i18n (0.6.0)
json_pure (1.6.1)
launchy (2.0.5)
addressable (~> 2.2.6)
linecache19 (0.5.12)
Expand All @@ -73,13 +72,13 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.3)
multi_json (1.0.4)
multipart-post (1.1.4)
nokogiri (1.5.0)
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.3)
rack (1.2.4)
rack-mount (0.6.14)
Expand Down Expand Up @@ -123,17 +122,17 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.4)
selenium-webdriver (2.13.0)
rubyzip (0.9.5)
selenium-webdriver (2.15.0)
childprocess (>= 0.2.1)
ffi (~> 1.0.9)
json_pure
multi_json (~> 1.0.4)
rubyzip
simplecov (0.5.4)
multi_json (~> 1.0.3)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sqlite3 (1.3.4)
sqlite3 (1.3.5)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
Expand Down
12 changes: 6 additions & 6 deletions spec/rails3/spec/controller_oauth2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/controller_oauth2_shared_examples')

def stub_all_oauth2_requests!
web_server = OAuth2::Strategy::WebServer.any_instance
auth_code = OAuth2::Strategy::AuthCode.any_instance
access_token = mock(OAuth2::AccessToken)
access_token.stub(:token_param=)
access_token.stub(:get).and_return({
Expand All @@ -21,7 +21,7 @@ def stub_all_oauth2_requests!
"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)
web_server.stub(:get_access_token).and_return(access_token)
auth_code.stub(:get_access_token).and_return(access_token)
end

describe ApplicationController do
Expand Down Expand Up @@ -62,7 +62,7 @@ def stub_all_oauth2_requests!
create_new_user
get :login_at_test2
response.should be_a_redirect
response.should redirect_to("https://graph.facebook.com/oauth/authorize?client_id=#{::Sorcery::Controller::Config.facebook.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&display=page&response_type=code")
response.should redirect_to("https://graph.facebook.com/oauth/authorize?response_type=code&client_id=#{::Sorcery::Controller::Config.facebook.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=email%2Coffline_access&display=page")
end

it "'login_from' logins if user exists" do
Expand All @@ -84,7 +84,7 @@ def stub_all_oauth2_requests!
create_new_user
get :login_at_test3
response.should be_a_redirect
response.should redirect_to("https://github.com/login/oauth/authorize?client_id=#{::Sorcery::Controller::Config.github.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=&display=&response_type=code")
response.should redirect_to("https://github.com/oauth/authorize?response_type=code&client_id=#{::Sorcery::Controller::Config.github.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=&display=")
end

it "'login_from' logins if user exists (github)" do
Expand All @@ -106,7 +106,7 @@ def stub_all_oauth2_requests!
create_new_user
get :login_at_test4
response.should be_a_redirect
response.should redirect_to("https://accounts.google.com/o/oauth2/auth?client_id=#{::Sorcery::Controller::Config.google.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&display=&response_type=code")
response.should redirect_to("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=#{::Sorcery::Controller::Config.google.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&display=")
end

it "'login_from' logins if user exists (google)" do
Expand All @@ -128,7 +128,7 @@ def stub_all_oauth2_requests!
create_new_user
get :login_at_test5
response.should be_a_redirect
response.should redirect_to("https://oauth.live.com/authorize?client_id=#{::Sorcery::Controller::Config.liveid.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=wl.basic%20wl.emails%20wl.offline_access&display=&response_type=code")
response.should redirect_to("https://oauth.live.com/authorize?response_type=code&client_id=#{::Sorcery::Controller::Config.liveid.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=wl.basic%20wl.emails%20wl.offline_access&display=")
end

it "'login_from' logins if user exists (liveid)" do
Expand Down