sorcery 0.5.0 → 0.6.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/README.rdoc +9 -1
- data/VERSION +1 -1
- data/lib/sorcery/controller/adapters/sinatra.rb +35 -28
- data/lib/sorcery/controller/submodules/activity_logging.rb +11 -7
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +8 -5
- data/lib/sorcery/controller/submodules/external.rb +11 -6
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +12 -7
- data/lib/sorcery/controller/submodules/remember_me.rb +14 -5
- data/lib/sorcery/controller/submodules/session_timeout.rb +3 -1
- data/lib/sorcery/controller.rb +12 -9
- data/lib/sorcery/crypto_providers/aes256.rb +8 -5
- data/lib/sorcery/crypto_providers/bcrypt.rb +12 -6
- data/lib/sorcery/crypto_providers/sha256.rb +2 -1
- data/lib/sorcery/crypto_providers/sha512.rb +2 -1
- data/lib/sorcery/engine.rb +0 -7
- data/lib/sorcery/initializers/initializer.rb +127 -36
- data/lib/sorcery/model/adapters/active_record.rb +2 -2
- data/lib/sorcery/model/adapters/mongoid.rb +12 -7
- data/lib/sorcery/model/submodules/activity_logging.rb +7 -6
- data/lib/sorcery/model/submodules/brute_force_protection.rb +10 -6
- data/lib/sorcery/model/submodules/external.rb +4 -2
- data/lib/sorcery/model/submodules/remember_me.rb +4 -3
- data/lib/sorcery/model/submodules/reset_password.rb +21 -11
- data/lib/sorcery/model/submodules/user_activation.rb +23 -10
- data/lib/sorcery/model/temporary_token.rb +3 -2
- data/lib/sorcery/model.rb +60 -29
- data/lib/sorcery/test_helpers/internal/rails.rb +6 -1
- data/lib/sorcery/test_helpers/internal/sinatra.rb +3 -3
- data/lib/sorcery/test_helpers/internal/sinatra_modular.rb +74 -0
- data/lib/sorcery/test_helpers/internal.rb +2 -1
- data/lib/sorcery.rb +3 -5
- data/sorcery.gemspec +72 -2
- data/spec/Gemfile.lock +1 -4
- data/spec/rails3/Gemfile.lock +1 -4
- data/spec/rails3/spec/controller_oauth2_spec.rb +3 -24
- data/spec/rails3/spec/controller_oauth_spec.rb +3 -24
- data/spec/rails3/spec/controller_spec.rb +2 -2
- data/spec/rails3/spec/user_activation_spec.rb +2 -168
- data/spec/rails3/spec/user_activity_logging_spec.rb +2 -30
- data/spec/rails3/spec/user_brute_force_protection_spec.rb +2 -35
- data/spec/rails3/spec/user_oauth_spec.rb +2 -26
- data/spec/rails3/spec/user_remember_me_spec.rb +2 -45
- data/spec/rails3/spec/user_reset_password_spec.rb +3 -168
- data/spec/rails3/spec/user_spec.rb +3 -293
- data/spec/rails3_mongoid/Gemfile.lock +1 -4
- data/spec/rails3_mongoid/app/models/authentication.rb +3 -3
- data/spec/rails3_mongoid/spec/user_activation_spec.rb +2 -171
- data/spec/rails3_mongoid/spec/user_activity_logging_spec.rb +2 -25
- data/spec/rails3_mongoid/spec/user_brute_force_protection_spec.rb +2 -35
- data/spec/rails3_mongoid/spec/user_oauth_spec.rb +2 -28
- data/spec/rails3_mongoid/spec/user_remember_me_spec.rb +2 -45
- data/spec/rails3_mongoid/spec/user_reset_password_spec.rb +2 -168
- data/spec/rails3_mongoid/spec/user_spec.rb +3 -295
- data/spec/shared_examples/controller_oauth2_shared_examples.rb +37 -0
- data/spec/shared_examples/controller_oauth_shared_examples.rb +37 -0
- data/spec/shared_examples/user_activation_shared_examples.rb +173 -0
- data/spec/shared_examples/user_activity_logging_shared_examples.rb +27 -0
- data/spec/shared_examples/user_brute_force_protection_shared_examples.rb +37 -0
- data/spec/shared_examples/user_oauth_shared_examples.rb +31 -0
- data/spec/shared_examples/user_remember_me_shared_examples.rb +47 -0
- data/spec/shared_examples/user_reset_password_shared_examples.rb +177 -0
- data/spec/shared_examples/user_shared_examples.rb +292 -0
- data/spec/sinatra/Gemfile +3 -0
- data/spec/sinatra/Gemfile.lock +17 -34
- data/spec/sinatra/Rakefile +1 -1
- data/spec/sinatra/filters.rb +20 -14
- data/spec/sinatra/modular.rb +157 -0
- data/spec/sinatra/spec/controller_oauth2_spec.rb +3 -24
- data/spec/sinatra/spec/controller_oauth_spec.rb +3 -24
- data/spec/sinatra/spec/controller_spec.rb +2 -2
- data/spec/sinatra_modular/Gemfile +15 -0
- data/spec/sinatra_modular/Gemfile.lock +117 -0
- data/spec/sinatra_modular/Rakefile +11 -0
- data/spec/sinatra_modular/authentication.rb +3 -0
- data/spec/sinatra_modular/db/migrate/activation/20101224223622_add_activation_to_users.rb +17 -0
- data/spec/sinatra_modular/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +17 -0
- data/spec/sinatra_modular/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +11 -0
- data/spec/sinatra_modular/db/migrate/core/20101224223620_create_users.rb +16 -0
- data/spec/sinatra_modular/db/migrate/external/20101224223628_create_authentications.rb +14 -0
- data/spec/sinatra_modular/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +15 -0
- data/spec/sinatra_modular/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +13 -0
- data/spec/sinatra_modular/filters.rb +27 -0
- data/spec/sinatra_modular/modular.rb +157 -0
- data/spec/sinatra_modular/myapp.rb +133 -0
- data/spec/sinatra_modular/sorcery_mailer.rb +25 -0
- data/spec/sinatra_modular/spec_modular/controller_activity_logging_spec.rb +85 -0
- data/spec/sinatra_modular/spec_modular/controller_brute_force_protection_spec.rb +70 -0
- data/spec/sinatra_modular/spec_modular/controller_http_basic_auth_spec.rb +53 -0
- data/spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb +99 -0
- data/spec/sinatra_modular/spec_modular/controller_oauth_spec.rb +100 -0
- data/spec/sinatra_modular/spec_modular/controller_remember_me_spec.rb +64 -0
- data/spec/sinatra_modular/spec_modular/controller_session_timeout_spec.rb +57 -0
- data/spec/sinatra_modular/spec_modular/controller_spec.rb +116 -0
- data/spec/sinatra_modular/spec_modular/spec.opts +2 -0
- data/spec/sinatra_modular/spec_modular/spec_helper.rb +51 -0
- data/spec/sinatra_modular/user.rb +6 -0
- data/spec/sinatra_modular/views/test_login.erb +4 -0
- metadata +72 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'modular.rb')
|
|
2
|
+
$: << APP_ROOT # for model reloading
|
|
3
|
+
|
|
4
|
+
require 'rack/test'
|
|
5
|
+
require 'rspec'
|
|
6
|
+
require 'timecop'
|
|
7
|
+
|
|
8
|
+
# set test environment
|
|
9
|
+
Modular.class_eval do
|
|
10
|
+
set :environment, :test
|
|
11
|
+
set :run, false
|
|
12
|
+
set :raise_errors, true
|
|
13
|
+
set :logging, false
|
|
14
|
+
set :lock, true
|
|
15
|
+
set :show_exceptions, true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
module RSpecMixinExample
|
|
20
|
+
include Rack::Test::Methods
|
|
21
|
+
|
|
22
|
+
def app
|
|
23
|
+
@app ||= Modular
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Rspec.configure do |config|
|
|
28
|
+
config.send(:include, RSpecMixinExample)
|
|
29
|
+
config.send(:include, ::Sorcery::TestHelpers::Internal)
|
|
30
|
+
config.send(:include, ::Sorcery::TestHelpers::Internal::SinatraModular)
|
|
31
|
+
config.before(:suite) do
|
|
32
|
+
ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/core")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
config.after(:suite) do
|
|
36
|
+
ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/core")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# needed when running individual specs
|
|
42
|
+
require File.join(File.dirname(__FILE__), '..', 'user')
|
|
43
|
+
require File.join(File.dirname(__FILE__), '..', 'authentication')
|
|
44
|
+
|
|
45
|
+
class TestUser < ActiveRecord::Base
|
|
46
|
+
authenticates_with_sorcery!
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class TestMailer < ActionMailer::Base
|
|
50
|
+
|
|
51
|
+
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: sorcery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.6.0
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Noam Ben Ari
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-
|
|
13
|
+
date: 2011-07-30 00:00:00 +03:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -275,6 +275,7 @@ files:
|
|
|
275
275
|
- lib/sorcery/test_helpers/internal.rb
|
|
276
276
|
- lib/sorcery/test_helpers/internal/rails.rb
|
|
277
277
|
- lib/sorcery/test_helpers/internal/sinatra.rb
|
|
278
|
+
- lib/sorcery/test_helpers/internal/sinatra_modular.rb
|
|
278
279
|
- lib/sorcery/test_helpers/rails.rb
|
|
279
280
|
- lib/sorcery/test_helpers/sinatra.rb
|
|
280
281
|
- sorcery.gemspec
|
|
@@ -421,6 +422,15 @@ files:
|
|
|
421
422
|
- spec/rails3_mongoid/spec/user_reset_password_spec.rb
|
|
422
423
|
- spec/rails3_mongoid/spec/user_spec.rb
|
|
423
424
|
- spec/rails3_mongoid/vendor/plugins/.gitkeep
|
|
425
|
+
- spec/shared_examples/controller_oauth2_shared_examples.rb
|
|
426
|
+
- spec/shared_examples/controller_oauth_shared_examples.rb
|
|
427
|
+
- spec/shared_examples/user_activation_shared_examples.rb
|
|
428
|
+
- spec/shared_examples/user_activity_logging_shared_examples.rb
|
|
429
|
+
- spec/shared_examples/user_brute_force_protection_shared_examples.rb
|
|
430
|
+
- spec/shared_examples/user_oauth_shared_examples.rb
|
|
431
|
+
- spec/shared_examples/user_remember_me_shared_examples.rb
|
|
432
|
+
- spec/shared_examples/user_reset_password_shared_examples.rb
|
|
433
|
+
- spec/shared_examples/user_shared_examples.rb
|
|
424
434
|
- spec/sinatra/Gemfile
|
|
425
435
|
- spec/sinatra/Gemfile.lock
|
|
426
436
|
- spec/sinatra/Rakefile
|
|
@@ -433,6 +443,7 @@ files:
|
|
|
433
443
|
- spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
|
|
434
444
|
- spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
|
|
435
445
|
- spec/sinatra/filters.rb
|
|
446
|
+
- spec/sinatra/modular.rb
|
|
436
447
|
- spec/sinatra/myapp.rb
|
|
437
448
|
- spec/sinatra/sorcery_mailer.rb
|
|
438
449
|
- spec/sinatra/spec/controller_activity_logging_spec.rb
|
|
@@ -447,6 +458,33 @@ files:
|
|
|
447
458
|
- spec/sinatra/spec/spec_helper.rb
|
|
448
459
|
- spec/sinatra/user.rb
|
|
449
460
|
- spec/sinatra/views/test_login.erb
|
|
461
|
+
- spec/sinatra_modular/Gemfile
|
|
462
|
+
- spec/sinatra_modular/Gemfile.lock
|
|
463
|
+
- spec/sinatra_modular/Rakefile
|
|
464
|
+
- spec/sinatra_modular/authentication.rb
|
|
465
|
+
- spec/sinatra_modular/db/migrate/activation/20101224223622_add_activation_to_users.rb
|
|
466
|
+
- spec/sinatra_modular/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
|
|
467
|
+
- spec/sinatra_modular/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
|
|
468
|
+
- spec/sinatra_modular/db/migrate/core/20101224223620_create_users.rb
|
|
469
|
+
- spec/sinatra_modular/db/migrate/external/20101224223628_create_authentications.rb
|
|
470
|
+
- spec/sinatra_modular/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
|
|
471
|
+
- spec/sinatra_modular/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
|
|
472
|
+
- spec/sinatra_modular/filters.rb
|
|
473
|
+
- spec/sinatra_modular/modular.rb
|
|
474
|
+
- spec/sinatra_modular/myapp.rb
|
|
475
|
+
- spec/sinatra_modular/sorcery_mailer.rb
|
|
476
|
+
- spec/sinatra_modular/spec_modular/controller_activity_logging_spec.rb
|
|
477
|
+
- spec/sinatra_modular/spec_modular/controller_brute_force_protection_spec.rb
|
|
478
|
+
- spec/sinatra_modular/spec_modular/controller_http_basic_auth_spec.rb
|
|
479
|
+
- spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb
|
|
480
|
+
- spec/sinatra_modular/spec_modular/controller_oauth_spec.rb
|
|
481
|
+
- spec/sinatra_modular/spec_modular/controller_remember_me_spec.rb
|
|
482
|
+
- spec/sinatra_modular/spec_modular/controller_session_timeout_spec.rb
|
|
483
|
+
- spec/sinatra_modular/spec_modular/controller_spec.rb
|
|
484
|
+
- spec/sinatra_modular/spec_modular/spec.opts
|
|
485
|
+
- spec/sinatra_modular/spec_modular/spec_helper.rb
|
|
486
|
+
- spec/sinatra_modular/user.rb
|
|
487
|
+
- spec/sinatra_modular/views/test_login.erb
|
|
450
488
|
- spec/sorcery_crypto_providers_spec.rb
|
|
451
489
|
- spec/spec.opts
|
|
452
490
|
- spec/spec_helper.rb
|
|
@@ -552,6 +590,15 @@ test_files:
|
|
|
552
590
|
- spec/rails3_mongoid/spec/user_remember_me_spec.rb
|
|
553
591
|
- spec/rails3_mongoid/spec/user_reset_password_spec.rb
|
|
554
592
|
- spec/rails3_mongoid/spec/user_spec.rb
|
|
593
|
+
- spec/shared_examples/controller_oauth2_shared_examples.rb
|
|
594
|
+
- spec/shared_examples/controller_oauth_shared_examples.rb
|
|
595
|
+
- spec/shared_examples/user_activation_shared_examples.rb
|
|
596
|
+
- spec/shared_examples/user_activity_logging_shared_examples.rb
|
|
597
|
+
- spec/shared_examples/user_brute_force_protection_shared_examples.rb
|
|
598
|
+
- spec/shared_examples/user_oauth_shared_examples.rb
|
|
599
|
+
- spec/shared_examples/user_remember_me_shared_examples.rb
|
|
600
|
+
- spec/shared_examples/user_reset_password_shared_examples.rb
|
|
601
|
+
- spec/shared_examples/user_shared_examples.rb
|
|
555
602
|
- spec/sinatra/authentication.rb
|
|
556
603
|
- spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb
|
|
557
604
|
- spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
|
|
@@ -561,6 +608,7 @@ test_files:
|
|
|
561
608
|
- spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
|
|
562
609
|
- spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
|
|
563
610
|
- spec/sinatra/filters.rb
|
|
611
|
+
- spec/sinatra/modular.rb
|
|
564
612
|
- spec/sinatra/myapp.rb
|
|
565
613
|
- spec/sinatra/sorcery_mailer.rb
|
|
566
614
|
- spec/sinatra/spec/controller_activity_logging_spec.rb
|
|
@@ -573,5 +621,27 @@ test_files:
|
|
|
573
621
|
- spec/sinatra/spec/controller_spec.rb
|
|
574
622
|
- spec/sinatra/spec/spec_helper.rb
|
|
575
623
|
- spec/sinatra/user.rb
|
|
624
|
+
- spec/sinatra_modular/authentication.rb
|
|
625
|
+
- spec/sinatra_modular/db/migrate/activation/20101224223622_add_activation_to_users.rb
|
|
626
|
+
- spec/sinatra_modular/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
|
|
627
|
+
- spec/sinatra_modular/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
|
|
628
|
+
- spec/sinatra_modular/db/migrate/core/20101224223620_create_users.rb
|
|
629
|
+
- spec/sinatra_modular/db/migrate/external/20101224223628_create_authentications.rb
|
|
630
|
+
- spec/sinatra_modular/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
|
|
631
|
+
- spec/sinatra_modular/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
|
|
632
|
+
- spec/sinatra_modular/filters.rb
|
|
633
|
+
- spec/sinatra_modular/modular.rb
|
|
634
|
+
- spec/sinatra_modular/myapp.rb
|
|
635
|
+
- spec/sinatra_modular/sorcery_mailer.rb
|
|
636
|
+
- spec/sinatra_modular/spec_modular/controller_activity_logging_spec.rb
|
|
637
|
+
- spec/sinatra_modular/spec_modular/controller_brute_force_protection_spec.rb
|
|
638
|
+
- spec/sinatra_modular/spec_modular/controller_http_basic_auth_spec.rb
|
|
639
|
+
- spec/sinatra_modular/spec_modular/controller_oauth2_spec.rb
|
|
640
|
+
- spec/sinatra_modular/spec_modular/controller_oauth_spec.rb
|
|
641
|
+
- spec/sinatra_modular/spec_modular/controller_remember_me_spec.rb
|
|
642
|
+
- spec/sinatra_modular/spec_modular/controller_session_timeout_spec.rb
|
|
643
|
+
- spec/sinatra_modular/spec_modular/controller_spec.rb
|
|
644
|
+
- spec/sinatra_modular/spec_modular/spec_helper.rb
|
|
645
|
+
- spec/sinatra_modular/user.rb
|
|
576
646
|
- spec/sorcery_crypto_providers_spec.rb
|
|
577
647
|
- spec/spec_helper.rb
|