sorcery 0.9.1 → 0.16.3

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.
Files changed (199) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/ISSUE_TEMPLATE.md +24 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +7 -0
  5. data/.github/workflows/ruby.yml +70 -0
  6. data/.gitignore +3 -0
  7. data/.rubocop.yml +55 -0
  8. data/.rubocop_todo.yml +163 -0
  9. data/CHANGELOG.md +132 -34
  10. data/CODE_OF_CONDUCT.md +14 -0
  11. data/Gemfile +3 -17
  12. data/{LICENSE.txt → LICENSE.md} +1 -1
  13. data/MAINTAINING.md +64 -0
  14. data/README.md +146 -269
  15. data/Rakefile +4 -2
  16. data/SECURITY.md +19 -0
  17. data/gemfiles/rails_52.gemfile +7 -0
  18. data/gemfiles/rails_60.gemfile +7 -0
  19. data/gemfiles/rails_61.gemfile +7 -0
  20. data/gemfiles/rails_70.gemfile +7 -0
  21. data/lib/generators/sorcery/USAGE +1 -1
  22. data/lib/generators/sorcery/helpers.rb +8 -4
  23. data/lib/generators/sorcery/install_generator.rb +41 -35
  24. data/lib/generators/sorcery/templates/initializer.rb +216 -112
  25. data/lib/generators/sorcery/templates/migration/activity_logging.rb +7 -7
  26. data/lib/generators/sorcery/templates/migration/brute_force_protection.rb +5 -5
  27. data/lib/generators/sorcery/templates/migration/core.rb +5 -7
  28. data/lib/generators/sorcery/templates/migration/external.rb +4 -4
  29. data/lib/generators/sorcery/templates/migration/magic_login.rb +9 -0
  30. data/lib/generators/sorcery/templates/migration/remember_me.rb +5 -5
  31. data/lib/generators/sorcery/templates/migration/reset_password.rb +7 -6
  32. data/lib/generators/sorcery/templates/migration/user_activation.rb +6 -6
  33. data/lib/sorcery/adapters/active_record_adapter.rb +11 -21
  34. data/lib/sorcery/adapters/mongoid_adapter.rb +23 -11
  35. data/lib/sorcery/controller/config.rb +27 -23
  36. data/lib/sorcery/controller/submodules/activity_logging.rb +16 -18
  37. data/lib/sorcery/controller/submodules/brute_force_protection.rb +1 -2
  38. data/lib/sorcery/controller/submodules/external.rb +69 -44
  39. data/lib/sorcery/controller/submodules/http_basic_auth.rb +18 -19
  40. data/lib/sorcery/controller/submodules/remember_me.rb +16 -16
  41. data/lib/sorcery/controller/submodules/session_timeout.rb +33 -11
  42. data/lib/sorcery/controller.rb +50 -35
  43. data/lib/sorcery/crypto_providers/aes256.rb +17 -16
  44. data/lib/sorcery/crypto_providers/bcrypt.rb +26 -22
  45. data/lib/sorcery/crypto_providers/common.rb +1 -1
  46. data/lib/sorcery/crypto_providers/md5.rb +5 -5
  47. data/lib/sorcery/crypto_providers/sha1.rb +5 -5
  48. data/lib/sorcery/crypto_providers/sha256.rb +2 -2
  49. data/lib/sorcery/crypto_providers/sha512.rb +3 -3
  50. data/lib/sorcery/engine.rb +19 -11
  51. data/lib/sorcery/model/config.rb +73 -50
  52. data/lib/sorcery/model/submodules/activity_logging.rb +31 -12
  53. data/lib/sorcery/model/submodules/brute_force_protection.rb +38 -31
  54. data/lib/sorcery/model/submodules/external.rb +22 -10
  55. data/lib/sorcery/model/submodules/magic_login.rb +130 -0
  56. data/lib/sorcery/model/submodules/remember_me.rb +19 -7
  57. data/lib/sorcery/model/submodules/reset_password.rb +64 -42
  58. data/lib/sorcery/model/submodules/user_activation.rb +52 -54
  59. data/lib/sorcery/model/temporary_token.rb +30 -7
  60. data/lib/sorcery/model.rb +65 -40
  61. data/lib/sorcery/protocols/oauth.rb +4 -9
  62. data/lib/sorcery/protocols/oauth2.rb +0 -2
  63. data/lib/sorcery/providers/auth0.rb +46 -0
  64. data/lib/sorcery/providers/base.rb +4 -4
  65. data/lib/sorcery/providers/battlenet.rb +51 -0
  66. data/lib/sorcery/providers/discord.rb +52 -0
  67. data/lib/sorcery/providers/facebook.rb +8 -11
  68. data/lib/sorcery/providers/github.rb +5 -7
  69. data/lib/sorcery/providers/google.rb +3 -5
  70. data/lib/sorcery/providers/heroku.rb +7 -8
  71. data/lib/sorcery/providers/instagram.rb +73 -0
  72. data/lib/sorcery/providers/jira.rb +12 -17
  73. data/lib/sorcery/providers/line.rb +63 -0
  74. data/lib/sorcery/providers/linkedin.rb +44 -35
  75. data/lib/sorcery/providers/liveid.rb +4 -7
  76. data/lib/sorcery/providers/microsoft.rb +59 -0
  77. data/lib/sorcery/providers/paypal.rb +60 -0
  78. data/lib/sorcery/providers/salesforce.rb +3 -5
  79. data/lib/sorcery/providers/slack.rb +45 -0
  80. data/lib/sorcery/providers/twitter.rb +4 -6
  81. data/lib/sorcery/providers/vk.rb +8 -9
  82. data/lib/sorcery/providers/wechat.rb +81 -0
  83. data/lib/sorcery/providers/xing.rb +7 -10
  84. data/lib/sorcery/test_helpers/internal/rails.rb +25 -17
  85. data/lib/sorcery/test_helpers/internal.rb +15 -14
  86. data/lib/sorcery/test_helpers/rails/controller.rb +1 -1
  87. data/lib/sorcery/test_helpers/rails/integration.rb +5 -6
  88. data/lib/sorcery/test_helpers/rails/request.rb +20 -0
  89. data/lib/sorcery/version.rb +1 -1
  90. data/lib/sorcery.rb +4 -17
  91. data/sorcery.gemspec +43 -28
  92. data/spec/active_record/user_activation_spec.rb +4 -5
  93. data/spec/active_record/user_activity_logging_spec.rb +4 -6
  94. data/spec/active_record/user_brute_force_protection_spec.rb +5 -6
  95. data/spec/active_record/user_magic_login_spec.rb +15 -0
  96. data/spec/active_record/user_oauth_spec.rb +5 -6
  97. data/spec/active_record/user_remember_me_spec.rb +5 -6
  98. data/spec/active_record/user_reset_password_spec.rb +4 -5
  99. data/spec/active_record/user_spec.rb +7 -17
  100. data/spec/controllers/controller_activity_logging_spec.rb +13 -24
  101. data/spec/controllers/controller_brute_force_protection_spec.rb +8 -10
  102. data/spec/controllers/controller_http_basic_auth_spec.rb +20 -21
  103. data/spec/controllers/controller_oauth2_spec.rb +297 -158
  104. data/spec/controllers/controller_oauth_spec.rb +97 -71
  105. data/spec/controllers/controller_remember_me_spec.rb +49 -36
  106. data/spec/controllers/controller_session_timeout_spec.rb +106 -20
  107. data/spec/controllers/controller_spec.rb +87 -111
  108. data/spec/orm/active_record.rb +3 -3
  109. data/spec/providers/example_provider_spec.rb +17 -0
  110. data/spec/providers/example_spec.rb +17 -0
  111. data/spec/providers/examples_spec.rb +17 -0
  112. data/spec/providers/vk_spec.rb +42 -0
  113. data/spec/rails_app/app/active_record/authentication.rb +1 -1
  114. data/spec/rails_app/app/active_record/user.rb +2 -2
  115. data/spec/rails_app/app/assets/config/manifest.js +1 -0
  116. data/spec/rails_app/app/controllers/application_controller.rb +2 -0
  117. data/spec/rails_app/app/controllers/sorcery_controller.rb +250 -46
  118. data/spec/rails_app/app/mailers/sorcery_mailer.rb +23 -17
  119. data/spec/rails_app/app/views/sorcery_mailer/magic_login_email.html.erb +13 -0
  120. data/spec/rails_app/app/views/sorcery_mailer/magic_login_email.text.erb +6 -0
  121. data/spec/rails_app/config/application.rb +14 -9
  122. data/spec/rails_app/config/boot.rb +2 -2
  123. data/spec/rails_app/config/environment.rb +1 -1
  124. data/spec/rails_app/config/environments/test.rb +1 -1
  125. data/spec/rails_app/config/initializers/compatible_legacy_migration.rb +11 -0
  126. data/spec/rails_app/config/initializers/session_store.rb +3 -3
  127. data/spec/rails_app/config/routes.rb +31 -1
  128. data/spec/rails_app/config/secrets.yml +4 -0
  129. data/spec/rails_app/config.ru +1 -1
  130. data/spec/rails_app/db/migrate/activation/20101224223622_add_activation_to_users.rb +4 -4
  131. data/spec/rails_app/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +10 -10
  132. data/spec/rails_app/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +5 -5
  133. data/spec/rails_app/db/migrate/core/20101224223620_create_users.rb +5 -5
  134. data/spec/rails_app/db/migrate/external/20101224223628_create_authentications_and_user_providers.rb +3 -3
  135. data/spec/rails_app/db/migrate/invalidate_active_sessions/20180221093235_add_invalidate_active_sessions_before_to_users.rb +9 -0
  136. data/spec/rails_app/db/migrate/magic_login/20170924151831_add_magic_login_to_users.rb +17 -0
  137. data/spec/rails_app/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +6 -6
  138. data/spec/rails_app/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +7 -5
  139. data/spec/rails_app/db/schema.rb +7 -9
  140. data/spec/shared_examples/user_activation_shared_examples.rb +177 -58
  141. data/spec/shared_examples/user_activity_logging_shared_examples.rb +47 -41
  142. data/spec/shared_examples/user_brute_force_protection_shared_examples.rb +19 -24
  143. data/spec/shared_examples/user_magic_login_shared_examples.rb +150 -0
  144. data/spec/shared_examples/user_oauth_shared_examples.rb +7 -10
  145. data/spec/shared_examples/user_remember_me_shared_examples.rb +91 -22
  146. data/spec/shared_examples/user_reset_password_shared_examples.rb +153 -58
  147. data/spec/shared_examples/user_shared_examples.rb +328 -145
  148. data/spec/sorcery_crypto_providers_spec.rb +122 -75
  149. data/spec/sorcery_temporary_token_spec.rb +27 -0
  150. data/spec/spec.opts +1 -1
  151. data/spec/spec_helper.rb +19 -14
  152. data/spec/support/migration_helper.rb +29 -0
  153. data/spec/support/providers/example.rb +11 -0
  154. data/spec/support/providers/example_provider.rb +11 -0
  155. data/spec/support/providers/examples.rb +11 -0
  156. metadata +119 -89
  157. data/.travis.yml +0 -132
  158. data/gemfiles/active_record-rails40.gemfile +0 -7
  159. data/gemfiles/active_record-rails41.gemfile +0 -7
  160. data/gemfiles/mongo_mapper-rails40.gemfile +0 -9
  161. data/gemfiles/mongo_mapper-rails41.gemfile +0 -9
  162. data/gemfiles/mongoid-rails40.gemfile +0 -9
  163. data/gemfiles/mongoid-rails41.gemfile +0 -9
  164. data/gemfiles/mongoid3-rails32.gemfile +0 -9
  165. data/lib/sorcery/adapters/data_mapper_adapter.rb +0 -176
  166. data/lib/sorcery/adapters/mongo_mapper_adapter.rb +0 -110
  167. data/lib/sorcery/railties/tasks.rake +0 -6
  168. data/spec/data_mapper/user_activation_spec.rb +0 -10
  169. data/spec/data_mapper/user_activity_logging_spec.rb +0 -14
  170. data/spec/data_mapper/user_brute_force_protection_spec.rb +0 -9
  171. data/spec/data_mapper/user_oauth_spec.rb +0 -9
  172. data/spec/data_mapper/user_remember_me_spec.rb +0 -8
  173. data/spec/data_mapper/user_reset_password_spec.rb +0 -8
  174. data/spec/data_mapper/user_spec.rb +0 -27
  175. data/spec/mongo_mapper/user_activation_spec.rb +0 -9
  176. data/spec/mongo_mapper/user_activity_logging_spec.rb +0 -8
  177. data/spec/mongo_mapper/user_brute_force_protection_spec.rb +0 -8
  178. data/spec/mongo_mapper/user_oauth_spec.rb +0 -8
  179. data/spec/mongo_mapper/user_remember_me_spec.rb +0 -8
  180. data/spec/mongo_mapper/user_reset_password_spec.rb +0 -8
  181. data/spec/mongo_mapper/user_spec.rb +0 -37
  182. data/spec/mongoid/user_activation_spec.rb +0 -9
  183. data/spec/mongoid/user_activity_logging_spec.rb +0 -8
  184. data/spec/mongoid/user_brute_force_protection_spec.rb +0 -8
  185. data/spec/mongoid/user_oauth_spec.rb +0 -8
  186. data/spec/mongoid/user_remember_me_spec.rb +0 -8
  187. data/spec/mongoid/user_reset_password_spec.rb +0 -8
  188. data/spec/mongoid/user_spec.rb +0 -51
  189. data/spec/orm/data_mapper.rb +0 -48
  190. data/spec/orm/mongo_mapper.rb +0 -10
  191. data/spec/orm/mongoid.rb +0 -22
  192. data/spec/rails_app/app/data_mapper/authentication.rb +0 -8
  193. data/spec/rails_app/app/data_mapper/user.rb +0 -7
  194. data/spec/rails_app/app/mongo_mapper/authentication.rb +0 -6
  195. data/spec/rails_app/app/mongo_mapper/user.rb +0 -7
  196. data/spec/rails_app/app/mongoid/authentication.rb +0 -7
  197. data/spec/rails_app/app/mongoid/user.rb +0 -7
  198. data/spec/rails_app/config/initializers/secret_token.rb +0 -7
  199. data/spec/rails_app/log/development.log +0 -1791
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5c0e37f33ed4fa3e085ccc8e3a6a5526afb632f2
4
- data.tar.gz: 1b224ad20e8ed01e04a2b7a25153e5949b56fa4f
2
+ SHA256:
3
+ metadata.gz: f2d091c4af06b65d0b8640aa1664cc03370f0859a0d37ccca2865813a41956ec
4
+ data.tar.gz: c60ee8af595868a99ddced5363716f6593f494bb82e97a82d35769b4a1c223e4
5
5
  SHA512:
6
- metadata.gz: 48d1dd07a9ab99ade78c490bfffd27144b3951d5ba1f45bcfc1baede6db4cbe228e8916025bfd69fbc48d3342724b00ac2cfd9ecc41110d1b9fdd9559885091b
7
- data.tar.gz: 250ceb737b38dab40dd3e16488f3e37aadf2b09fe94c6147ed92a2d42aab2d61d01601b3a2891403f70cc23ef4e675f4fb1ad83072d59ee71d8d6e5fd9d9c20d
6
+ metadata.gz: 24281e4ee0082665b792c467fbc9f7e70a6d3f26492a66de179248b6d3c97dcabf2aa3058e44239961ffa01645708883d22e097ac28dfc2b64e38ef2743a03c3
7
+ data.tar.gz: 55c173b3a0ea39d8067bb26b737e57548fb67357c0969d1eb08290c8876294157f2ca7c17888874d208d88fe893840b4046bf3463c1ead9fa16c15358a9d5668
@@ -0,0 +1 @@
1
+ github: athix
@@ -0,0 +1,24 @@
1
+ <!-- Please complete all sections. -->
2
+
3
+ ### Configuration
4
+
5
+ - Sorcery Version: ``
6
+ - Ruby Version: ``
7
+ - Framework: ``
8
+ - Platform: ``
9
+
10
+ ### Expected Behavior
11
+
12
+ <!-- Tell us what should happen. -->
13
+
14
+ ### Actual Behavior
15
+
16
+ <!-- Tell us what happens instead. -->
17
+
18
+ ### Steps to Reproduce
19
+
20
+ <!-- Please list all steps to reproduce the issue. -->
21
+
22
+ 1.
23
+ 2.
24
+ 3.
@@ -0,0 +1,7 @@
1
+ Please ensure your pull request includes the following:
2
+
3
+ - [ ] Description of changes
4
+ - [ ] Update to CHANGELOG.md with short description and link to pull request
5
+ - [ ] Changes have related RSpec tests that ensure functionality does not break
6
+
7
+ <!-- For the changelog, please add your entry to the HEAD section. Do not create a new release header. -->
@@ -0,0 +1,70 @@
1
+ name: Test Suite
2
+
3
+ # Run against all commits and pull requests.
4
+ on:
5
+ schedule:
6
+ - cron: '0 0 * * *'
7
+ push:
8
+ pull_request:
9
+
10
+ jobs:
11
+ test_matrix:
12
+
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby:
19
+ - 2.4
20
+ - 2.5
21
+ - 2.6
22
+ - 2.7
23
+ - 3.0.0
24
+ # - 3.1
25
+
26
+ rails:
27
+ - '52'
28
+ - '60'
29
+ - '61'
30
+ # - '70'
31
+
32
+ exclude:
33
+ - ruby: 2.4
34
+ rails: '60'
35
+ - ruby: 2.4
36
+ rails: '61'
37
+ # - ruby: 2.4
38
+ # rails: '70'
39
+ # - ruby: 2.5
40
+ # rails: '70'
41
+ # - ruby: 2.6
42
+ # rails: '70'
43
+ - ruby: 3.0.0
44
+ rails: '52'
45
+ # - ruby: 3.1
46
+ # rails: '52'
47
+ # - ruby: 3.1
48
+ # rails: '60'
49
+ # - ruby: 3.1
50
+ # rails: '61'
51
+
52
+ env:
53
+ BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
54
+
55
+ steps:
56
+ - uses: actions/checkout@v2
57
+ - name: Set up Ruby
58
+ uses: ruby/setup-ruby@v1
59
+ with:
60
+ ruby-version: ${{ matrix.ruby }}
61
+ bundler-cache: true
62
+ - name: Run tests
63
+ run: bundle exec rake spec
64
+
65
+ finish:
66
+ runs-on: ubuntu-latest
67
+ needs: [ test_matrix ]
68
+ steps:
69
+ - name: Wait for status checks
70
+ run: echo "All Green!"
data/.gitignore CHANGED
@@ -14,6 +14,9 @@ doc
14
14
  # jeweler generated
15
15
  pkg
16
16
 
17
+ # byebug generated
18
+ .byebug_history
19
+
17
20
  # for RVM
18
21
  .rvmrc
19
22
 
data/.rubocop.yml ADDED
@@ -0,0 +1,55 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - 'lib/generators/sorcery/templates/**/*'
6
+ TargetRubyVersion: 2.6
7
+
8
+ # See: https://github.com/rubocop-hq/rubocop/issues/3344
9
+ Style/DoubleNegation:
10
+ Enabled: false
11
+
12
+ ####################
13
+ ## Pre-1.0.0 Code ##
14
+ ####################
15
+
16
+ Metrics/AbcSize:
17
+ Exclude:
18
+ - 'lib/**/*'
19
+ - 'spec/**/*'
20
+ Metrics/BlockLength:
21
+ Exclude:
22
+ - 'lib/**/*'
23
+ - 'spec/**/*'
24
+ Layout/LineLength:
25
+ Exclude:
26
+ - 'lib/**/*'
27
+ - 'spec/**/*'
28
+ Metrics/ClassLength:
29
+ Exclude:
30
+ - 'lib/**/*'
31
+ - 'spec/**/*'
32
+ Metrics/CyclomaticComplexity:
33
+ Exclude:
34
+ - 'lib/**/*'
35
+ - 'spec/**/*'
36
+ Metrics/MethodLength:
37
+ Exclude:
38
+ - 'lib/**/*'
39
+ - 'spec/**/*'
40
+ Metrics/PerceivedComplexity:
41
+ Exclude:
42
+ - 'lib/**/*'
43
+ - 'spec/**/*'
44
+ Naming/AccessorMethodName:
45
+ Exclude:
46
+ - 'lib/**/*'
47
+ - 'spec/**/*'
48
+ Naming/PredicateName:
49
+ Exclude:
50
+ - 'lib/**/*'
51
+ - 'spec/**/*'
52
+ Style/Documentation:
53
+ Exclude:
54
+ - 'lib/**/*'
55
+ - 'spec/**/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,163 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-04-04 05:00:11 UTC using RuboCop version 0.88.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'sorcery.gemspec'
15
+
16
+ # Offense count: 2
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: IndentationWidth.
19
+ # SupportedStyles: special_inside_parentheses, consistent, align_braces
20
+ Layout/FirstHashElementIndentation:
21
+ EnforcedStyle: consistent
22
+
23
+ # Offense count: 83
24
+ # Cop supports --auto-correct.
25
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
26
+ # SupportedHashRocketStyles: key, separator, table
27
+ # SupportedColonStyles: key, separator, table
28
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
29
+ Layout/HashAlignment:
30
+ Enabled: false
31
+
32
+ # Offense count: 3
33
+ # Cop supports --auto-correct.
34
+ # Configuration parameters: AllowInHeredoc.
35
+ Layout/TrailingWhitespace:
36
+ Exclude:
37
+ - 'lib/sorcery/controller/submodules/external.rb'
38
+
39
+ # Offense count: 2
40
+ # Configuration parameters: AllowSafeAssignment.
41
+ Lint/AssignmentInCondition:
42
+ Exclude:
43
+ - 'spec/rails_app/app/controllers/sorcery_controller.rb'
44
+
45
+ # Offense count: 1
46
+ # Cop supports --auto-correct.
47
+ Lint/NonDeterministicRequireOrder:
48
+ Exclude:
49
+ - 'spec/spec_helper.rb'
50
+
51
+ # Offense count: 4
52
+ # Cop supports --auto-correct.
53
+ Lint/RedundantCopDisableDirective:
54
+ Exclude:
55
+ - 'lib/sorcery/controller.rb'
56
+ - 'lib/sorcery/model.rb'
57
+ - 'spec/rails_app/config/application.rb'
58
+ - 'spec/shared_examples/user_shared_examples.rb'
59
+
60
+ # Offense count: 4
61
+ # Cop supports --auto-correct.
62
+ Lint/SendWithMixinArgument:
63
+ Exclude:
64
+ - 'lib/sorcery.rb'
65
+ - 'lib/sorcery/engine.rb'
66
+ - 'lib/sorcery/test_helpers/internal/rails.rb'
67
+
68
+ # Offense count: 2
69
+ # Cop supports --auto-correct.
70
+ # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
71
+ Lint/UnusedBlockArgument:
72
+ Exclude:
73
+ - 'spec/shared_examples/user_shared_examples.rb'
74
+
75
+ # Offense count: 1
76
+ # Cop supports --auto-correct.
77
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
78
+ # SupportedStyles: assign_to_condition, assign_inside_condition
79
+ Style/ConditionalAssignment:
80
+ Exclude:
81
+ - 'lib/sorcery/adapters/active_record_adapter.rb'
82
+
83
+ # Offense count: 1
84
+ # Cop supports --auto-correct.
85
+ Style/ExpandPathArguments:
86
+ Exclude:
87
+ - 'spec/rails_app/config.ru'
88
+
89
+ # Offense count: 1
90
+ # Configuration parameters: EnforcedStyle.
91
+ # SupportedStyles: annotated, template, unannotated
92
+ Style/FormatStringToken:
93
+ Exclude:
94
+ - 'lib/generators/sorcery/install_generator.rb'
95
+
96
+ # Offense count: 125
97
+ # Cop supports --auto-correct.
98
+ # Configuration parameters: EnforcedStyle.
99
+ # SupportedStyles: always, always_true, never
100
+ Style/FrozenStringLiteralComment:
101
+ Enabled: false
102
+
103
+ # Offense count: 3
104
+ # Cop supports --auto-correct.
105
+ # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
106
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
107
+ Style/HashSyntax:
108
+ Exclude:
109
+ - 'lib/sorcery/adapters/active_record_adapter.rb'
110
+ - 'lib/sorcery/test_helpers/rails/integration.rb'
111
+
112
+ # Offense count: 34
113
+ # Cop supports --auto-correct.
114
+ Style/IfUnlessModifier:
115
+ Enabled: false
116
+
117
+ # Offense count: 1
118
+ # Cop supports --auto-correct.
119
+ Style/MultilineIfModifier:
120
+ Exclude:
121
+ - 'lib/sorcery/providers/line.rb'
122
+
123
+ # Offense count: 2
124
+ # Cop supports --auto-correct.
125
+ Style/RedundantBegin:
126
+ Exclude:
127
+ - 'lib/sorcery/controller.rb'
128
+ - 'lib/sorcery/model.rb'
129
+
130
+ # Offense count: 4
131
+ # Cop supports --auto-correct.
132
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
133
+ # AllowedMethods: present?, blank?, presence, try, try!
134
+ Style/SafeNavigation:
135
+ Exclude:
136
+ - 'lib/sorcery/controller/config.rb'
137
+ - 'lib/sorcery/controller/submodules/brute_force_protection.rb'
138
+ - 'lib/sorcery/controller/submodules/remember_me.rb'
139
+ - 'lib/sorcery/model.rb'
140
+
141
+ # Offense count: 7
142
+ # Cop supports --auto-correct.
143
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
144
+ # SupportedStyles: single_quotes, double_quotes
145
+ Style/StringLiterals:
146
+ Exclude:
147
+ - 'spec/controllers/controller_oauth2_spec.rb'
148
+ - 'spec/sorcery_crypto_providers_spec.rb'
149
+
150
+ # Offense count: 1
151
+ # Cop supports --auto-correct.
152
+ # Configuration parameters: EnforcedStyle, MinSize.
153
+ # SupportedStyles: percent, brackets
154
+ Style/SymbolArray:
155
+ Exclude:
156
+ - 'Rakefile'
157
+
158
+ # Offense count: 2
159
+ # Cop supports --auto-correct.
160
+ Style/UnpackFirst:
161
+ Exclude:
162
+ - 'lib/sorcery/crypto_providers/aes256.rb'
163
+ - 'spec/sorcery_crypto_providers_spec.rb'
data/CHANGELOG.md CHANGED
@@ -1,8 +1,135 @@
1
1
  # Changelog
2
-
3
- ## 1.0 (not released yet)
2
+ ## HEAD
3
+
4
+ ## 0.16.3
5
+
6
+ * Fix provider instantiation for plural provider names (eg. okta) [#305](https://github.com/Sorcery/sorcery/pull/305)
7
+
8
+ ## 0.16.2
9
+
10
+ * Inline core migration index definition [#281](https://github.com/Sorcery/sorcery/pull/281)
11
+ * Add missing remember_me attributes to config [#180](https://github.com/Sorcery/sorcery/pull/180)
12
+ * Fix MongoID adapter breaking on save [#284](https://github.com/Sorcery/sorcery/pull/284)
13
+ * Don't pass token to Slack in query params. Prevents 'invalid_auth' error [#287](https://github.com/Sorcery/sorcery/pull/287)
14
+ * Fix valid_password? not using configured values when called alone [#293](https://github.com/Sorcery/sorcery/pull/293)
15
+
16
+ ## 0.16.1
17
+
18
+ * Fix default table name being incorrect in migration generator [#274](https://github.com/Sorcery/sorcery/pull/274)
19
+ * Update `oauth` dependency per CVE-2016-11086
20
+
21
+ ## 0.16.0
22
+
23
+ * Add BattleNet Provider [#260](https://github.com/Sorcery/sorcery/pull/260)
24
+ * Fix failing isolated tests [#249](https://github.com/Sorcery/sorcery/pull/249)
25
+ * Support LINE login v2.1 [#251](https://github.com/Sorcery/sorcery/pull/251)
26
+ * Update generators to better support namespaces [#237](https://github.com/Sorcery/sorcery/pull/237)
27
+ * Add support for Rails 6 [#238](https://github.com/Sorcery/sorcery/pull/238)
28
+ * Fix ruby 2.7 deprecation warnings [#241](https://github.com/Sorcery/sorcery/pull/241)
29
+ * Use set to ensure unique arrays [#233](https://github.com/Sorcery/sorcery/pull/233)
30
+
31
+ ## 0.15.1
32
+
33
+ * Update `oauth` dependency per CVE-2016-11086
34
+
35
+ ## 0.15.0
36
+
37
+ * Fix brute force vuln due to callbacks no being ran [#235](https://github.com/Sorcery/sorcery/pull/235)
38
+ * Revert on_load change due to breaking existing applications [#234](https://github.com/Sorcery/sorcery/pull/234)
39
+ * Add forget_me! and force_forget_me! test cases [#216](https://github.com/Sorcery/sorcery/pull/216)
40
+ * In `generic_send_email`, check responds_to [#211](https://github.com/Sorcery/sorcery/pull/211)
41
+ * Fix typo [#219](https://github.com/Sorcery/sorcery/pull/219)
42
+ * Fix deprecation warnings in Rails 6 [#209](https://github.com/Sorcery/sorcery/pull/209)
43
+ * Add ruby 2.6.5 to the travis build [#215](https://github.com/Sorcery/sorcery/pull/215)
44
+ * Add discord provider [#185](https://github.com/Sorcery/sorcery/pull/185)
45
+ * Remove MySQL database creation call [#214](https://github.com/Sorcery/sorcery/pull/214)
46
+ * Use id instead of uid for VK provider [#199](https://github.com/Sorcery/sorcery/pull/199)
47
+ * Don't :return_t JSON requests after login [#197](https://github.com/Sorcery/sorcery/pull/197)
48
+ * Fix email scope for LinkedIn Provider [#191](https://github.com/Sorcery/sorcery/pull/191)
49
+ * Ignore cookies when undefined cookies [#187](https://github.com/Sorcery/sorcery/pull/187)
50
+ * Allow for custom providers with multi-word class names. [#190](https://github.com/Sorcery/sorcery/pull/190)
51
+
52
+ ## 0.14.0
53
+
54
+ * Update LinkedIn to use OAuth 2 [#189](https://github.com/Sorcery/sorcery/pull/189)
55
+ * Support the LINE login auth [#80](https://github.com/Sorcery/sorcery/pull/80)
56
+ * Allow BCrypt to have app-specific secret token [#173](https://github.com/Sorcery/sorcery/pull/173)
57
+ * Add #change_password method to reset_password module. [#165](https://github.com/Sorcery/sorcery/pull/165)
58
+ * Clean up initializer comments [#153](https://github.com/Sorcery/sorcery/pull/153)
59
+ * Allow load_from_magic_login_token to accept a block [#152](https://github.com/Sorcery/sorcery/pull/152)
60
+ * Fix CipherError class name [#142](https://github.com/Sorcery/sorcery/pull/142)
61
+ * Fix `update_failed_logins_count` being called twice when login failed [#163](https://github.com/Sorcery/sorcery/pull/163)
62
+ * Update migration templates to use new hash syntax [#170](https://github.com/Sorcery/sorcery/pull/170)
63
+ * Support for Rails 4.2 and lower soft-dropped [#171](https://github.com/Sorcery/sorcery/pull/171)
64
+
65
+ ## 0.13.0
66
+
67
+ * Add support for Rails 5.2 / Ruby 2.5 [#129](https://github.com/Sorcery/sorcery/pull/129)
68
+ * Fix migration files not being generated [#128](https://github.com/Sorcery/sorcery/pull/128)
69
+ * Add support for ActionController::API [#133](https://github.com/Sorcery/sorcery/pull/133), [#150](https://github.com/Sorcery/sorcery/pull/150), [#159](https://github.com/Sorcery/sorcery/pull/159)
70
+ * Update activation email to use after_commit callback [#130](https://github.com/Sorcery/sorcery/pull/130)
71
+ * Add opt-in `invalidate_active_sessions!` method [#110](https://github.com/Sorcery/sorcery/pull/110)
72
+ * Pass along `remember_me` to `#auto_login` [#136](https://github.com/Sorcery/sorcery/pull/136)
73
+ * Respect SessionTimeout on login via RememberMe [#102](https://github.com/Sorcery/sorcery/pull/102)
74
+ * Added `demodulize` on authentication class name association name fetch [#147](https://github.com/Sorcery/sorcery/pull/147)
75
+ * Remove Gemnasium badge [#140](https://github.com/Sorcery/sorcery/pull/140)
76
+ * Add Instragram provider [#51](https://github.com/Sorcery/sorcery/pull/51)
77
+ * Remove `publish_actions` permission for facebook [#139](https://github.com/Sorcery/sorcery/pull/139)
78
+ * Prepare for 1.0.0 [#157](https://github.com/Sorcery/sorcery/pull/157)
79
+ * Add Auth0 provider [#160](https://github.com/Sorcery/sorcery/pull/160)
80
+
81
+ ## 0.12.0
82
+
83
+ * Fix magic_login not inheriting from migration_class_name [#99](https://github.com/Sorcery/sorcery/pull/99)
84
+ * Update YARD dependency [#100](https://github.com/Sorcery/sorcery/pull/100)
85
+ * Make `#update_attributes` behave like `#update` [#98](https://github.com/Sorcery/sorcery/pull/98)
86
+ * Add tests to the magic login submodule [#95](https://github.com/Sorcery/sorcery/pull/95)
87
+ * Set user.stretches to 1 in test env by default [#81](https://github.com/Sorcery/sorcery/pull/81)
88
+ * Allow user to be loaded from other source when session expires. fix #89 [#94](https://github.com/Sorcery/sorcery/pull/94)
89
+ * Added a new ArgumentError for not defined user_class in config [#82](https://github.com/Sorcery/sorcery/pull/82)
90
+ * Updated Required Ruby version to 2.2 [#85](https://github.com/Sorcery/sorcery/pull/85)
91
+ * Add configuration for token randomness [#67](https://github.com/Sorcery/sorcery/pull/67)
92
+ * Add facebook user_info_path option to initializer.rb [#63](https://github.com/Sorcery/sorcery/pull/63)
93
+ * Add new function: `build_from` (allows building a user instance from OAuth without saving) [#54](https://github.com/Sorcery/sorcery/pull/54)
94
+ * Add rubocop configuration and TODO list [#107](https://github.com/Sorcery/sorcery/pull/107)
95
+ * Add support for VK OAuth (thanks to @Hirurg103) [#109](https://github.com/Sorcery/sorcery/pull/109)
96
+ * Fix token leak via referrer header [#56](https://github.com/Sorcery/sorcery/pull/56)
97
+ * Add `login_user` helper for request specs [#57](https://github.com/Sorcery/sorcery/pull/57)
98
+
99
+ ## 0.11.0
100
+
101
+ * Refer to User before calling remove_const to avoid NameError [#58](https://github.com/Sorcery/sorcery/pull/58)
102
+ * Resurrect block authentication, showing auth failure reason. [#41](https://github.com/Sorcery/sorcery/pull/41)
103
+ * Add github scope option to initializer.rb [#50](https://github.com/Sorcery/sorcery/pull/50)
104
+ * Fix Facebook being broken due to API deprecation [#53](https://github.com/Sorcery/sorcery/pull/53)
105
+
106
+ ## 0.10.3
107
+
108
+ * Revert removal of MongoID Adapter (breaks Sorcery for MongoID users until separate gem is created) [#45](https://github.com/Sorcery/sorcery/pull/45)
109
+
110
+ ## 0.10.2
111
+
112
+ * Added support for Microsoft OAuth (thanks to @athix) [#37](https://github.com/Sorcery/sorcery/pull/37)
113
+
114
+ ## 0.10.1
115
+
116
+ * Fixed LinkedIn bug [#36](https://github.com/Sorcery/sorcery/pull/36)
117
+
118
+ ## 0.10.0
4
119
 
5
120
  * Adapters (Mongoid, MongoMapper, DataMapper) are now separated from the core Sorcery repo and moved under `sorcery-rails` organization. Special thanks to @juike!
121
+ * `current_users` method was removed
122
+ * Added `logged_in?` `logged_out?` `online?` to activity_logging instance methods
123
+ * Added support for PayPal OAuth (thanks to @rubenmoya)
124
+ * Added support for Slack OAuth (thanks to @youzik)
125
+ * Added support for WeChat OAuth (thanks to @Darmody)
126
+ * Deprecated Rails 3
127
+ * Deprecated using `callback_filter` in favor of `callback_action`
128
+ * Added null: false to migrations
129
+ * Added support for Rails 5 (thanks to @kyuden)
130
+ * Added support for Ruby 2.4 (thanks to @kyuden)
131
+ * Added WeChat provider to external submodule.
132
+ * Namespace login lock/unlock methods to fix conflicts with Rails lock/unlock (thanks to @kyuden)
6
133
 
7
134
  ## 0.9.1
8
135
 
@@ -63,7 +190,7 @@
63
190
 
64
191
  ## 0.8.4
65
192
 
66
- * Few security fixes in `external` module
193
+ * Few security fixes in `external` module
67
194
 
68
195
  ## 0.8.3 (yanked because of bad Jeweler release)
69
196
 
@@ -71,38 +198,9 @@
71
198
 
72
199
  * Activity logging feature has a new column called `last_login_from_ip_address` (string type). If you use ActiveRecord, you will have to add this column to DB ([#465](https://github.com/NoamB/sorcery/issues/465))
73
200
 
74
- ## 0.8.1
75
- <!-- TO BE WRITTEN -->
76
-
77
- ## 0.8.0
78
- <!-- TO BE WRITTEN -->
79
-
80
- ## 0.7.13
81
- <!-- TO BE WRITTEN -->
82
-
83
- ## 0.7.12
84
- <!-- TO BE WRITTEN -->
85
-
86
- ## 0.7.11
87
- <!-- TO BE WRITTEN -->
88
-
89
- ## 0.7.10
90
- <!-- TO BE WRITTEN -->
91
-
92
- ## 0.7.9
93
- <!-- TO BE WRITTEN -->
94
-
95
- ## 0.7.8
96
- <!-- TO BE WRITTEN -->
97
-
98
- ## 0.7.7
99
- <!-- TO BE WRITTEN -->
100
-
101
- ## 0.7.6
102
- <!-- TO BE WRITTEN -->
201
+ ## 0.7.5-0.8.1
103
202
 
104
- ## 0.7.5
105
- <!-- TO BE WRITTEN -->
203
+ <!-- HERE BE DRAGONS (Changelogs never written) -->
106
204
 
107
205
  ## 0.7.1-0.7.4
108
206
 
@@ -0,0 +1,14 @@
1
+ # The Sorcery Community Code of Conduct
2
+
3
+ This document provides a few simple community guidelines for a safe, respectful,
4
+ productive, and collaborative place for any person who is willing to contribute
5
+ to the Sorcery community. It applies to all "collaborative spaces", which are
6
+ defined as community communications channels (such as mailing lists, submitted
7
+ patches, commit comments, etc.).
8
+
9
+ * Participants will be tolerant of opposing views.
10
+ * Participants must ensure that their language and actions are free of personal
11
+ attacks and disparaging personal remarks.
12
+ * When interpreting the words and actions of others, participants should always
13
+ assume good intentions.
14
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
data/Gemfile CHANGED
@@ -1,22 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '~> 3.2'
4
- gem 'sqlite3'
5
3
  gem 'pry'
6
-
7
- group :mongomapper do
8
- gem 'mongo_mapper'
9
- end
10
-
11
- group :mongoid do
12
- gem 'mongoid', "~> 2.4.4"
13
- gem 'bson_ext'
14
- end
15
-
16
- group :datamapper do
17
- gem 'mysql2'
18
- gem 'data_mapper'
19
- gem 'dm-mysql-adapter'
20
- end
4
+ gem 'rails'
5
+ gem 'rails-controller-testing'
6
+ gem 'sqlite3'
21
7
 
22
8
  gemspec
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Noam Ben-Ari <mailto:nbenari@gmail.com>
1
+ Copyright (c) 2010 [Noam Ben-Ari](mailto:nbenari@gmail.com)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/MAINTAINING.md ADDED
@@ -0,0 +1,64 @@
1
+ # Maintaining Sorcery
2
+
3
+ This will eventually be fleshed out so that anyone should be able to pick up and
4
+ maintain Sorcery by following this guide. It will provide step-by-step guides
5
+ for common tasks such as releasing new versions, as well as explain how to
6
+ triage issues and keep the CHANGELOG up-to-date.
7
+
8
+ ## Table of Contents
9
+
10
+ 1. [Merging Pull Requests](#merging-pull-requests)
11
+ 1. [Versioning](#versioning)
12
+ 1. [Version Naming](#version-naming)
13
+ 1. [Releasing a New Version](#releasing-a-new-version)
14
+
15
+ ## Merging Pull Requests
16
+
17
+ TODO
18
+
19
+ ## Versioning
20
+
21
+ ### Version Naming
22
+
23
+ Sorcery uses semantic versioning which can be found at: https://semver.org/
24
+
25
+ All versions of Sorcery should follow this format: `MAJOR.MINOR.PATCH`
26
+
27
+ Where:
28
+
29
+ * MAJOR - Includes backwards **incompatible** changes.
30
+ * MINOR - Introduces new functionality but is fully backwards compatible.
31
+ * PATCH - Fixes errors in existing functionality (must be backwards compatible).
32
+
33
+ The changelog and git tags should use `vMAJOR.MINOR.PATCH` to indicate that the
34
+ number represents a version of Sorcery. For example, `1.0.0` would become
35
+ `v1.0.0`.
36
+
37
+ ### Releasing a New Version
38
+
39
+ When it's time to release a new version, you'll want to ensure all the changes
40
+ you need are on the master branch and that there is a passing build. Then follow
41
+ this checklist and prepare a release commit:
42
+
43
+ NOTE: `X.Y.Z` and `vX.Y.Z` are given as examples, and should be replaced with
44
+ whatever version you are releasing. See: [Version Naming](#version-naming)
45
+
46
+ 1. Update CHANGELOG.md
47
+ 1. Check for any changes that have been included since the last release that
48
+ are not reflected in the changelog. Add any missing entries to the `HEAD`
49
+ section.
50
+ 1. Check the changes in `HEAD` to determine what version increment is
51
+ appropriate. See [Version Naming](#version-naming) if unsure.
52
+ 1. Replace `## HEAD` with `## vX.Y.Z` and create a new `## HEAD` section
53
+ above the latest version.
54
+ 1. Update Gem Version
55
+ 1. Update `./lib/sorcery/version.rb` to 'X.Y.Z'
56
+ 1. Stage your changes and create a commit
57
+ 1. `git add -A`
58
+ 1. `git commit -m "Release vX.Y.Z"`
59
+ 1. TODO: Gem Release (WIP)
60
+ 1. `cd <dir>`
61
+ 1. `gem build`
62
+ 1. `gem push <filename>`
63
+ 1. TODO: Version tagging
64
+ 1. Release new version via github interface