sorcery 0.15.0 → 0.16.5
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.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +10 -0
- data/.devcontainer/devcontainer.json +29 -0
- data/.devcontainer/postcreate.sh +4 -0
- data/.github/FUNDING.yml +1 -0
- data/.github/ISSUE_TEMPLATE.md +8 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- data/.github/workflows/ruby.yml +70 -0
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +44 -26
- data/CHANGELOG.md +42 -0
- data/CODE_OF_CONDUCT.md +14 -0
- data/Gemfile +2 -2
- data/MAINTAINING.md +64 -0
- data/README.md +3 -6
- data/Rakefile +3 -1
- data/SECURITY.md +19 -0
- data/gemfiles/rails_52.gemfile +7 -0
- data/gemfiles/rails_60.gemfile +7 -0
- data/gemfiles/rails_61.gemfile +7 -0
- data/gemfiles/rails_70.gemfile +7 -0
- data/lib/generators/sorcery/helpers.rb +4 -0
- data/lib/generators/sorcery/templates/initializer.rb +23 -1
- data/lib/generators/sorcery/templates/migration/activity_logging.rb +5 -5
- data/lib/generators/sorcery/templates/migration/brute_force_protection.rb +4 -4
- data/lib/generators/sorcery/templates/migration/core.rb +2 -4
- data/lib/generators/sorcery/templates/migration/external.rb +1 -1
- data/lib/generators/sorcery/templates/migration/magic_login.rb +4 -4
- data/lib/generators/sorcery/templates/migration/remember_me.rb +3 -3
- data/lib/generators/sorcery/templates/migration/reset_password.rb +5 -5
- data/lib/generators/sorcery/templates/migration/user_activation.rb +4 -4
- data/lib/sorcery/adapters/active_record_adapter.rb +2 -2
- data/lib/sorcery/adapters/mongoid_adapter.rb +1 -1
- data/lib/sorcery/controller/config.rb +6 -6
- data/lib/sorcery/controller/submodules/activity_logging.rb +5 -10
- data/lib/sorcery/controller/submodules/brute_force_protection.rb +3 -7
- data/lib/sorcery/controller/submodules/external.rb +3 -2
- data/lib/sorcery/controller/submodules/http_basic_auth.rb +2 -4
- data/lib/sorcery/controller/submodules/remember_me.rb +3 -7
- data/lib/sorcery/controller/submodules/session_timeout.rb +4 -7
- data/lib/sorcery/controller.rb +1 -1
- data/lib/sorcery/model/submodules/reset_password.rb +2 -0
- data/lib/sorcery/model.rb +11 -6
- data/lib/sorcery/protocols/oauth2.rb +1 -0
- data/lib/sorcery/providers/battlenet.rb +51 -0
- data/lib/sorcery/providers/line.rb +20 -4
- data/lib/sorcery/providers/slack.rb +1 -1
- data/lib/sorcery/version.rb +1 -1
- data/sorcery.gemspec +3 -4
- data/spec/controllers/controller_oauth2_spec.rb +23 -5
- data/spec/controllers/controller_oauth_spec.rb +6 -0
- data/spec/providers/examples_spec.rb +17 -0
- data/spec/rails_app/app/controllers/application_controller.rb +2 -0
- data/spec/rails_app/app/controllers/sorcery_controller.rb +21 -1
- data/spec/rails_app/config/routes.rb +3 -0
- data/spec/shared_examples/user_reset_password_shared_examples.rb +12 -0
- data/spec/shared_examples/user_shared_examples.rb +2 -2
- data/spec/support/migration_helper.rb +12 -2
- data/spec/support/providers/examples.rb +11 -0
- metadata +25 -22
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e28e735926cc783f48b5f8708fcdba63b66d20c54acb46197a633c3a2c27ed9f
|
|
4
|
+
data.tar.gz: c48a71718894e02b6d556143d7019b64698d938faf3d82cc97362314e5d821eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94876b13d7838ab273e7cf01489914dfce2cdf9f27259f2f3dcb98d62dfe126b65daf3dde018c6423e4a6fbe9b526339c85dfa978dcdf61698ce77b42f722a4d
|
|
7
|
+
data.tar.gz: 4defd2381f95ab3b89c859430a68fe9c0bb5068d09276100c80996b196448c1289057b3f8059c2d1188199bd0ae3852c6bd5c33a0701c61cd27c1acd7b692ac1
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Which Ruby version to use. You may need to use a more restrictive version,
|
|
2
|
+
# e.g. `3.0`
|
|
3
|
+
ARG VARIANT=3.0
|
|
4
|
+
|
|
5
|
+
# Pull Microsoft's ruby devcontainer base image
|
|
6
|
+
FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}
|
|
7
|
+
|
|
8
|
+
# Ensure we're running the latest bundler, as what ships with the Ruby image may
|
|
9
|
+
# not be current, and bundler will auto-downgrade to match the Gemfile.lock
|
|
10
|
+
RUN gem install bundler
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Ruby",
|
|
3
|
+
"build": {
|
|
4
|
+
"dockerfile": "Dockerfile"
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
// Configure tool-specific properties.
|
|
8
|
+
"customizations": {
|
|
9
|
+
// Configure properties specific to VS Code.
|
|
10
|
+
"vscode": {
|
|
11
|
+
// Add the IDs of extensions you want installed when the container is created.
|
|
12
|
+
"extensions": [
|
|
13
|
+
"rebornix.Ruby"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// Set the environment variables
|
|
19
|
+
// "runArgs": ["--env-file",".env"],
|
|
20
|
+
|
|
21
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
22
|
+
// "forwardPorts": [],
|
|
23
|
+
|
|
24
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
25
|
+
"postCreateCommand": "bash .devcontainer/postcreate.sh",
|
|
26
|
+
|
|
27
|
+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
|
28
|
+
"remoteUser": "vscode"
|
|
29
|
+
}
|
data/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: athix
|
data/.github/ISSUE_TEMPLATE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Please complete all sections.
|
|
1
|
+
<!-- Please complete all sections. -->
|
|
2
2
|
|
|
3
3
|
### Configuration
|
|
4
4
|
|
|
@@ -9,12 +9,16 @@ Please complete all sections.
|
|
|
9
9
|
|
|
10
10
|
### Expected Behavior
|
|
11
11
|
|
|
12
|
-
Tell us what should happen.
|
|
12
|
+
<!-- Tell us what should happen. -->
|
|
13
13
|
|
|
14
14
|
### Actual Behavior
|
|
15
15
|
|
|
16
|
-
Tell us what happens instead.
|
|
16
|
+
<!-- Tell us what happens instead. -->
|
|
17
17
|
|
|
18
18
|
### Steps to Reproduce
|
|
19
19
|
|
|
20
|
-
Please list all steps to reproduce the issue.
|
|
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
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2021-04-04 05:00:11 UTC using RuboCop version 0.88.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -13,12 +13,12 @@ Gemspec/RequiredRubyVersion:
|
|
|
13
13
|
Exclude:
|
|
14
14
|
- 'sorcery.gemspec'
|
|
15
15
|
|
|
16
|
-
# Offense count:
|
|
16
|
+
# Offense count: 2
|
|
17
17
|
# Cop supports --auto-correct.
|
|
18
|
-
# Configuration parameters:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
# Configuration parameters: IndentationWidth.
|
|
19
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
20
|
+
Layout/FirstHashElementIndentation:
|
|
21
|
+
EnforcedStyle: consistent
|
|
22
22
|
|
|
23
23
|
# Offense count: 83
|
|
24
24
|
# Cop supports --auto-correct.
|
|
@@ -29,6 +29,13 @@ Layout/EmptyLineBetweenDefs:
|
|
|
29
29
|
Layout/HashAlignment:
|
|
30
30
|
Enabled: false
|
|
31
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
|
+
|
|
32
39
|
# Offense count: 2
|
|
33
40
|
# Configuration parameters: AllowSafeAssignment.
|
|
34
41
|
Lint/AssignmentInCondition:
|
|
@@ -58,15 +65,6 @@ Lint/SendWithMixinArgument:
|
|
|
58
65
|
- 'lib/sorcery/engine.rb'
|
|
59
66
|
- 'lib/sorcery/test_helpers/internal/rails.rb'
|
|
60
67
|
|
|
61
|
-
# Offense count: 4
|
|
62
|
-
# Configuration parameters: AllowComments.
|
|
63
|
-
Lint/SuppressedException:
|
|
64
|
-
Exclude:
|
|
65
|
-
- 'lib/sorcery/controller.rb'
|
|
66
|
-
- 'lib/sorcery/model.rb'
|
|
67
|
-
- 'spec/rails_app/config/application.rb'
|
|
68
|
-
- 'spec/shared_examples/user_shared_examples.rb'
|
|
69
|
-
|
|
70
68
|
# Offense count: 2
|
|
71
69
|
# Cop supports --auto-correct.
|
|
72
70
|
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
|
@@ -74,6 +72,20 @@ Lint/UnusedBlockArgument:
|
|
|
74
72
|
Exclude:
|
|
75
73
|
- 'spec/shared_examples/user_shared_examples.rb'
|
|
76
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
|
+
|
|
77
89
|
# Offense count: 1
|
|
78
90
|
# Configuration parameters: EnforcedStyle.
|
|
79
91
|
# SupportedStyles: annotated, template, unannotated
|
|
@@ -81,21 +93,13 @@ Style/FormatStringToken:
|
|
|
81
93
|
Exclude:
|
|
82
94
|
- 'lib/generators/sorcery/install_generator.rb'
|
|
83
95
|
|
|
84
|
-
# Offense count:
|
|
96
|
+
# Offense count: 125
|
|
85
97
|
# Cop supports --auto-correct.
|
|
86
98
|
# Configuration parameters: EnforcedStyle.
|
|
87
|
-
# SupportedStyles: always, never
|
|
99
|
+
# SupportedStyles: always, always_true, never
|
|
88
100
|
Style/FrozenStringLiteralComment:
|
|
89
101
|
Enabled: false
|
|
90
102
|
|
|
91
|
-
# Offense count: 3
|
|
92
|
-
# Configuration parameters: MinBodyLength.
|
|
93
|
-
Style/GuardClause:
|
|
94
|
-
Exclude:
|
|
95
|
-
- 'lib/sorcery/controller/submodules/brute_force_protection.rb'
|
|
96
|
-
- 'lib/sorcery/controller/submodules/http_basic_auth.rb'
|
|
97
|
-
- 'lib/sorcery/controller/submodules/remember_me.rb'
|
|
98
|
-
|
|
99
103
|
# Offense count: 3
|
|
100
104
|
# Cop supports --auto-correct.
|
|
101
105
|
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
@@ -105,11 +109,17 @@ Style/HashSyntax:
|
|
|
105
109
|
- 'lib/sorcery/adapters/active_record_adapter.rb'
|
|
106
110
|
- 'lib/sorcery/test_helpers/rails/integration.rb'
|
|
107
111
|
|
|
108
|
-
# Offense count:
|
|
112
|
+
# Offense count: 34
|
|
109
113
|
# Cop supports --auto-correct.
|
|
110
114
|
Style/IfUnlessModifier:
|
|
111
115
|
Enabled: false
|
|
112
116
|
|
|
117
|
+
# Offense count: 1
|
|
118
|
+
# Cop supports --auto-correct.
|
|
119
|
+
Style/MultilineIfModifier:
|
|
120
|
+
Exclude:
|
|
121
|
+
- 'lib/sorcery/providers/line.rb'
|
|
122
|
+
|
|
113
123
|
# Offense count: 2
|
|
114
124
|
# Cop supports --auto-correct.
|
|
115
125
|
Style/RedundantBegin:
|
|
@@ -137,6 +147,14 @@ Style/StringLiterals:
|
|
|
137
147
|
- 'spec/controllers/controller_oauth2_spec.rb'
|
|
138
148
|
- 'spec/sorcery_crypto_providers_spec.rb'
|
|
139
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
|
+
|
|
140
158
|
# Offense count: 2
|
|
141
159
|
# Cop supports --auto-correct.
|
|
142
160
|
Style/UnpackFirst:
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
## HEAD
|
|
3
3
|
|
|
4
|
+
## 0.16.5
|
|
5
|
+
|
|
6
|
+
* Raise ArgumentError when calling change_password! with blank password [#333](https://github.com/Sorcery/sorcery/pull/333)
|
|
7
|
+
* Update auth_scheme to oauth2 v1 defaults per v2 breaking changes [#341](https://github.com/Sorcery/sorcery/pull/341)
|
|
8
|
+
|
|
9
|
+
## 0.16.4
|
|
10
|
+
|
|
11
|
+
* Adapt to open request protection strategy of rails 7.0 [#318](https://github.com/Sorcery/sorcery/pull/318)
|
|
12
|
+
* Update OAuth2 gem to v2 per v1 deprecation [#323](https://github.com/Sorcery/sorcery/pull/323)
|
|
13
|
+
* Fixed typo in error message [#310](https://github.com/Sorcery/sorcery/pull/310)
|
|
14
|
+
|
|
15
|
+
## 0.16.3
|
|
16
|
+
|
|
17
|
+
* Fix provider instantiation for plural provider names (eg. okta) [#305](https://github.com/Sorcery/sorcery/pull/305)
|
|
18
|
+
|
|
19
|
+
## 0.16.2
|
|
20
|
+
|
|
21
|
+
* Inline core migration index definition [#281](https://github.com/Sorcery/sorcery/pull/281)
|
|
22
|
+
* Add missing remember_me attributes to config [#180](https://github.com/Sorcery/sorcery/pull/180)
|
|
23
|
+
* Fix MongoID adapter breaking on save [#284](https://github.com/Sorcery/sorcery/pull/284)
|
|
24
|
+
* Don't pass token to Slack in query params. Prevents 'invalid_auth' error [#287](https://github.com/Sorcery/sorcery/pull/287)
|
|
25
|
+
* Fix valid_password? not using configured values when called alone [#293](https://github.com/Sorcery/sorcery/pull/293)
|
|
26
|
+
|
|
27
|
+
## 0.16.1
|
|
28
|
+
|
|
29
|
+
* Fix default table name being incorrect in migration generator [#274](https://github.com/Sorcery/sorcery/pull/274)
|
|
30
|
+
* Update `oauth` dependency per CVE-2016-11086
|
|
31
|
+
|
|
32
|
+
## 0.16.0
|
|
33
|
+
|
|
34
|
+
* Add BattleNet Provider [#260](https://github.com/Sorcery/sorcery/pull/260)
|
|
35
|
+
* Fix failing isolated tests [#249](https://github.com/Sorcery/sorcery/pull/249)
|
|
36
|
+
* Support LINE login v2.1 [#251](https://github.com/Sorcery/sorcery/pull/251)
|
|
37
|
+
* Update generators to better support namespaces [#237](https://github.com/Sorcery/sorcery/pull/237)
|
|
38
|
+
* Add support for Rails 6 [#238](https://github.com/Sorcery/sorcery/pull/238)
|
|
39
|
+
* Fix ruby 2.7 deprecation warnings [#241](https://github.com/Sorcery/sorcery/pull/241)
|
|
40
|
+
* Use set to ensure unique arrays [#233](https://github.com/Sorcery/sorcery/pull/233)
|
|
41
|
+
|
|
42
|
+
## 0.15.1
|
|
43
|
+
|
|
44
|
+
* Update `oauth` dependency per CVE-2016-11086
|
|
45
|
+
|
|
4
46
|
## 0.15.0
|
|
5
47
|
|
|
6
48
|
* Fix brute force vuln due to callbacks no being ran [#235](https://github.com/Sorcery/sorcery/pull/235)
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -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
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
|
data/README.md
CHANGED
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://rubygems.org/gems/sorcery)
|
|
4
4
|
[](https://rubygems.org/gems/sorcery)
|
|
5
|
-
[](https://codeclimate.com/github/Sorcery/sorcery)
|
|
7
|
-
[](http://inch-ci.org/github/Sorcery/sorcery)
|
|
8
|
-
[](https://gitter.im/Sorcery/sorcery?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
5
|
+
[](https://github.com/Sorcery/sorcery/actions/workflows/ruby.yml)
|
|
9
6
|
|
|
10
7
|
Magical Authentication for Rails. Supports ActiveRecord, DataMapper, Mongoid and MongoMapper.
|
|
11
8
|
|
|
@@ -238,14 +235,14 @@ Feel free to ask questions using these contact details:
|
|
|
238
235
|
|
|
239
236
|
**Current Maintainers:**
|
|
240
237
|
|
|
241
|
-
-
|
|
242
|
-
- Josh Buker ([@athix](https://github.com/athix)) | [Email](mailto:jbuker@aeonsplice.com)
|
|
238
|
+
- Josh Buker ([@athix](https://github.com/athix)) | [Email](mailto:crypto+sorcery@joshbuker.com?subject=Sorcery)
|
|
243
239
|
|
|
244
240
|
**Past Maintainers:**
|
|
245
241
|
|
|
246
242
|
- Noam Ben-Ari ([@NoamB](https://github.com/NoamB)) | [Email](mailto:nbenari@gmail.com) | [Twitter](https://twitter.com/nbenari)
|
|
247
243
|
- Kir Shatrov ([@kirs](https://github.com/kirs)) | [Email](mailto:shatrov@me.com) | [Twitter](https://twitter.com/Kiiiir)
|
|
248
244
|
- Grzegorz Witek ([@arnvald](https://github.com/arnvald)) | [Email](mailto:arnvald.to@gmail.com) | [Twitter](https://twitter.com/arnvald)
|
|
245
|
+
- Chase Gilliam ([@Ch4s3](https://github.com/Ch4s3)) | [Email](mailto:chase.gilliam@gmail.com)
|
|
249
246
|
|
|
250
247
|
## License
|
|
251
248
|
|
data/Rakefile
CHANGED
data/SECURITY.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| --------- | ------------------ |
|
|
7
|
+
| ~> 0.16.0 | :white_check_mark: |
|
|
8
|
+
| ~> 0.15.0 | :white_check_mark: |
|
|
9
|
+
| < 0.15.0 | :x: |
|
|
10
|
+
|
|
11
|
+
## Reporting a Vulnerability
|
|
12
|
+
|
|
13
|
+
Email the current maintainer(s) with a description of the vulnerability. You
|
|
14
|
+
should expect a response within 48 hours. If the vulnerability is accepted, a
|
|
15
|
+
Github advisory will be created and eventually released with a CVE corresponding
|
|
16
|
+
to the issue found.
|
|
17
|
+
|
|
18
|
+
A list of the current maintainers can be found on the README under the contact
|
|
19
|
+
section. See: [README.md](https://github.com/Sorcery/sorcery#contact)
|
|
@@ -12,6 +12,10 @@ module Sorcery
|
|
|
12
12
|
options[:model] ? options[:model].classify : 'User'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
def tableized_model_class
|
|
16
|
+
options[:model] ? options[:model].gsub(/::/, '').tableize : 'users'
|
|
17
|
+
end
|
|
18
|
+
|
|
15
19
|
def model_path
|
|
16
20
|
@model_path ||= File.join('app', 'models', "#{file_path}.rb")
|
|
17
21
|
end
|
|
@@ -222,13 +222,25 @@ Rails.application.config.sorcery.configure do |config|
|
|
|
222
222
|
# config.line.key = ""
|
|
223
223
|
# config.line.secret = ""
|
|
224
224
|
# config.line.callback_url = "http://mydomain.com:3000/oauth/callback?provider=line"
|
|
225
|
+
# config.line.scope = "profile"
|
|
226
|
+
# config.line.bot_prompt = "normal"
|
|
227
|
+
# config.line.user_info_mapping = {name: 'displayName'}
|
|
225
228
|
|
|
226
|
-
|
|
229
|
+
|
|
230
|
+
# For information about Discord API
|
|
227
231
|
# https://discordapp.com/developers/docs/topics/oauth2
|
|
228
232
|
# config.discord.key = "xxxxxx"
|
|
229
233
|
# config.discord.secret = "xxxxxx"
|
|
230
234
|
# config.discord.callback_url = "http://localhost:3000/oauth/callback?provider=discord"
|
|
231
235
|
# config.discord.scope = "email guilds"
|
|
236
|
+
|
|
237
|
+
# For information about Battlenet API
|
|
238
|
+
# https://develop.battle.net/documentation/guides/using-oauth
|
|
239
|
+
# config.battlenet.site = "https://eu.battle.net/" #See Website for other Regional Domains
|
|
240
|
+
# config.battlenet.key = "xxxxxx"
|
|
241
|
+
# config.battlenet.secret = "xxxxxx"
|
|
242
|
+
# config.battlenet.callback_url = "http://localhost:3000/oauth/callback?provider=battlenet"
|
|
243
|
+
# config.battlenet.scope = "openid"
|
|
232
244
|
# --- user config ---
|
|
233
245
|
config.user_config do |user|
|
|
234
246
|
# -- core --
|
|
@@ -294,6 +306,16 @@ Rails.application.config.sorcery.configure do |config|
|
|
|
294
306
|
# user.subclasses_inherit_config =
|
|
295
307
|
|
|
296
308
|
# -- remember_me --
|
|
309
|
+
# change default remember_me_token attribute.
|
|
310
|
+
# Default: `:remember_me_token`
|
|
311
|
+
#
|
|
312
|
+
# user.remember_me_token_attribute_name =
|
|
313
|
+
|
|
314
|
+
# change default remember_me_token_expires_at attribute.
|
|
315
|
+
# Default: `:remember_me_token_expires_at`
|
|
316
|
+
#
|
|
317
|
+
# user.remember_me_token_expires_at_attribute_name =
|
|
318
|
+
|
|
297
319
|
# How long in seconds the session length will be
|
|
298
320
|
# Default: `60 * 60 * 24 * 7`
|
|
299
321
|
#
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class SorceryActivityLogging < <%= migration_class_name %>
|
|
2
2
|
def change
|
|
3
|
-
add_column :<%=
|
|
4
|
-
add_column :<%=
|
|
5
|
-
add_column :<%=
|
|
6
|
-
add_column :<%=
|
|
3
|
+
add_column :<%= tableized_model_class %>, :last_login_at, :datetime, default: nil
|
|
4
|
+
add_column :<%= tableized_model_class %>, :last_logout_at, :datetime, default: nil
|
|
5
|
+
add_column :<%= tableized_model_class %>, :last_activity_at, :datetime, default: nil
|
|
6
|
+
add_column :<%= tableized_model_class %>, :last_login_from_ip_address, :string, default: nil
|
|
7
7
|
|
|
8
|
-
add_index :<%=
|
|
8
|
+
add_index :<%= tableized_model_class %>, [:last_logout_at, :last_activity_at]
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
class SorceryBruteForceProtection < <%= migration_class_name %>
|
|
2
2
|
def change
|
|
3
|
-
add_column :<%=
|
|
4
|
-
add_column :<%=
|
|
5
|
-
add_column :<%=
|
|
3
|
+
add_column :<%= tableized_model_class %>, :failed_logins_count, :integer, default: 0
|
|
4
|
+
add_column :<%= tableized_model_class %>, :lock_expires_at, :datetime, default: nil
|
|
5
|
+
add_column :<%= tableized_model_class %>, :unlock_token, :string, default: nil
|
|
6
6
|
|
|
7
|
-
add_index :<%=
|
|
7
|
+
add_index :<%= tableized_model_class %>, :unlock_token
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
class SorceryCore < <%= migration_class_name %>
|
|
2
2
|
def change
|
|
3
|
-
create_table :<%=
|
|
4
|
-
t.string :email, null: false
|
|
3
|
+
create_table :<%= tableized_model_class %> do |t|
|
|
4
|
+
t.string :email, null: false, index: { unique: true }
|
|
5
5
|
t.string :crypted_password
|
|
6
6
|
t.string :salt
|
|
7
7
|
|
|
8
8
|
t.timestamps null: false
|
|
9
9
|
end
|
|
10
|
-
|
|
11
|
-
add_index :<%= model_class_name.tableize %>, :email, unique: true
|
|
12
10
|
end
|
|
13
11
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class SorceryExternal < <%= migration_class_name %>
|
|
2
2
|
def change
|
|
3
3
|
create_table :authentications do |t|
|
|
4
|
-
t.integer :<%=
|
|
4
|
+
t.integer :<%= tableized_model_class.singularize %>_id, null: false
|
|
5
5
|
t.string :provider, :uid, null: false
|
|
6
6
|
|
|
7
7
|
t.timestamps null: false
|