sorcery 0.7.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +3 -0
- data/Gemfile +9 -4
- data/Gemfile.lock +99 -58
- data/README.rdoc +33 -8
- data/Rakefile +6 -7
- data/VERSION +1 -1
- data/lib/generators/sorcery/install_generator.rb +9 -7
- data/lib/generators/sorcery/templates/initializer.rb +324 -127
- data/lib/generators/sorcery/templates/migration/brute_force_protection.rb +2 -0
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +1 -2
- data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +2 -2
- data/lib/sorcery/controller/submodules/external/providers/facebook.rb +16 -4
- data/lib/sorcery/controller/submodules/external/providers/github.rb +6 -4
- data/lib/sorcery/controller/submodules/external/providers/google.rb +4 -4
- data/lib/sorcery/controller/submodules/external/providers/linkedin.rb +101 -0
- data/lib/sorcery/controller/submodules/external/providers/liveid.rb +1 -1
- data/lib/sorcery/controller/submodules/external/providers/vkontakte.rb +94 -0
- data/lib/sorcery/controller/submodules/external.rb +83 -15
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +1 -1
- data/lib/sorcery/controller/submodules/remember_me.rb +11 -2
- data/lib/sorcery/controller.rb +14 -6
- data/lib/sorcery/crypto_providers/bcrypt.rb +1 -0
- data/lib/sorcery/model/adapters/active_record.rb +9 -4
- data/lib/sorcery/model/adapters/mongo_mapper.rb +16 -14
- data/lib/sorcery/model/adapters/mongoid.rb +12 -6
- data/lib/sorcery/model/submodules/brute_force_protection.rb +44 -13
- data/lib/sorcery/model/submodules/remember_me.rb +4 -6
- data/lib/sorcery/model/submodules/reset_password.rb +14 -7
- data/lib/sorcery/model/submodules/user_activation.rb +14 -6
- data/lib/sorcery/model.rb +40 -39
- data/lib/sorcery/railties/tasks.rake +2 -0
- data/lib/sorcery.rb +3 -1
- data/sorcery.gemspec +31 -141
- data/spec/Gemfile +1 -1
- data/spec/Gemfile.lock +20 -19
- data/spec/README.md +8 -8
- data/spec/rails3/Gemfile +1 -0
- data/spec/rails3/Gemfile.lock +27 -24
- data/spec/rails3/app/controllers/application_controller.rb +54 -0
- data/spec/rails3/app/mailers/sorcery_mailer.rb +7 -0
- data/spec/rails3/app/views/sorcery_mailer/send_unlock_token_email.text.erb +1 -0
- data/spec/rails3/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +2 -0
- data/spec/rails3/spec/controller_activity_logging_spec.rb +3 -0
- data/spec/rails3/spec/controller_brute_force_protection_spec.rb +23 -1
- data/spec/rails3/spec/controller_oauth2_spec.rb +162 -24
- data/spec/rails3/spec/controller_oauth_spec.rb +111 -6
- data/spec/rails3/spec/controller_spec.rb +7 -0
- data/spec/rails3_mongo_mapper/Gemfile +2 -1
- data/spec/rails3_mongo_mapper/Gemfile.lock +37 -39
- data/spec/rails3_mongo_mapper/app/controllers/application_controller.rb +14 -0
- data/spec/rails3_mongo_mapper/spec/controller_spec.rb +7 -0
- data/spec/rails3_mongoid/Gemfile +1 -0
- data/spec/rails3_mongoid/Gemfile.lock +28 -25
- data/spec/rails3_mongoid/app/controllers/application_controller.rb +14 -0
- data/spec/rails3_mongoid/config/mongoid.yml +1 -1
- data/spec/rails3_mongoid/spec/controller_activity_logging_spec.rb +11 -11
- data/spec/rails3_mongoid/spec/controller_spec.rb +7 -0
- data/spec/shared_examples/controller_oauth2_shared_examples.rb +20 -1
- data/spec/shared_examples/controller_oauth_shared_examples.rb +18 -0
- data/spec/shared_examples/user_activation_shared_examples.rb +71 -41
- data/spec/shared_examples/user_reset_password_shared_examples.rb +76 -31
- data/spec/sorcery_crypto_providers_spec.rb +9 -0
- metadata +159 -246
data/sorcery.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "sorcery"
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.8.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 = "
|
|
12
|
+
s.date = "2013-01-12"
|
|
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 = [
|
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.files = [
|
|
20
20
|
".document",
|
|
21
21
|
".rspec",
|
|
22
|
+
".travis.yml",
|
|
22
23
|
"Gemfile",
|
|
23
24
|
"Gemfile.lock",
|
|
24
25
|
"LICENSE.txt",
|
|
@@ -46,8 +47,10 @@ Gem::Specification.new do |s|
|
|
|
46
47
|
"lib/sorcery/controller/submodules/external/providers/facebook.rb",
|
|
47
48
|
"lib/sorcery/controller/submodules/external/providers/github.rb",
|
|
48
49
|
"lib/sorcery/controller/submodules/external/providers/google.rb",
|
|
50
|
+
"lib/sorcery/controller/submodules/external/providers/linkedin.rb",
|
|
49
51
|
"lib/sorcery/controller/submodules/external/providers/liveid.rb",
|
|
50
52
|
"lib/sorcery/controller/submodules/external/providers/twitter.rb",
|
|
53
|
+
"lib/sorcery/controller/submodules/external/providers/vkontakte.rb",
|
|
51
54
|
"lib/sorcery/controller/submodules/http_basic_auth.rb",
|
|
52
55
|
"lib/sorcery/controller/submodules/remember_me.rb",
|
|
53
56
|
"lib/sorcery/controller/submodules/session_timeout.rb",
|
|
@@ -99,6 +102,7 @@ Gem::Specification.new do |s|
|
|
|
99
102
|
"spec/rails3/app/views/sorcery_mailer/activation_success_email.text.erb",
|
|
100
103
|
"spec/rails3/app/views/sorcery_mailer/reset_password_email.html.erb",
|
|
101
104
|
"spec/rails3/app/views/sorcery_mailer/reset_password_email.text.erb",
|
|
105
|
+
"spec/rails3/app/views/sorcery_mailer/send_unlock_token_email.text.erb",
|
|
102
106
|
"spec/rails3/config.ru",
|
|
103
107
|
"spec/rails3/config/application.rb",
|
|
104
108
|
"spec/rails3/config/boot.rb",
|
|
@@ -300,135 +304,17 @@ Gem::Specification.new do |s|
|
|
|
300
304
|
s.homepage = "http://github.com/NoamB/sorcery"
|
|
301
305
|
s.licenses = ["MIT"]
|
|
302
306
|
s.require_paths = ["lib"]
|
|
303
|
-
s.rubygems_version = "1.8.
|
|
307
|
+
s.rubygems_version = "1.8.21"
|
|
304
308
|
s.summary = "Magical authentication for Rails 3 applications"
|
|
305
|
-
s.test_files = [
|
|
306
|
-
"spec/rails3/app/controllers/application_controller.rb",
|
|
307
|
-
"spec/rails3/app/helpers/application_helper.rb",
|
|
308
|
-
"spec/rails3/app/mailers/sorcery_mailer.rb",
|
|
309
|
-
"spec/rails3/app/models/authentication.rb",
|
|
310
|
-
"spec/rails3/app/models/user.rb",
|
|
311
|
-
"spec/rails3/config/application.rb",
|
|
312
|
-
"spec/rails3/config/boot.rb",
|
|
313
|
-
"spec/rails3/config/environment.rb",
|
|
314
|
-
"spec/rails3/config/environments/development.rb",
|
|
315
|
-
"spec/rails3/config/environments/in_memory.rb",
|
|
316
|
-
"spec/rails3/config/environments/production.rb",
|
|
317
|
-
"spec/rails3/config/environments/test.rb",
|
|
318
|
-
"spec/rails3/config/initializers/backtrace_silencers.rb",
|
|
319
|
-
"spec/rails3/config/initializers/inflections.rb",
|
|
320
|
-
"spec/rails3/config/initializers/mime_types.rb",
|
|
321
|
-
"spec/rails3/config/initializers/secret_token.rb",
|
|
322
|
-
"spec/rails3/config/initializers/session_store.rb",
|
|
323
|
-
"spec/rails3/config/routes.rb",
|
|
324
|
-
"spec/rails3/db/migrate/activation/20101224223622_add_activation_to_users.rb",
|
|
325
|
-
"spec/rails3/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb",
|
|
326
|
-
"spec/rails3/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb",
|
|
327
|
-
"spec/rails3/db/migrate/core/20101224223620_create_users.rb",
|
|
328
|
-
"spec/rails3/db/migrate/external/20101224223628_create_authentications.rb",
|
|
329
|
-
"spec/rails3/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb",
|
|
330
|
-
"spec/rails3/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb",
|
|
331
|
-
"spec/rails3/db/schema.rb",
|
|
332
|
-
"spec/rails3/db/seeds.rb",
|
|
333
|
-
"spec/rails3/spec/controller_activity_logging_spec.rb",
|
|
334
|
-
"spec/rails3/spec/controller_brute_force_protection_spec.rb",
|
|
335
|
-
"spec/rails3/spec/controller_http_basic_auth_spec.rb",
|
|
336
|
-
"spec/rails3/spec/controller_oauth2_spec.rb",
|
|
337
|
-
"spec/rails3/spec/controller_oauth_spec.rb",
|
|
338
|
-
"spec/rails3/spec/controller_remember_me_spec.rb",
|
|
339
|
-
"spec/rails3/spec/controller_session_timeout_spec.rb",
|
|
340
|
-
"spec/rails3/spec/controller_spec.rb",
|
|
341
|
-
"spec/rails3/spec/integration_spec.rb",
|
|
342
|
-
"spec/rails3/spec/spec_helper.orig.rb",
|
|
343
|
-
"spec/rails3/spec/spec_helper.rb",
|
|
344
|
-
"spec/rails3/spec/user_activation_spec.rb",
|
|
345
|
-
"spec/rails3/spec/user_activity_logging_spec.rb",
|
|
346
|
-
"spec/rails3/spec/user_brute_force_protection_spec.rb",
|
|
347
|
-
"spec/rails3/spec/user_oauth_spec.rb",
|
|
348
|
-
"spec/rails3/spec/user_remember_me_spec.rb",
|
|
349
|
-
"spec/rails3/spec/user_reset_password_spec.rb",
|
|
350
|
-
"spec/rails3/spec/user_spec.rb",
|
|
351
|
-
"spec/rails3_mongo_mapper/app/controllers/application_controller.rb",
|
|
352
|
-
"spec/rails3_mongo_mapper/app/helpers/application_helper.rb",
|
|
353
|
-
"spec/rails3_mongo_mapper/app/mailers/sorcery_mailer.rb",
|
|
354
|
-
"spec/rails3_mongo_mapper/app/models/authentication.rb",
|
|
355
|
-
"spec/rails3_mongo_mapper/app/models/user.rb",
|
|
356
|
-
"spec/rails3_mongo_mapper/config/application.rb",
|
|
357
|
-
"spec/rails3_mongo_mapper/config/boot.rb",
|
|
358
|
-
"spec/rails3_mongo_mapper/config/environment.rb",
|
|
359
|
-
"spec/rails3_mongo_mapper/config/environments/development.rb",
|
|
360
|
-
"spec/rails3_mongo_mapper/config/environments/in_memory.rb",
|
|
361
|
-
"spec/rails3_mongo_mapper/config/environments/production.rb",
|
|
362
|
-
"spec/rails3_mongo_mapper/config/environments/test.rb",
|
|
363
|
-
"spec/rails3_mongo_mapper/config/initializers/backtrace_silencers.rb",
|
|
364
|
-
"spec/rails3_mongo_mapper/config/initializers/inflections.rb",
|
|
365
|
-
"spec/rails3_mongo_mapper/config/initializers/mime_types.rb",
|
|
366
|
-
"spec/rails3_mongo_mapper/config/initializers/mongo.rb",
|
|
367
|
-
"spec/rails3_mongo_mapper/config/initializers/secret_token.rb",
|
|
368
|
-
"spec/rails3_mongo_mapper/config/initializers/session_store.rb",
|
|
369
|
-
"spec/rails3_mongo_mapper/config/routes.rb",
|
|
370
|
-
"spec/rails3_mongo_mapper/db/schema.rb",
|
|
371
|
-
"spec/rails3_mongo_mapper/db/seeds.rb",
|
|
372
|
-
"spec/rails3_mongo_mapper/spec/controller_spec.rb",
|
|
373
|
-
"spec/rails3_mongo_mapper/spec/spec_helper.orig.rb",
|
|
374
|
-
"spec/rails3_mongo_mapper/spec/spec_helper.rb",
|
|
375
|
-
"spec/rails3_mongo_mapper/spec/user_activation_spec.rb",
|
|
376
|
-
"spec/rails3_mongo_mapper/spec/user_activity_logging_spec.rb",
|
|
377
|
-
"spec/rails3_mongo_mapper/spec/user_brute_force_protection_spec.rb",
|
|
378
|
-
"spec/rails3_mongo_mapper/spec/user_oauth_spec.rb",
|
|
379
|
-
"spec/rails3_mongo_mapper/spec/user_remember_me_spec.rb",
|
|
380
|
-
"spec/rails3_mongo_mapper/spec/user_reset_password_spec.rb",
|
|
381
|
-
"spec/rails3_mongo_mapper/spec/user_spec.rb",
|
|
382
|
-
"spec/rails3_mongoid/app/controllers/application_controller.rb",
|
|
383
|
-
"spec/rails3_mongoid/app/helpers/application_helper.rb",
|
|
384
|
-
"spec/rails3_mongoid/app/mailers/sorcery_mailer.rb",
|
|
385
|
-
"spec/rails3_mongoid/app/models/authentication.rb",
|
|
386
|
-
"spec/rails3_mongoid/app/models/user.rb",
|
|
387
|
-
"spec/rails3_mongoid/config/application.rb",
|
|
388
|
-
"spec/rails3_mongoid/config/boot.rb",
|
|
389
|
-
"spec/rails3_mongoid/config/environment.rb",
|
|
390
|
-
"spec/rails3_mongoid/config/environments/development.rb",
|
|
391
|
-
"spec/rails3_mongoid/config/environments/in_memory.rb",
|
|
392
|
-
"spec/rails3_mongoid/config/environments/production.rb",
|
|
393
|
-
"spec/rails3_mongoid/config/environments/test.rb",
|
|
394
|
-
"spec/rails3_mongoid/config/initializers/backtrace_silencers.rb",
|
|
395
|
-
"spec/rails3_mongoid/config/initializers/inflections.rb",
|
|
396
|
-
"spec/rails3_mongoid/config/initializers/mime_types.rb",
|
|
397
|
-
"spec/rails3_mongoid/config/initializers/secret_token.rb",
|
|
398
|
-
"spec/rails3_mongoid/config/initializers/session_store.rb",
|
|
399
|
-
"spec/rails3_mongoid/config/routes.rb",
|
|
400
|
-
"spec/rails3_mongoid/db/schema.rb",
|
|
401
|
-
"spec/rails3_mongoid/db/seeds.rb",
|
|
402
|
-
"spec/rails3_mongoid/spec/controller_activity_logging_spec.rb",
|
|
403
|
-
"spec/rails3_mongoid/spec/controller_spec.rb",
|
|
404
|
-
"spec/rails3_mongoid/spec/spec_helper.orig.rb",
|
|
405
|
-
"spec/rails3_mongoid/spec/spec_helper.rb",
|
|
406
|
-
"spec/rails3_mongoid/spec/user_activation_spec.rb",
|
|
407
|
-
"spec/rails3_mongoid/spec/user_activity_logging_spec.rb",
|
|
408
|
-
"spec/rails3_mongoid/spec/user_brute_force_protection_spec.rb",
|
|
409
|
-
"spec/rails3_mongoid/spec/user_oauth_spec.rb",
|
|
410
|
-
"spec/rails3_mongoid/spec/user_remember_me_spec.rb",
|
|
411
|
-
"spec/rails3_mongoid/spec/user_reset_password_spec.rb",
|
|
412
|
-
"spec/rails3_mongoid/spec/user_spec.rb",
|
|
413
|
-
"spec/shared_examples/controller_oauth2_shared_examples.rb",
|
|
414
|
-
"spec/shared_examples/controller_oauth_shared_examples.rb",
|
|
415
|
-
"spec/shared_examples/user_activation_shared_examples.rb",
|
|
416
|
-
"spec/shared_examples/user_activity_logging_shared_examples.rb",
|
|
417
|
-
"spec/shared_examples/user_brute_force_protection_shared_examples.rb",
|
|
418
|
-
"spec/shared_examples/user_oauth_shared_examples.rb",
|
|
419
|
-
"spec/shared_examples/user_remember_me_shared_examples.rb",
|
|
420
|
-
"spec/shared_examples/user_reset_password_shared_examples.rb",
|
|
421
|
-
"spec/shared_examples/user_shared_examples.rb",
|
|
422
|
-
"spec/sorcery_crypto_providers_spec.rb",
|
|
423
|
-
"spec/spec_helper.rb"
|
|
424
|
-
]
|
|
425
309
|
|
|
426
310
|
if s.respond_to? :specification_version then
|
|
427
311
|
s.specification_version = 3
|
|
428
312
|
|
|
429
313
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
430
314
|
s.add_runtime_dependency(%q<oauth>, ["~> 0.4.4"])
|
|
431
|
-
s.add_runtime_dependency(%q<oauth2>, ["~> 0.
|
|
315
|
+
s.add_runtime_dependency(%q<oauth2>, ["~> 0.8.0"])
|
|
316
|
+
s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
|
|
317
|
+
s.add_development_dependency(%q<abstract>, [">= 1.0.0"])
|
|
432
318
|
s.add_development_dependency(%q<rails>, [">= 3.0.0"])
|
|
433
319
|
s.add_development_dependency(%q<json>, [">= 1.5.1"])
|
|
434
320
|
s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
|
|
@@ -436,16 +322,18 @@ Gem::Specification.new do |s|
|
|
|
436
322
|
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
|
|
437
323
|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
|
438
324
|
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
|
439
|
-
s.add_development_dependency(%q<bundler>, ["
|
|
440
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.
|
|
325
|
+
s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
|
|
326
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
|
441
327
|
s.add_development_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
442
328
|
s.add_development_dependency(%q<timecop>, [">= 0"])
|
|
443
|
-
s.
|
|
444
|
-
s.
|
|
445
|
-
s.
|
|
329
|
+
s.add_development_dependency(%q<capybara>, [">= 0"])
|
|
330
|
+
s.add_development_dependency(%q<mongo_mapper>, [">= 0"])
|
|
331
|
+
s.add_development_dependency(%q<mongoid>, ["~> 2.4.4"])
|
|
446
332
|
else
|
|
447
333
|
s.add_dependency(%q<oauth>, ["~> 0.4.4"])
|
|
448
|
-
s.add_dependency(%q<oauth2>, ["~> 0.
|
|
334
|
+
s.add_dependency(%q<oauth2>, ["~> 0.8.0"])
|
|
335
|
+
s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
|
|
336
|
+
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
|
449
337
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
|
450
338
|
s.add_dependency(%q<json>, [">= 1.5.1"])
|
|
451
339
|
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
|
|
@@ -453,17 +341,19 @@ Gem::Specification.new do |s|
|
|
|
453
341
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
|
454
342
|
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
|
455
343
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
|
456
|
-
s.add_dependency(%q<bundler>, ["
|
|
457
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
|
344
|
+
s.add_dependency(%q<bundler>, [">= 1.1.0"])
|
|
345
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
|
458
346
|
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
459
347
|
s.add_dependency(%q<timecop>, [">= 0"])
|
|
460
|
-
s.add_dependency(%q<
|
|
461
|
-
s.add_dependency(%q<
|
|
462
|
-
s.add_dependency(%q<
|
|
348
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
|
349
|
+
s.add_dependency(%q<mongo_mapper>, [">= 0"])
|
|
350
|
+
s.add_dependency(%q<mongoid>, ["~> 2.4.4"])
|
|
463
351
|
end
|
|
464
352
|
else
|
|
465
353
|
s.add_dependency(%q<oauth>, ["~> 0.4.4"])
|
|
466
|
-
s.add_dependency(%q<oauth2>, ["~> 0.
|
|
354
|
+
s.add_dependency(%q<oauth2>, ["~> 0.8.0"])
|
|
355
|
+
s.add_dependency(%q<bcrypt-ruby>, ["~> 3.0.0"])
|
|
356
|
+
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
|
467
357
|
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
|
468
358
|
s.add_dependency(%q<json>, [">= 1.5.1"])
|
|
469
359
|
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
|
|
@@ -471,13 +361,13 @@ Gem::Specification.new do |s|
|
|
|
471
361
|
s.add_dependency(%q<ruby-debug19>, [">= 0"])
|
|
472
362
|
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
|
473
363
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
|
474
|
-
s.add_dependency(%q<bundler>, ["
|
|
475
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
|
364
|
+
s.add_dependency(%q<bundler>, [">= 1.1.0"])
|
|
365
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
|
476
366
|
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
|
477
367
|
s.add_dependency(%q<timecop>, [">= 0"])
|
|
478
|
-
s.add_dependency(%q<
|
|
479
|
-
s.add_dependency(%q<
|
|
480
|
-
s.add_dependency(%q<
|
|
368
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
|
369
|
+
s.add_dependency(%q<mongo_mapper>, [">= 0"])
|
|
370
|
+
s.add_dependency(%q<mongoid>, ["~> 2.4.4"])
|
|
481
371
|
end
|
|
482
372
|
end
|
|
483
373
|
|
data/spec/Gemfile
CHANGED
data/spec/Gemfile.lock
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.7.
|
|
4
|
+
sorcery (0.7.13)
|
|
5
5
|
bcrypt-ruby (~> 3.0.0)
|
|
6
6
|
oauth (~> 0.4.4)
|
|
7
|
-
|
|
8
|
-
oauth2 (~> 0.5.1)
|
|
9
|
-
oauth2 (~> 0.5.1)
|
|
7
|
+
oauth2 (~> 0.8.0)
|
|
10
8
|
|
|
11
9
|
GEM
|
|
12
10
|
remote: http://rubygems.org/
|
|
@@ -38,20 +36,20 @@ GEM
|
|
|
38
36
|
activemodel (= 3.0.3)
|
|
39
37
|
activesupport (= 3.0.3)
|
|
40
38
|
activesupport (3.0.3)
|
|
41
|
-
addressable (2.2.6)
|
|
42
39
|
archive-tar-minitar (0.5.2)
|
|
43
40
|
arel (2.0.10)
|
|
44
41
|
bcrypt-ruby (3.0.1)
|
|
45
42
|
builder (2.1.2)
|
|
46
|
-
columnize (0.3.
|
|
43
|
+
columnize (0.3.6)
|
|
47
44
|
diff-lcs (1.1.3)
|
|
48
45
|
erubis (2.6.6)
|
|
49
46
|
abstract (>= 1.0.0)
|
|
50
|
-
faraday (0.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
rack (>= 1.1.0, < 2)
|
|
47
|
+
faraday (0.8.4)
|
|
48
|
+
multipart-post (~> 1.1)
|
|
49
|
+
httpauth (0.2.0)
|
|
54
50
|
i18n (0.6.0)
|
|
51
|
+
jwt (0.1.5)
|
|
52
|
+
multi_json (>= 1.0)
|
|
55
53
|
linecache19 (0.5.12)
|
|
56
54
|
ruby_core_source (>= 0.1.4)
|
|
57
55
|
mail (2.2.19)
|
|
@@ -60,14 +58,17 @@ GEM
|
|
|
60
58
|
mime-types (~> 1.16)
|
|
61
59
|
treetop (~> 1.4.8)
|
|
62
60
|
mime-types (1.17.2)
|
|
63
|
-
multi_json (1.0
|
|
64
|
-
multipart-post (1.1.
|
|
61
|
+
multi_json (1.1.0)
|
|
62
|
+
multipart-post (1.1.5)
|
|
65
63
|
oauth (0.4.5)
|
|
66
|
-
oauth2 (0.
|
|
67
|
-
faraday (~> 0.
|
|
68
|
-
|
|
64
|
+
oauth2 (0.8.0)
|
|
65
|
+
faraday (~> 0.8)
|
|
66
|
+
httpauth (~> 0.1)
|
|
67
|
+
jwt (~> 0.1.4)
|
|
68
|
+
multi_json (~> 1.0)
|
|
69
|
+
rack (~> 1.2)
|
|
69
70
|
polyglot (0.3.3)
|
|
70
|
-
rack (1.2.
|
|
71
|
+
rack (1.2.5)
|
|
71
72
|
rack-mount (0.6.14)
|
|
72
73
|
rack (>= 1.0.0)
|
|
73
74
|
rack-test (0.5.7)
|
|
@@ -104,8 +105,8 @@ GEM
|
|
|
104
105
|
ruby-debug-base19 (>= 0.11.19)
|
|
105
106
|
ruby_core_source (0.1.5)
|
|
106
107
|
archive-tar-minitar (>= 0.5.2)
|
|
107
|
-
simplecov (0.
|
|
108
|
-
multi_json (~> 1.0
|
|
108
|
+
simplecov (0.6.1)
|
|
109
|
+
multi_json (~> 1.0)
|
|
109
110
|
simplecov-html (~> 0.5.3)
|
|
110
111
|
simplecov-html (0.5.3)
|
|
111
112
|
thor (0.14.6)
|
|
@@ -120,7 +121,7 @@ PLATFORMS
|
|
|
120
121
|
DEPENDENCIES
|
|
121
122
|
bcrypt-ruby
|
|
122
123
|
oauth (~> 0.4.4)
|
|
123
|
-
oauth2 (~> 0.
|
|
124
|
+
oauth2 (~> 0.8.0)
|
|
124
125
|
rails (= 3.0.3)
|
|
125
126
|
rspec (~> 2.5.0)
|
|
126
127
|
ruby-debug19
|
data/spec/README.md
CHANGED
|
@@ -7,25 +7,25 @@ Each sample app runs a set of shared specs ( `spec/shared_examples/*_example.rb`
|
|
|
7
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
8
|
|
|
9
9
|
cd spec/
|
|
10
|
-
bundle
|
|
11
|
-
rake spec
|
|
10
|
+
bundle
|
|
11
|
+
bundle exec rake spec
|
|
12
12
|
|
|
13
13
|
Running Framework Specs
|
|
14
14
|
-----------------------
|
|
15
15
|
To run framework specs, cd into each directory, bundle, and run the specs. For example, to run the rails3 specs you would:
|
|
16
16
|
|
|
17
17
|
cd spec/rails3/
|
|
18
|
-
bundle
|
|
19
|
-
rake spec
|
|
18
|
+
bundle
|
|
19
|
+
bundle exec rake spec
|
|
20
20
|
|
|
21
21
|
**Note:** the rails3_mongoid and rails3_mongo_mapper sample apps do 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
22
|
|
|
23
23
|
cd spec/rails3_mongoid
|
|
24
|
-
bundle
|
|
24
|
+
bundle
|
|
25
25
|
mongod -v &
|
|
26
|
-
rake spec
|
|
26
|
+
bundle exec rake spec
|
|
27
27
|
|
|
28
28
|
cd spec/rails3_mongo_mapper
|
|
29
|
-
bundle
|
|
29
|
+
bundle
|
|
30
30
|
mongod -v &
|
|
31
|
-
rake spec
|
|
31
|
+
bundle exec rake spec
|
data/spec/rails3/Gemfile
CHANGED
data/spec/rails3/Gemfile.lock
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../
|
|
3
3
|
specs:
|
|
4
|
-
sorcery (0.7.
|
|
4
|
+
sorcery (0.7.13)
|
|
5
5
|
bcrypt-ruby (~> 3.0.0)
|
|
6
6
|
oauth (~> 0.4.4)
|
|
7
|
-
|
|
8
|
-
oauth2 (~> 0.5.1)
|
|
9
|
-
oauth2 (~> 0.5.1)
|
|
7
|
+
oauth2 (~> 0.8.0)
|
|
10
8
|
|
|
11
9
|
GEM
|
|
12
10
|
remote: http://rubygems.org/
|
|
@@ -38,7 +36,7 @@ GEM
|
|
|
38
36
|
activemodel (= 3.0.3)
|
|
39
37
|
activesupport (= 3.0.3)
|
|
40
38
|
activesupport (3.0.3)
|
|
41
|
-
addressable (2.2.
|
|
39
|
+
addressable (2.2.7)
|
|
42
40
|
archive-tar-minitar (0.5.2)
|
|
43
41
|
arel (2.0.10)
|
|
44
42
|
bcrypt-ruby (3.0.1)
|
|
@@ -50,18 +48,19 @@ GEM
|
|
|
50
48
|
rack-test (>= 0.5.4)
|
|
51
49
|
selenium-webdriver (~> 2.0)
|
|
52
50
|
xpath (~> 0.1.4)
|
|
53
|
-
childprocess (0.
|
|
51
|
+
childprocess (0.3.1)
|
|
54
52
|
ffi (~> 1.0.6)
|
|
55
53
|
columnize (0.3.6)
|
|
56
54
|
diff-lcs (1.1.3)
|
|
57
55
|
erubis (2.6.6)
|
|
58
56
|
abstract (>= 1.0.0)
|
|
59
|
-
faraday (0.
|
|
60
|
-
|
|
61
|
-
multipart-post (~> 1.1.3)
|
|
62
|
-
rack (>= 1.1.0, < 2)
|
|
57
|
+
faraday (0.8.4)
|
|
58
|
+
multipart-post (~> 1.1)
|
|
63
59
|
ffi (1.0.11)
|
|
60
|
+
httpauth (0.2.0)
|
|
64
61
|
i18n (0.6.0)
|
|
62
|
+
jwt (0.1.5)
|
|
63
|
+
multi_json (>= 1.0)
|
|
65
64
|
launchy (2.0.5)
|
|
66
65
|
addressable (~> 2.2.6)
|
|
67
66
|
linecache19 (0.5.12)
|
|
@@ -72,15 +71,18 @@ GEM
|
|
|
72
71
|
mime-types (~> 1.16)
|
|
73
72
|
treetop (~> 1.4.8)
|
|
74
73
|
mime-types (1.17.2)
|
|
75
|
-
multi_json (1.0
|
|
76
|
-
multipart-post (1.1.
|
|
74
|
+
multi_json (1.1.0)
|
|
75
|
+
multipart-post (1.1.5)
|
|
77
76
|
nokogiri (1.5.0)
|
|
78
|
-
oauth (0.4.
|
|
79
|
-
oauth2 (0.
|
|
80
|
-
faraday (~> 0.
|
|
81
|
-
|
|
77
|
+
oauth (0.4.7)
|
|
78
|
+
oauth2 (0.8.0)
|
|
79
|
+
faraday (~> 0.8)
|
|
80
|
+
httpauth (~> 0.1)
|
|
81
|
+
jwt (~> 0.1.4)
|
|
82
|
+
multi_json (~> 1.0)
|
|
83
|
+
rack (~> 1.2)
|
|
82
84
|
polyglot (0.3.3)
|
|
83
|
-
rack (1.2.
|
|
85
|
+
rack (1.2.5)
|
|
84
86
|
rack-mount (0.6.14)
|
|
85
87
|
rack (>= 1.0.0)
|
|
86
88
|
rack-test (0.5.7)
|
|
@@ -122,14 +124,14 @@ GEM
|
|
|
122
124
|
ruby-debug-base19 (>= 0.11.19)
|
|
123
125
|
ruby_core_source (0.1.5)
|
|
124
126
|
archive-tar-minitar (>= 0.5.2)
|
|
125
|
-
rubyzip (0.9.
|
|
126
|
-
selenium-webdriver (2.
|
|
127
|
-
childprocess (>= 0.2.
|
|
128
|
-
ffi (~> 1.0
|
|
129
|
-
multi_json (~> 1.0
|
|
127
|
+
rubyzip (0.9.6.1)
|
|
128
|
+
selenium-webdriver (2.20.0)
|
|
129
|
+
childprocess (>= 0.2.5)
|
|
130
|
+
ffi (~> 1.0)
|
|
131
|
+
multi_json (~> 1.0)
|
|
130
132
|
rubyzip
|
|
131
|
-
simplecov (0.
|
|
132
|
-
multi_json (~> 1.0
|
|
133
|
+
simplecov (0.6.1)
|
|
134
|
+
multi_json (~> 1.0)
|
|
133
135
|
simplecov-html (~> 0.5.3)
|
|
134
136
|
simplecov-html (0.5.3)
|
|
135
137
|
sqlite3 (1.3.5)
|
|
@@ -148,6 +150,7 @@ PLATFORMS
|
|
|
148
150
|
ruby
|
|
149
151
|
|
|
150
152
|
DEPENDENCIES
|
|
153
|
+
bcrypt-ruby (~> 3.0.0)
|
|
151
154
|
capybara (~> 1.1.1)
|
|
152
155
|
launchy (~> 2.0.5)
|
|
153
156
|
rails (= 3.0.3)
|
|
@@ -137,6 +137,46 @@ class ApplicationController < ActionController::Base
|
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
+
def test_return_to_with_external
|
|
141
|
+
if @user = login_from(:twitter)
|
|
142
|
+
redirect_back_or_to "bla", :notice => "Success!"
|
|
143
|
+
else
|
|
144
|
+
redirect_to "blu", :alert => "Failed!"
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def test_return_to_with_external2
|
|
149
|
+
if @user = login_from(:facebook)
|
|
150
|
+
redirect_back_or_to "bla", :notice => "Success!"
|
|
151
|
+
else
|
|
152
|
+
redirect_to "blu", :alert => "Failed!"
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def test_return_to_with_external3
|
|
157
|
+
if @user = login_from(:github)
|
|
158
|
+
redirect_back_or_to "bla", :notice => "Success!"
|
|
159
|
+
else
|
|
160
|
+
redirect_to "blu", :alert => "Failed!"
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def test_return_to_with_external4
|
|
165
|
+
if @user = login_from(:google)
|
|
166
|
+
redirect_back_or_to "bla", :notice => "Success!"
|
|
167
|
+
else
|
|
168
|
+
redirect_to "blu", :alert => "Failed!"
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def test_return_to_with_external5
|
|
173
|
+
if @user = login_from(:liveid)
|
|
174
|
+
redirect_back_or_to "bla", :notice => "Success!"
|
|
175
|
+
else
|
|
176
|
+
redirect_to "blu", :alert => "Failed!"
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
140
180
|
def test_create_from_provider
|
|
141
181
|
provider = params[:provider]
|
|
142
182
|
login_from(provider)
|
|
@@ -146,6 +186,20 @@ class ApplicationController < ActionController::Base
|
|
|
146
186
|
redirect_to "blu", :alert => "Failed!"
|
|
147
187
|
end
|
|
148
188
|
end
|
|
189
|
+
|
|
190
|
+
def test_create_from_provider_with_block
|
|
191
|
+
provider = params[:provider]
|
|
192
|
+
login_from(provider)
|
|
193
|
+
@user = create_from(provider) do |user|
|
|
194
|
+
# check uniqueness of username
|
|
195
|
+
User.where(:username => user.username).empty?
|
|
196
|
+
end
|
|
197
|
+
if @user
|
|
198
|
+
redirect_to "bla", :notice => "Success!"
|
|
199
|
+
else
|
|
200
|
+
redirect_to "blu", :alert => "Failed!"
|
|
201
|
+
end
|
|
202
|
+
end
|
|
149
203
|
|
|
150
204
|
protected
|
|
151
205
|
|
|
@@ -22,4 +22,11 @@ class SorceryMailer < ActionMailer::Base
|
|
|
22
22
|
mail(:to => user.email,
|
|
23
23
|
:subject => "Your password has been reset")
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
def send_unlock_token_email(user)
|
|
27
|
+
@user = user
|
|
28
|
+
@url = "http://example.com/unlock/#{user.unlock_token}"
|
|
29
|
+
mail(:to => user.email,
|
|
30
|
+
:subject => "Your account has been locked due to many wrong logins")
|
|
31
|
+
end
|
|
25
32
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Please visit <% @url %> for unlock your account.
|
|
@@ -2,9 +2,11 @@ class AddBruteForceProtectionToUsers < ActiveRecord::Migration
|
|
|
2
2
|
def self.up
|
|
3
3
|
add_column :users, :failed_logins_count, :integer, :default => 0
|
|
4
4
|
add_column :users, :lock_expires_at, :datetime, :default => nil
|
|
5
|
+
add_column :users, :unlock_token, :string, :default => nil
|
|
5
6
|
end
|
|
6
7
|
|
|
7
8
|
def self.down
|
|
9
|
+
remove_column :users, :unlock_token
|
|
8
10
|
remove_column :users, :lock_expires_at
|
|
9
11
|
remove_column :users, :failed_logins_count
|
|
10
12
|
end
|
|
@@ -7,6 +7,9 @@ describe ApplicationController do
|
|
|
7
7
|
|
|
8
8
|
after(:all) do
|
|
9
9
|
ActiveRecord::Migrator.rollback("#{Rails.root}/db/migrate/activity_logging")
|
|
10
|
+
sorcery_controller_property_set(:register_login_time, true)
|
|
11
|
+
sorcery_controller_property_set(:register_logout_time, true)
|
|
12
|
+
sorcery_controller_property_set(:register_last_activity_time, true)
|
|
10
13
|
end
|
|
11
14
|
|
|
12
15
|
# ----------------- ACTIVITY LOGGING -----------------------
|
|
@@ -21,12 +21,34 @@ describe ApplicationController do
|
|
|
21
21
|
sorcery_controller_property_set(:user_class, User)
|
|
22
22
|
Timecop.return
|
|
23
23
|
end
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
it "should count login retries" do
|
|
26
26
|
3.times {get :test_login, :username => 'gizmo', :password => 'blabla'}
|
|
27
27
|
User.find_by_username('gizmo').failed_logins_count.should == 3
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
it "should generate unlock token after user locked" do
|
|
31
|
+
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 2)
|
|
32
|
+
sorcery_model_property_set(:login_lock_time_period, 0)
|
|
33
|
+
sorcery_model_property_set(:unlock_token_mailer, SorceryMailer)
|
|
34
|
+
3.times {get :test_login, :username => "gizmo", :password => "blabla"}
|
|
35
|
+
User.find_by_username('gizmo').unlock_token.should_not be_nil
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should unlock after entering unlock token" do
|
|
39
|
+
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 2)
|
|
40
|
+
sorcery_model_property_set(:login_lock_time_period, 0)
|
|
41
|
+
sorcery_model_property_set(:unlock_token_mailer, SorceryMailer)
|
|
42
|
+
3.times {get :test_login, :username => "gizmo", :password => "blabla"}
|
|
43
|
+
User.find_by_username('gizmo').unlock_token.should_not be_nil
|
|
44
|
+
token = User.find_by_username('gizmo').unlock_token
|
|
45
|
+
user = User.load_from_unlock_token(token)
|
|
46
|
+
user.should_not be_nil
|
|
47
|
+
user.unlock!
|
|
48
|
+
User.load_from_unlock_token(token).should be_nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
30
52
|
it "should reset the counter on a good login" do
|
|
31
53
|
sorcery_model_property_set(:consecutive_login_retries_amount_limit, 5)
|
|
32
54
|
3.times {get :test_login, :username => 'gizmo', :password => 'blabla'}
|