sorcery 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sorcery might be problematic. Click here for more details.

Files changed (33) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +39 -39
  3. data/README.rdoc +1 -1
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/lib/generators/sorcery/install_generator.rb +1 -0
  7. data/lib/generators/sorcery/templates/migration/reset_password.rb +1 -1
  8. data/lib/sorcery/controller/submodules/activity_logging.rb +3 -3
  9. data/lib/sorcery/controller/submodules/external.rb +6 -0
  10. data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +4 -3
  11. data/lib/sorcery/controller/submodules/external/providers/facebook.rb +5 -2
  12. data/lib/sorcery/controller/submodules/external/providers/github.rb +1 -0
  13. data/lib/sorcery/controller/submodules/external/providers/google.rb +1 -0
  14. data/lib/sorcery/controller/submodules/external/providers/liveid.rb +1 -0
  15. data/lib/sorcery/controller/submodules/external/providers/twitter.rb +2 -1
  16. data/lib/sorcery/model/adapters/active_record.rb +10 -0
  17. data/lib/sorcery/model/adapters/mongoid.rb +6 -0
  18. data/sorcery.gemspec +129 -9
  19. data/spec/Gemfile +1 -1
  20. data/spec/Gemfile.lock +12 -12
  21. data/spec/rails3/Gemfile +1 -1
  22. data/spec/rails3/Gemfile.lock +33 -13
  23. data/spec/rails3/app/controllers/application_controller.rb +5 -0
  24. data/spec/rails3/config/environments/in_memory.rb +35 -0
  25. data/spec/rails3/spec/controller_activity_logging_spec.rb +7 -0
  26. data/spec/rails3/spec/controller_oauth2_spec.rb +6 -6
  27. data/spec/rails3/spec/integration_spec.rb +15 -15
  28. data/spec/rails3/spec/spec_helper.rb +1 -1
  29. data/spec/rails3_mongo_mapper/Gemfile.lock +16 -16
  30. data/spec/rails3_mongoid/Gemfile.lock +15 -15
  31. data/spec/rails3_mongoid/app/controllers/application_controller.rb +5 -0
  32. data/spec/rails3_mongoid/spec/controller_activity_logging_spec.rb +7 -0
  33. metadata +233 -120
data/spec/Gemfile CHANGED
@@ -4,7 +4,7 @@ gem "rails", '3.0.3'
4
4
  gem 'bcrypt-ruby', :require => 'bcrypt'
5
5
  gem "sorcery", '>= 0.1.0', :path => '../'
6
6
  gem 'oauth', "~> 0.4.4"
7
- gem 'oauth2', "~> 0.4.1"
7
+ gem 'oauth2', "~> 0.5.1"
8
8
  group :development do
9
9
  gem "rspec", "~> 2.5.0"
10
10
  gem 'ruby-debug19'
data/spec/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- sorcery (0.7.4)
4
+ sorcery (0.7.5)
5
5
  bcrypt-ruby (~> 3.0.0)
6
6
  oauth (~> 0.4.4)
7
7
  oauth (~> 0.4.4)
8
- oauth2 (~> 0.4.1)
9
- oauth2 (~> 0.4.1)
8
+ oauth2 (~> 0.5.1)
9
+ oauth2 (~> 0.5.1)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
@@ -43,13 +43,13 @@ GEM
43
43
  arel (2.0.10)
44
44
  bcrypt-ruby (3.0.1)
45
45
  builder (2.1.2)
46
- columnize (0.3.4)
46
+ columnize (0.3.5)
47
47
  diff-lcs (1.1.3)
48
48
  erubis (2.6.6)
49
49
  abstract (>= 1.0.0)
50
- faraday (0.6.1)
51
- addressable (~> 2.2.4)
52
- multipart-post (~> 1.1.0)
50
+ faraday (0.7.5)
51
+ addressable (~> 2.2.6)
52
+ multipart-post (~> 1.1.3)
53
53
  rack (>= 1.1.0, < 2)
54
54
  i18n (0.6.0)
55
55
  linecache19 (0.5.12)
@@ -61,11 +61,11 @@ GEM
61
61
  treetop (~> 1.4.8)
62
62
  mime-types (1.17.2)
63
63
  multi_json (1.0.3)
64
- multipart-post (1.1.3)
64
+ multipart-post (1.1.4)
65
65
  oauth (0.4.5)
66
- oauth2 (0.4.1)
67
- faraday (~> 0.6.1)
68
- multi_json (>= 0.0.5)
66
+ oauth2 (0.5.1)
67
+ faraday (~> 0.7.4)
68
+ multi_json (~> 1.0.3)
69
69
  polyglot (0.3.3)
70
70
  rack (1.2.4)
71
71
  rack-mount (0.6.14)
@@ -120,7 +120,7 @@ PLATFORMS
120
120
  DEPENDENCIES
121
121
  bcrypt-ruby
122
122
  oauth (~> 0.4.4)
123
- oauth2 (~> 0.4.1)
123
+ oauth2 (~> 0.5.1)
124
124
  rails (= 3.0.3)
125
125
  rspec (~> 2.5.0)
126
126
  ruby-debug19
data/spec/rails3/Gemfile CHANGED
@@ -9,6 +9,6 @@ group :development, :test do
9
9
  gem 'ruby-debug19'
10
10
  gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
11
11
  gem 'timecop'
12
- # gem 'capybara', '~> 1.1.1'
12
+ gem 'capybara', '~> 1.1.1'
13
13
  gem 'launchy', '~> 2.0.5'
14
14
  end
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- sorcery (0.7.4)
4
+ sorcery (0.7.5)
5
5
  bcrypt-ruby (~> 3.0.0)
6
6
  oauth (~> 0.4.4)
7
7
  oauth (~> 0.4.4)
8
- oauth2 (~> 0.4.1)
9
- oauth2 (~> 0.4.1)
8
+ oauth2 (~> 0.5.1)
9
+ oauth2 (~> 0.5.1)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
@@ -43,14 +43,24 @@ GEM
43
43
  arel (2.0.10)
44
44
  bcrypt-ruby (3.0.1)
45
45
  builder (2.1.2)
46
- columnize (0.3.4)
46
+ capybara (1.1.2)
47
+ mime-types (>= 1.16)
48
+ nokogiri (>= 1.3.3)
49
+ rack (>= 1.0.0)
50
+ rack-test (>= 0.5.4)
51
+ selenium-webdriver (~> 2.0)
52
+ xpath (~> 0.1.4)
53
+ childprocess (0.2.3)
54
+ ffi (~> 1.0.6)
55
+ columnize (0.3.6)
47
56
  diff-lcs (1.1.3)
48
57
  erubis (2.6.6)
49
58
  abstract (>= 1.0.0)
50
- faraday (0.6.1)
51
- addressable (~> 2.2.4)
52
- multipart-post (~> 1.1.0)
59
+ faraday (0.7.5)
60
+ addressable (~> 2.2.6)
61
+ multipart-post (~> 1.1.3)
53
62
  rack (>= 1.1.0, < 2)
63
+ ffi (1.0.11)
54
64
  i18n (0.6.0)
55
65
  launchy (2.0.5)
56
66
  addressable (~> 2.2.6)
@@ -62,12 +72,13 @@ GEM
62
72
  mime-types (~> 1.16)
63
73
  treetop (~> 1.4.8)
64
74
  mime-types (1.17.2)
65
- multi_json (1.0.3)
66
- multipart-post (1.1.3)
75
+ multi_json (1.0.4)
76
+ multipart-post (1.1.4)
77
+ nokogiri (1.5.0)
67
78
  oauth (0.4.5)
68
- oauth2 (0.4.1)
69
- faraday (~> 0.6.1)
70
- multi_json (>= 0.0.5)
79
+ oauth2 (0.5.1)
80
+ faraday (~> 0.7.4)
81
+ multi_json (~> 1.0.3)
71
82
  polyglot (0.3.3)
72
83
  rack (1.2.4)
73
84
  rack-mount (0.6.14)
@@ -111,11 +122,17 @@ GEM
111
122
  ruby-debug-base19 (>= 0.11.19)
112
123
  ruby_core_source (0.1.5)
113
124
  archive-tar-minitar (>= 0.5.2)
125
+ rubyzip (0.9.5)
126
+ selenium-webdriver (2.15.0)
127
+ childprocess (>= 0.2.1)
128
+ ffi (~> 1.0.9)
129
+ multi_json (~> 1.0.4)
130
+ rubyzip
114
131
  simplecov (0.5.4)
115
132
  multi_json (~> 1.0.3)
116
133
  simplecov-html (~> 0.5.3)
117
134
  simplecov-html (0.5.3)
118
- sqlite3 (1.3.4)
135
+ sqlite3 (1.3.5)
119
136
  sqlite3-ruby (1.3.3)
120
137
  sqlite3 (>= 1.3.3)
121
138
  thor (0.14.6)
@@ -124,11 +141,14 @@ GEM
124
141
  polyglot
125
142
  polyglot (>= 0.3.1)
126
143
  tzinfo (0.3.31)
144
+ xpath (0.1.4)
145
+ nokogiri (~> 1.3)
127
146
 
128
147
  PLATFORMS
129
148
  ruby
130
149
 
131
150
  DEPENDENCIES
151
+ capybara (~> 1.1.1)
132
152
  launchy (~> 2.0.5)
133
153
  rails (= 3.0.3)
134
154
  rspec-rails (~> 2.7.0)
@@ -14,6 +14,11 @@ class ApplicationController < ActionController::Base
14
14
  render :nothing => true
15
15
  end
16
16
 
17
+ def some_action_making_a_non_persisted_change_to_the_user
18
+ current_user.username = "to_be_ignored"
19
+ render :nothing => true
20
+ end
21
+
17
22
  def test_login
18
23
  @user = login(params[:username], params[:password])
19
24
  render :text => ""
@@ -0,0 +1,35 @@
1
+ AppRoot::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = true
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -54,6 +54,13 @@ describe ApplicationController do
54
54
  User.first.last_activity_at.to_s(:db).should <= (now+2).to_s(:db)
55
55
  end
56
56
 
57
+ it "should update nothing but activity fields" do
58
+ original_user_name = User.first.username
59
+ login_user
60
+ get :some_action_making_a_non_persisted_change_to_the_user
61
+ User.first.username.should == original_user_name
62
+ end
63
+
57
64
  it "'current_users' should hold the user object when 1 user is logged in" do
58
65
  login_user
59
66
  get :some_action
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../shared_examples/controller_oauth2_shared_examples')
3
3
 
4
4
  def stub_all_oauth2_requests!
5
- web_server = OAuth2::Strategy::WebServer.any_instance
5
+ auth_code = OAuth2::Strategy::AuthCode.any_instance
6
6
  access_token = mock(OAuth2::AccessToken)
7
7
  access_token.stub(:token_param=)
8
8
  access_token.stub(:get).and_return({
@@ -21,7 +21,7 @@ def stub_all_oauth2_requests!
21
21
  "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}],
22
22
  "verified"=>true,
23
23
  "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
24
- web_server.stub(:get_access_token).and_return(access_token)
24
+ auth_code.stub(:get_access_token).and_return(access_token)
25
25
  end
26
26
 
27
27
  describe ApplicationController do
@@ -62,7 +62,7 @@ describe ApplicationController do
62
62
  create_new_user
63
63
  get :login_at_test2
64
64
  response.should be_a_redirect
65
- 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&response_type=code")
65
+ 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")
66
66
  end
67
67
 
68
68
  it "'login_from' logins if user exists" do
@@ -84,7 +84,7 @@ describe ApplicationController do
84
84
  create_new_user
85
85
  get :login_at_test3
86
86
  response.should be_a_redirect
87
- 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=&response_type=code")
87
+ 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=")
88
88
  end
89
89
 
90
90
  it "'login_from' logins if user exists (github)" do
@@ -106,7 +106,7 @@ describe ApplicationController do
106
106
  create_new_user
107
107
  get :login_at_test4
108
108
  response.should be_a_redirect
109
- 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&response_type=code")
109
+ 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=")
110
110
  end
111
111
 
112
112
  it "'login_from' logins if user exists (google)" do
@@ -128,7 +128,7 @@ describe ApplicationController do
128
128
  create_new_user
129
129
  get :login_at_test5
130
130
  response.should be_a_redirect
131
- 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&response_type=code")
131
+ 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=")
132
132
  end
133
133
 
134
134
  it "'login_from' logins if user exists (liveid)" do
@@ -1,21 +1,21 @@
1
- # require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
- #
3
- # describe "the login process", :type => :request do
4
- # before(:all) do
5
- # sorcery_reload!
6
- # create_new_user
7
- # end
8
- #
9
- # after(:all) do
10
- # end
11
- #
12
- # it "handles unverified request" do
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "the login process", :type => :request do
4
+ before(:all) do
5
+ sorcery_reload!
6
+ create_new_user
7
+ end
8
+
9
+ after(:all) do
10
+ end
11
+ end
12
+ # it "handles unverified request", :js => true do
13
13
  # visit root_path
14
- # # save_and_open_page
15
- # fill_in 'Username', :with => 'gizmo'
14
+ # #save_and_open_page
15
+ # fill_in 'Username', :with => 'gizmo1'
16
16
  # fill_in 'Password', :with => 'secret'
17
17
  # # <input name="authenticity_token" type="hidden" value="+8M9lXnjnhAW/mAuzwI9Mmy6hM+00qZJa8VMQUg+NmM=">
18
- # #page.execute_script("$$('hidden').value='mezuza'")
18
+ # page.execute_script("$$('hidden').value='mezuza'")
19
19
  # #save_and_open_page
20
20
  # click_button 'Login'
21
21
  # save_and_open_page
@@ -5,7 +5,7 @@ $: << File.join(File.dirname(__FILE__), '..', '..', 'lib' )
5
5
  ENV["RAILS_ENV"] ||= 'in_memory'
6
6
  require File.expand_path("../../config/environment", __FILE__)
7
7
  require 'rspec/rails'
8
- #require 'capybara/rspec'
8
+ require 'capybara/rspec'
9
9
  require 'timecop'
10
10
  # require 'simplecov'
11
11
  # SimpleCov.root File.join(File.dirname(__FILE__), "..", "..", "rails3" )
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- sorcery (0.7.4)
4
+ sorcery (0.7.5)
5
5
  bcrypt-ruby (~> 3.0.0)
6
6
  oauth (~> 0.4.4)
7
7
  oauth (~> 0.4.4)
8
- oauth2 (~> 0.4.1)
9
- oauth2 (~> 0.4.1)
8
+ oauth2 (~> 0.5.1)
9
+ oauth2 (~> 0.5.1)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
@@ -42,17 +42,17 @@ GEM
42
42
  archive-tar-minitar (0.5.2)
43
43
  arel (2.0.10)
44
44
  bcrypt-ruby (3.0.1)
45
- bson (1.4.1)
46
- bson_ext (1.4.1)
45
+ bson (1.4.0)
46
+ bson_ext (1.4.0)
47
47
  builder (2.1.2)
48
48
  coderay (0.9.8)
49
- columnize (0.3.4)
49
+ columnize (0.3.5)
50
50
  diff-lcs (1.1.3)
51
51
  erubis (2.6.6)
52
52
  abstract (>= 1.0.0)
53
- faraday (0.6.1)
54
- addressable (~> 2.2.4)
55
- multipart-post (~> 1.1.0)
53
+ faraday (0.7.5)
54
+ addressable (~> 2.2.6)
55
+ multipart-post (~> 1.1.3)
56
56
  rack (>= 1.1.0, < 2)
57
57
  i18n (0.6.0)
58
58
  linecache19 (0.5.12)
@@ -65,18 +65,18 @@ GEM
65
65
  method_source (0.6.7)
66
66
  ruby_parser (>= 2.3.1)
67
67
  mime-types (1.17.2)
68
- mongo (1.4.1)
69
- bson (= 1.4.1)
68
+ mongo (1.4.0)
69
+ bson (= 1.4.0)
70
70
  mongo_mapper (0.10.1)
71
71
  activemodel (~> 3.0)
72
72
  activesupport (~> 3.0)
73
73
  plucky (~> 0.4.0)
74
74
  multi_json (1.0.3)
75
- multipart-post (1.1.3)
75
+ multipart-post (1.1.4)
76
76
  oauth (0.4.5)
77
- oauth2 (0.4.1)
78
- faraday (~> 0.6.1)
79
- multi_json (>= 0.0.5)
77
+ oauth2 (0.5.1)
78
+ faraday (~> 0.7.4)
79
+ multi_json (~> 1.0.3)
80
80
  plucky (0.4.3)
81
81
  mongo (~> 1.3)
82
82
  polyglot (0.3.3)
@@ -129,7 +129,7 @@ GEM
129
129
  archive-tar-minitar (>= 0.5.2)
130
130
  ruby_parser (2.3.1)
131
131
  sexp_processor (~> 3.0)
132
- sexp_processor (3.0.7)
132
+ sexp_processor (3.0.8)
133
133
  simplecov (0.5.4)
134
134
  multi_json (~> 1.0.3)
135
135
  simplecov-html (~> 0.5.3)
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- sorcery (0.7.4)
4
+ sorcery (0.7.5)
5
5
  bcrypt-ruby (~> 3.0.0)
6
6
  oauth (~> 0.4.4)
7
7
  oauth (~> 0.4.4)
8
- oauth2 (~> 0.4.1)
9
- oauth2 (~> 0.4.1)
8
+ oauth2 (~> 0.5.1)
9
+ oauth2 (~> 0.5.1)
10
10
 
11
11
  GEM
12
12
  remote: http://rubygems.org/
@@ -42,16 +42,16 @@ GEM
42
42
  archive-tar-minitar (0.5.2)
43
43
  arel (2.0.10)
44
44
  bcrypt-ruby (3.0.1)
45
- bson (1.4.1)
46
- bson_ext (1.4.1)
45
+ bson (1.4.0)
46
+ bson_ext (1.4.0)
47
47
  builder (2.1.2)
48
- columnize (0.3.4)
48
+ columnize (0.3.5)
49
49
  diff-lcs (1.1.3)
50
50
  erubis (2.6.6)
51
51
  abstract (>= 1.0.0)
52
- faraday (0.6.1)
53
- addressable (~> 2.2.4)
54
- multipart-post (~> 1.1.0)
52
+ faraday (0.7.5)
53
+ addressable (~> 2.2.6)
54
+ multipart-post (~> 1.1.3)
55
55
  rack (>= 1.1.0, < 2)
56
56
  i18n (0.6.0)
57
57
  linecache19 (0.5.12)
@@ -62,18 +62,18 @@ GEM
62
62
  mime-types (~> 1.16)
63
63
  treetop (~> 1.4.8)
64
64
  mime-types (1.17.2)
65
- mongo (1.4.1)
66
- bson (= 1.4.1)
65
+ mongo (1.4.0)
66
+ bson (= 1.4.0)
67
67
  mongoid (2.2.4)
68
68
  activemodel (~> 3.0)
69
69
  mongo (~> 1.3)
70
70
  tzinfo (~> 0.3.22)
71
71
  multi_json (1.0.3)
72
- multipart-post (1.1.3)
72
+ multipart-post (1.1.4)
73
73
  oauth (0.4.5)
74
- oauth2 (0.4.1)
75
- faraday (~> 0.6.1)
76
- multi_json (>= 0.0.5)
74
+ oauth2 (0.5.1)
75
+ faraday (~> 0.7.4)
76
+ multi_json (~> 1.0.3)
77
77
  polyglot (0.3.3)
78
78
  rack (1.2.4)
79
79
  rack-mount (0.6.14)