sorcery 0.6.1 → 0.7.0

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 (59) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +7 -7
  3. data/README.rdoc +14 -4
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/lib/generators/sorcery_migration/templates/core.rb +1 -1
  7. data/lib/generators/sorcery_migration/templates/reset_password.rb +4 -0
  8. data/lib/sorcery.rb +1 -0
  9. data/lib/sorcery/controller.rb +26 -6
  10. data/lib/sorcery/controller/adapters/sinatra.rb +12 -1
  11. data/lib/sorcery/controller/submodules/activity_logging.rb +18 -1
  12. data/lib/sorcery/controller/submodules/brute_force_protection.rb +2 -1
  13. data/lib/sorcery/controller/submodules/external.rb +10 -3
  14. data/lib/sorcery/controller/submodules/external/protocols/certs/ca-bundle.crt +5182 -0
  15. data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +10 -6
  16. data/lib/sorcery/controller/submodules/external/providers/github.rb +80 -0
  17. data/lib/sorcery/controller/submodules/external/providers/twitter.rb +5 -0
  18. data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -1
  19. data/lib/sorcery/controller/submodules/remember_me.rb +13 -4
  20. data/lib/sorcery/controller/submodules/session_timeout.rb +1 -1
  21. data/lib/sorcery/crypto_providers/aes256.rb +7 -3
  22. data/lib/sorcery/engine.rb +1 -0
  23. data/lib/sorcery/initializers/initializer.rb +81 -60
  24. data/lib/sorcery/model.rb +13 -11
  25. data/lib/sorcery/model/adapters/active_record.rb +2 -1
  26. data/lib/sorcery/model/adapters/mongoid.rb +7 -2
  27. data/lib/sorcery/model/submodules/brute_force_protection.rb +5 -3
  28. data/lib/sorcery/model/submodules/remember_me.rb +1 -1
  29. data/lib/sorcery/model/submodules/reset_password.rb +1 -2
  30. data/lib/sorcery/model/submodules/user_activation.rb +1 -2
  31. data/lib/sorcery/model/temporary_token.rb +5 -0
  32. data/lib/sorcery/test_helpers/internal/rails.rb +1 -1
  33. data/lib/sorcery/test_helpers/rails.rb +2 -2
  34. data/lib/sorcery/test_helpers/sinatra.rb +1 -1
  35. data/sorcery.gemspec +16 -9
  36. data/spec/Gemfile +1 -1
  37. data/spec/Gemfile.lock +9 -11
  38. data/spec/README.md +26 -0
  39. data/spec/rails3/Gemfile +2 -0
  40. data/spec/rails3/Gemfile.lock +33 -11
  41. data/spec/rails3/app/controllers/application_controller.rb +40 -22
  42. data/spec/rails3/app/views/application/index.html.erb +17 -0
  43. data/spec/rails3/spec/controller_activity_logging_spec.rb +23 -0
  44. data/spec/rails3/spec/controller_oauth2_spec.rb +61 -20
  45. data/spec/rails3/spec/controller_remember_me_spec.rb +37 -6
  46. data/spec/rails3/spec/controller_spec.rb +30 -0
  47. data/spec/rails3/spec/integration_spec.rb +23 -0
  48. data/spec/rails3/spec/spec_helper.rb +6 -3
  49. data/spec/rails3_mongoid/Gemfile.lock +9 -11
  50. data/spec/rails3_mongoid/spec/controller_spec.rb +130 -0
  51. data/spec/shared_examples/user_remember_me_shared_examples.rb +1 -0
  52. data/spec/shared_examples/user_shared_examples.rb +7 -7
  53. data/spec/sinatra/Gemfile.lock +9 -11
  54. data/spec/sinatra/spec/controller_oauth2_spec.rb +3 -6
  55. data/spec/sinatra/spec/controller_spec.rb +7 -0
  56. data/spec/sinatra_modular/Gemfile.lock +9 -11
  57. data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +3 -6
  58. metadata +12 -5
  59. data/spec/rails3/public/index.html +0 -239
@@ -15,6 +15,7 @@ module Sorcery
15
15
  self.class_eval do
16
16
  extend ClassMethods # included here, before submodules, so they can be overriden by them.
17
17
  include InstanceMethods
18
+ include TemporaryToken
18
19
  end
19
20
 
20
21
  include_required_submodules!
@@ -52,8 +53,10 @@ module Sorcery
52
53
  # using 1.8.x hash syntax to perserve compatibility.
53
54
  def init_mongoid_support!
54
55
  self.class_eval do
55
- field sorcery_config.username_attribute_name, :type => String
56
- field sorcery_config.email_attribute_name, :type => String unless sorcery_config.username_attribute_name == sorcery_config.email_attribute_name
56
+ sorcery_config.username_attribute_names.each do |username|
57
+ field username, :type => String
58
+ end
59
+ field sorcery_config.email_attribute_name, :type => String unless sorcery_config.username_attribute_names.include?(sorcery_config.email_attribute_name)
57
60
  field sorcery_config.crypted_password_attribute_name, :type => String
58
61
  field sorcery_config.salt_attribute_name, :type => String
59
62
  end
@@ -95,7 +98,7 @@ module Sorcery
95
98
 
96
99
  @sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches
97
100
  @sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token
98
- CryptoProviders::AES256.key = @sorcery_config.encryption_key if @sorcery_config.encryption_algorithm == :aes256
101
+ CryptoProviders::AES256.key = @sorcery_config.encryption_key
99
102
  @sorcery_config.encryption_provider.encrypt(*tokens)
100
103
  end
101
104
 
@@ -141,7 +144,7 @@ module Sorcery
141
144
  # encrypts password with salt and saves it.
142
145
  def encrypt_password
143
146
  config = sorcery_config
144
- self.send(:"#{config.salt_attribute_name}=", new_salt = generate_random_token) if !config.salt_attribute_name.nil?
147
+ self.send(:"#{config.salt_attribute_name}=", new_salt = TemporaryToken.generate_random_token) if !config.salt_attribute_name.nil?
145
148
  self.send(:"#{config.crypted_password_attribute_name}=", self.class.encrypt(self.send(config.password_attribute_name),new_salt))
146
149
  end
147
150
 
@@ -159,11 +162,6 @@ module Sorcery
159
162
  mail.deliver
160
163
  end
161
164
  end
162
-
163
- # Random code, used for salt and temporary tokens.
164
- def generate_random_token
165
- Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )
166
- end
167
165
  end
168
166
 
169
167
  # Each class which calls 'activate_sorcery!' receives an instance of this class.
@@ -171,7 +169,7 @@ module Sorcery
171
169
  # options will be configured from a single place.
172
170
  class Config
173
171
 
174
- attr_accessor :username_attribute_name, # change default username attribute, for example, to use :email
172
+ attr_accessor :username_attribute_names, # change default username attribute, for example, to use :email
175
173
  # as the login.
176
174
 
177
175
  :password_attribute_name, # change *virtual* password attribute, the one which is used
@@ -203,7 +201,7 @@ module Sorcery
203
201
  def initialize
204
202
  @defaults = {
205
203
  :@submodules => [],
206
- :@username_attribute_name => :username,
204
+ :@username_attribute_names => [:username],
207
205
  :@password_attribute_name => :password,
208
206
  :@email_attribute_name => :email,
209
207
  :@crypted_password_attribute_name => :crypted_password,
@@ -228,6 +226,10 @@ module Sorcery
228
226
  end
229
227
  end
230
228
 
229
+ def username_attribute_names=(fields)
230
+ @username_attribute_names = fields.kind_of?(Array) ? fields : [fields]
231
+ end
232
+
231
233
  def custom_encryption_provider=(provider)
232
234
  @custom_encryption_provider = @encryption_provider = provider
233
235
  end
@@ -8,7 +8,8 @@ module Sorcery
8
8
 
9
9
  module ClassMethods
10
10
  def find_by_credentials(credentials)
11
- where("#{@sorcery_config.username_attribute_name} = ?", credentials[0]).first
11
+ sql = @sorcery_config.username_attribute_names.map{|attribute| "#{attribute} = :login"}
12
+ where(sql.join(' OR '), :login => credentials[0]).first
12
13
  end
13
14
 
14
15
  def find_by_sorcery_token(token_attr_name, token)
@@ -15,7 +15,11 @@ module Sorcery
15
15
 
16
16
  module ClassMethods
17
17
  def find_by_credentials(credentials)
18
- where(sorcery_config.username_attribute_name => credentials[0]).first
18
+ @sorcery_config.username_attribute_names.each do |attribute|
19
+ @user = where(attribute => credentials[0]).first
20
+ break if @user
21
+ end
22
+ @user
19
23
  end
20
24
 
21
25
  def find_by_provider_and_uid(provider, uid)
@@ -36,7 +40,8 @@ module Sorcery
36
40
  end
37
41
 
38
42
  def find_by_username(username)
39
- where(sorcery_config.username_attribute_name => username).first
43
+ query = sorcery_config.username_attribute_names.map {|name| {name => username}}
44
+ where(query).first
40
45
  end
41
46
 
42
47
  def transaction(&blk)
@@ -54,13 +54,15 @@ module Sorcery
54
54
 
55
55
  def lock!
56
56
  config = sorcery_config
57
- self.update_attributes!(config.lock_expires_at_attribute_name => Time.now.utc + config.login_lock_time_period)
57
+ self.send(:"#{config.lock_expires_at_attribute_name}=", Time.now.utc + config.login_lock_time_period)
58
+ self.save!
58
59
  end
59
60
 
60
61
  def unlock!
61
62
  config = sorcery_config
62
- self.update_attributes!(config.lock_expires_at_attribute_name => nil,
63
- config.failed_logins_count_attribute_name => 0)
63
+ self.send(:"#{config.lock_expires_at_attribute_name}=", nil)
64
+ self.send(:"#{config.failed_logins_count_attribute_name}=", 0)
65
+ self.save!
64
66
  end
65
67
 
66
68
  def unlocked?
@@ -42,7 +42,7 @@ module Sorcery
42
42
  # You shouldn't really use this one yourself - it's called by the controller's 'remember_me!' method.
43
43
  def remember_me!
44
44
  config = sorcery_config
45
- self.send(:"#{config.remember_me_token_attribute_name}=", generate_random_token)
45
+ self.send(:"#{config.remember_me_token_attribute_name}=", TemporaryToken.generate_random_token)
46
46
  self.send(:"#{config.remember_me_token_expires_at_attribute_name}=", Time.now + config.remember_me_for)
47
47
  self.save!(:validate => false)
48
48
  end
@@ -46,7 +46,6 @@ module Sorcery
46
46
  base.sorcery_config.after_config << :validate_mailer_defined
47
47
  base.sorcery_config.after_config << :define_reset_password_mongoid_fields if defined?(Mongoid) and base.ancestors.include?(Mongoid::Document)
48
48
 
49
- base.send(:include, TemporaryToken)
50
49
  base.send(:include, InstanceMethods)
51
50
 
52
51
  end
@@ -81,7 +80,7 @@ module Sorcery
81
80
  config = sorcery_config
82
81
  # hammering protection
83
82
  return if config.reset_password_time_between_emails && self.send(config.reset_password_email_sent_at_attribute_name) && self.send(config.reset_password_email_sent_at_attribute_name) > config.reset_password_time_between_emails.ago.utc
84
- self.send(:"#{config.reset_password_token_attribute_name}=", generate_random_token)
83
+ self.send(:"#{config.reset_password_token_attribute_name}=", TemporaryToken.generate_random_token)
85
84
  self.send(:"#{config.reset_password_token_expires_at_attribute_name}=", Time.now.utc + config.reset_password_expiration_period) if config.reset_password_expiration_period
86
85
  self.send(:"#{config.reset_password_email_sent_at_attribute_name}=", Time.now.utc)
87
86
  self.class.transaction do
@@ -55,7 +55,6 @@ module Sorcery
55
55
  base.sorcery_config.before_authenticate << :prevent_non_active_login
56
56
 
57
57
  base.extend(ClassMethods)
58
- base.send(:include, TemporaryToken)
59
58
  base.send(:include, InstanceMethods)
60
59
 
61
60
 
@@ -101,7 +100,7 @@ module Sorcery
101
100
 
102
101
  def setup_activation
103
102
  config = sorcery_config
104
- generated_activation_token = generate_random_token
103
+ generated_activation_token = TemporaryToken.generate_random_token
105
104
  self.send(:"#{config.activation_token_attribute_name}=", generated_activation_token)
106
105
  self.send(:"#{config.activation_state_attribute_name}=", "pending")
107
106
  self.send(:"#{config.activation_token_expires_at_attribute_name}=", Time.now.utc + config.activation_token_expiration_period) if config.activation_token_expiration_period
@@ -8,6 +8,11 @@ module Sorcery
8
8
  base.extend(ClassMethods)
9
9
  end
10
10
 
11
+ # Random code, used for salt and temporary tokens.
12
+ def self.generate_random_token
13
+ Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )
14
+ end
15
+
11
16
  module ClassMethods
12
17
  def load_from_token(token, token_attr_name, token_expiration_date_attr)
13
18
  return nil if token.blank?
@@ -12,7 +12,7 @@ module Sorcery
12
12
 
13
13
  def sorcery_reload!(submodules = [], options = {})
14
14
  reload_user_class
15
-
15
+
16
16
  # return to no-module configuration
17
17
  ::Sorcery::Controller::Config.init!
18
18
  ::Sorcery::Controller::Config.reset!
@@ -4,8 +4,8 @@ module Sorcery
4
4
  # logins a user and calls all callbacks
5
5
  def login_user(user = nil)
6
6
  user ||= @user
7
- @controller.send(:login_user,user)
8
- @controller.send(:after_login!,user,[user.send(user.sorcery_config.username_attribute_name),'secret'])
7
+ @controller.send(:auto_login,user)
8
+ @controller.send(:after_login!,user,[user.send(user.sorcery_config.username_attribute_names.first),'secret'])
9
9
  end
10
10
 
11
11
  def logout_user
@@ -37,7 +37,7 @@ module Sorcery
37
37
  def login_user(user=nil)
38
38
  user ||= @user
39
39
  get_sinatra_app(app).send(:login_user, user)
40
- get_sinatra_app(app).send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_name), 'secret'])
40
+ get_sinatra_app(app).send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_names.first), 'secret'])
41
41
  end
42
42
 
43
43
  def logout_user
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sorcery"
8
- s.version = "0.6.1"
8
+ s.version = "0.7.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Noam Ben Ari"]
12
- s.date = "2011-09-02"
12
+ s.date = "2011-09-30"
13
13
  s.description = "Provides common authentication needs such as signing in/out, activating by email and resetting password."
14
14
  s.email = "nbenari@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -39,9 +39,11 @@ Gem::Specification.new do |s|
39
39
  "lib/sorcery/controller/submodules/activity_logging.rb",
40
40
  "lib/sorcery/controller/submodules/brute_force_protection.rb",
41
41
  "lib/sorcery/controller/submodules/external.rb",
42
+ "lib/sorcery/controller/submodules/external/protocols/certs/ca-bundle.crt",
42
43
  "lib/sorcery/controller/submodules/external/protocols/oauth1.rb",
43
44
  "lib/sorcery/controller/submodules/external/protocols/oauth2.rb",
44
45
  "lib/sorcery/controller/submodules/external/providers/facebook.rb",
46
+ "lib/sorcery/controller/submodules/external/providers/github.rb",
45
47
  "lib/sorcery/controller/submodules/external/providers/twitter.rb",
46
48
  "lib/sorcery/controller/submodules/http_basic_auth.rb",
47
49
  "lib/sorcery/controller/submodules/remember_me.rb",
@@ -77,6 +79,7 @@ Gem::Specification.new do |s|
77
79
  "sorcery.gemspec",
78
80
  "spec/Gemfile",
79
81
  "spec/Gemfile.lock",
82
+ "spec/README.md",
80
83
  "spec/Rakefile",
81
84
  "spec/rails3/.gitignore",
82
85
  "spec/rails3/.rspec",
@@ -90,6 +93,7 @@ Gem::Specification.new do |s|
90
93
  "spec/rails3/app/mailers/sorcery_mailer.rb",
91
94
  "spec/rails3/app/models/authentication.rb",
92
95
  "spec/rails3/app/models/user.rb",
96
+ "spec/rails3/app/views/application/index.html.erb",
93
97
  "spec/rails3/app/views/layouts/application.html.erb",
94
98
  "spec/rails3/app/views/sorcery_mailer/activation_email.html.erb",
95
99
  "spec/rails3/app/views/sorcery_mailer/activation_email.text.erb",
@@ -128,7 +132,6 @@ Gem::Specification.new do |s|
128
132
  "spec/rails3/public/500.html",
129
133
  "spec/rails3/public/favicon.ico",
130
134
  "spec/rails3/public/images/rails.png",
131
- "spec/rails3/public/index.html",
132
135
  "spec/rails3/public/javascripts/application.js",
133
136
  "spec/rails3/public/javascripts/controls.js",
134
137
  "spec/rails3/public/javascripts/dragdrop.js",
@@ -146,6 +149,7 @@ Gem::Specification.new do |s|
146
149
  "spec/rails3/spec/controller_remember_me_spec.rb",
147
150
  "spec/rails3/spec/controller_session_timeout_spec.rb",
148
151
  "spec/rails3/spec/controller_spec.rb",
152
+ "spec/rails3/spec/integration_spec.rb",
149
153
  "spec/rails3/spec/spec.opts",
150
154
  "spec/rails3/spec/spec_helper.orig.rb",
151
155
  "spec/rails3/spec/spec_helper.rb",
@@ -207,6 +211,7 @@ Gem::Specification.new do |s|
207
211
  "spec/rails3_mongoid/public/robots.txt",
208
212
  "spec/rails3_mongoid/public/stylesheets/.gitkeep",
209
213
  "spec/rails3_mongoid/script/rails",
214
+ "spec/rails3_mongoid/spec/controller_spec.rb",
210
215
  "spec/rails3_mongoid/spec/spec.opts",
211
216
  "spec/rails3_mongoid/spec/spec_helper.orig.rb",
212
217
  "spec/rails3_mongoid/spec/spec_helper.rb",
@@ -326,6 +331,7 @@ Gem::Specification.new do |s|
326
331
  "spec/rails3/spec/controller_remember_me_spec.rb",
327
332
  "spec/rails3/spec/controller_session_timeout_spec.rb",
328
333
  "spec/rails3/spec/controller_spec.rb",
334
+ "spec/rails3/spec/integration_spec.rb",
329
335
  "spec/rails3/spec/spec_helper.orig.rb",
330
336
  "spec/rails3/spec/spec_helper.rb",
331
337
  "spec/rails3/spec/user_activation_spec.rb",
@@ -355,6 +361,7 @@ Gem::Specification.new do |s|
355
361
  "spec/rails3_mongoid/config/routes.rb",
356
362
  "spec/rails3_mongoid/db/schema.rb",
357
363
  "spec/rails3_mongoid/db/seeds.rb",
364
+ "spec/rails3_mongoid/spec/controller_spec.rb",
358
365
  "spec/rails3_mongoid/spec/spec_helper.orig.rb",
359
366
  "spec/rails3_mongoid/spec/spec_helper.rb",
360
367
  "spec/rails3_mongoid/spec/user_activation_spec.rb",
@@ -426,7 +433,7 @@ Gem::Specification.new do |s|
426
433
 
427
434
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
428
435
  s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
429
- s.add_runtime_dependency(%q<oauth2>, ["~> 0.4.1"])
436
+ s.add_runtime_dependency(%q<oauth2>, ["~> 0.5.1"])
430
437
  s.add_development_dependency(%q<rails>, [">= 3.0.0"])
431
438
  s.add_development_dependency(%q<json>, [">= 1.5.1"])
432
439
  s.add_development_dependency(%q<mongoid>, ["~> 2.0"])
@@ -442,10 +449,10 @@ Gem::Specification.new do |s|
442
449
  s.add_development_dependency(%q<timecop>, [">= 0"])
443
450
  s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
444
451
  s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
445
- s.add_runtime_dependency(%q<oauth2>, ["~> 0.4.1"])
452
+ s.add_runtime_dependency(%q<oauth2>, ["~> 0.5.1"])
446
453
  else
447
454
  s.add_dependency(%q<oauth>, ["~> 0.4.4"])
448
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
455
+ s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
449
456
  s.add_dependency(%q<rails>, [">= 3.0.0"])
450
457
  s.add_dependency(%q<json>, [">= 1.5.1"])
451
458
  s.add_dependency(%q<mongoid>, ["~> 2.0"])
@@ -461,11 +468,11 @@ Gem::Specification.new do |s|
461
468
  s.add_dependency(%q<timecop>, [">= 0"])
462
469
  s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
463
470
  s.add_dependency(%q<oauth>, ["~> 0.4.4"])
464
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
471
+ s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
465
472
  end
466
473
  else
467
474
  s.add_dependency(%q<oauth>, ["~> 0.4.4"])
468
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
475
+ s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
469
476
  s.add_dependency(%q<rails>, [">= 3.0.0"])
470
477
  s.add_dependency(%q<json>, [">= 1.5.1"])
471
478
  s.add_dependency(%q<mongoid>, ["~> 2.0"])
@@ -481,7 +488,7 @@ Gem::Specification.new do |s|
481
488
  s.add_dependency(%q<timecop>, [">= 0"])
482
489
  s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
483
490
  s.add_dependency(%q<oauth>, ["~> 0.4.4"])
484
- s.add_dependency(%q<oauth2>, ["~> 0.4.1"])
491
+ s.add_dependency(%q<oauth2>, ["~> 0.5.1"])
485
492
  end
486
493
  end
487
494
 
@@ -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'
@@ -1,12 +1,10 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- sorcery (0.6.0)
4
+ sorcery (0.6.1)
5
5
  bcrypt-ruby (~> 3.0.0)
6
- oauth (>= 0.4.4)
7
- oauth (>= 0.4.4)
8
- oauth2 (>= 0.1.1)
9
- oauth2 (>= 0.1.1)
6
+ oauth (~> 0.4.4)
7
+ oauth2 (~> 0.5.0)
10
8
 
11
9
  GEM
12
10
  remote: http://rubygems.org/
@@ -47,8 +45,8 @@ GEM
47
45
  diff-lcs (1.1.3)
48
46
  erubis (2.6.6)
49
47
  abstract (>= 1.0.0)
50
- faraday (0.6.1)
51
- addressable (~> 2.2.4)
48
+ faraday (0.7.4)
49
+ addressable (~> 2.2.6)
52
50
  multipart-post (~> 1.1.0)
53
51
  rack (< 2, >= 1.1.0)
54
52
  i18n (0.6.0)
@@ -63,9 +61,9 @@ GEM
63
61
  multi_json (1.0.3)
64
62
  multipart-post (1.1.3)
65
63
  oauth (0.4.5)
66
- oauth2 (0.4.1)
67
- faraday (~> 0.6.1)
68
- multi_json (>= 0.0.5)
64
+ oauth2 (0.5.1)
65
+ faraday (~> 0.7.4)
66
+ multi_json (~> 1.0.3)
69
67
  polyglot (0.3.2)
70
68
  rack (1.2.3)
71
69
  rack-mount (0.6.14)
@@ -119,7 +117,7 @@ PLATFORMS
119
117
  DEPENDENCIES
120
118
  bcrypt-ruby
121
119
  oauth (~> 0.4.4)
122
- oauth2 (~> 0.4.1)
120
+ oauth2 (~> 0.5.1)
123
121
  rails (= 3.0.3)
124
122
  rspec (~> 2.5.0)
125
123
  ruby-debug19
@@ -0,0 +1,26 @@
1
+ Running Sorcery's Specs
2
+ =======================
3
+ Sorcery is meant to be used with Rails and Sinatra so sample apps have been included in `spec/`.
4
+
5
+ Each sample app runs a set of shared specs ( `spec/shared_examples/*_example.rb`) and also includes specs that address framework specific concerns.
6
+
7
+ Sorcery has one set of specs (`sorcery_crypto_providers_spec.rb`) that can be run outside of any of the frameworks. To run it simply:
8
+
9
+ cd spec/
10
+ bundle install
11
+ rake spec
12
+
13
+ Running Framework Specs
14
+ -----------------------
15
+ To run framework specs, cd into each directory, bundle, and run the specs. For example, to run the rails3 specs you would:
16
+
17
+ cd spec/rails3/
18
+ bundle install
19
+ rake spec
20
+
21
+ **Note:** the rails3_mongoid sample app does require, well, MongoDB. Installing MongoDB on mac osx is easy with homebrew. Seeing as you're reading the readme for running specs, I'll assume you can install MongoDB on your machine. For the purpose of running these tests, I put mongod in verbose mode and in the background so I can see it log to stdout.
22
+
23
+ cd spec/rails3_mongoid
24
+ bundle install
25
+ mongod -v &
26
+ rake spec
@@ -10,4 +10,6 @@ group :development, :test do
10
10
  gem 'ruby-debug19'
11
11
  gem 'simplecov', '>= 0.3.8', :require => false # Will install simplecov-html as a dependency
12
12
  gem 'timecop'
13
+ gem 'capybara', '~> 1.1.1'
14
+ gem 'launchy', '~> 2.0.5'
13
15
  end
@@ -1,12 +1,10 @@
1
1
  PATH
2
2
  remote: ../../../
3
3
  specs:
4
- sorcery (0.6.0)
4
+ sorcery (0.6.1)
5
5
  bcrypt-ruby (~> 3.0.0)
6
- oauth (>= 0.4.4)
7
- oauth (>= 0.4.4)
8
- oauth2 (>= 0.1.1)
9
- oauth2 (>= 0.1.1)
6
+ oauth (~> 0.4.4)
7
+ oauth2 (~> 0.5.0)
10
8
 
11
9
  GEM
12
10
  remote: http://rubygems.org/
@@ -41,17 +39,30 @@ GEM
41
39
  addressable (2.2.6)
42
40
  archive-tar-minitar (0.5.2)
43
41
  arel (2.0.6)
44
- bcrypt-ruby (3.0.0)
42
+ bcrypt-ruby (3.0.1)
45
43
  builder (2.1.2)
44
+ capybara (1.1.1)
45
+ mime-types (>= 1.16)
46
+ nokogiri (>= 1.3.3)
47
+ rack (>= 1.0.0)
48
+ rack-test (>= 0.5.4)
49
+ selenium-webdriver (~> 2.0)
50
+ xpath (~> 0.1.4)
51
+ childprocess (0.2.2)
52
+ ffi (~> 1.0.6)
46
53
  columnize (0.3.2)
47
54
  diff-lcs (1.1.2)
48
55
  erubis (2.6.6)
49
56
  abstract (>= 1.0.0)
50
- faraday (0.6.1)
51
- addressable (~> 2.2.4)
57
+ faraday (0.7.4)
58
+ addressable (~> 2.2.6)
52
59
  multipart-post (~> 1.1.0)
53
60
  rack (< 2, >= 1.1.0)
61
+ ffi (1.0.9)
54
62
  i18n (0.5.0)
63
+ json_pure (1.5.1)
64
+ launchy (2.0.5)
65
+ addressable (~> 2.2.6)
55
66
  linecache19 (0.5.11)
56
67
  ruby_core_source (>= 0.1.4)
57
68
  mail (2.2.13)
@@ -62,10 +73,11 @@ GEM
62
73
  mime-types (1.16)
63
74
  multi_json (1.0.3)
64
75
  multipart-post (1.1.3)
76
+ nokogiri (1.4.4)
65
77
  oauth (0.4.5)
66
- oauth2 (0.4.1)
67
- faraday (~> 0.6.1)
68
- multi_json (>= 0.0.5)
78
+ oauth2 (0.5.1)
79
+ faraday (~> 0.7.4)
80
+ multi_json (~> 1.0.3)
69
81
  polyglot (0.3.1)
70
82
  rack (1.2.1)
71
83
  rack-mount (0.6.13)
@@ -109,6 +121,12 @@ GEM
109
121
  ruby-debug-base19 (>= 0.11.19)
110
122
  ruby_core_source (0.1.4)
111
123
  archive-tar-minitar (>= 0.5.2)
124
+ rubyzip (0.9.4)
125
+ selenium-webdriver (2.6.0)
126
+ childprocess (>= 0.2.1)
127
+ ffi (>= 1.0.7)
128
+ json_pure
129
+ rubyzip
112
130
  simplecov (0.3.9)
113
131
  simplecov-html (>= 0.3.7)
114
132
  simplecov-html (0.3.9)
@@ -118,11 +136,15 @@ GEM
118
136
  treetop (1.4.9)
119
137
  polyglot (>= 0.3.1)
120
138
  tzinfo (0.3.23)
139
+ xpath (0.1.4)
140
+ nokogiri (~> 1.3)
121
141
 
122
142
  PLATFORMS
123
143
  ruby
124
144
 
125
145
  DEPENDENCIES
146
+ capybara (~> 1.1.1)
147
+ launchy (~> 2.0.5)
126
148
  rails (= 3.0.3)
127
149
  rspec (~> 2.5.0)
128
150
  rspec-rails (~> 2.5.0)