clearance-deprecated_password_strategies 1.10.1
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +12 -0
- data/CONTRIBUTING.md +30 -0
- data/Gemfile +2 -0
- data/LICENSE +19 -0
- data/README.md +59 -0
- data/Rakefile +9 -0
- data/clearance-deprecated_password_strategies.gemspec +26 -0
- data/lib/clearance-deprecated_password_strategies.rb +4 -0
- data/lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb +58 -0
- data/lib/clearance/password_strategies/deprecated/blowfish.rb +46 -0
- data/lib/clearance/password_strategies/deprecated/sha1.rb +41 -0
- data/lib/clearance/password_strategies/deprecated/version.rb +7 -0
- data/spec/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1_spec.rb +115 -0
- data/spec/clearance/password_strategies/deprecated/blowfish_spec.rb +42 -0
- data/spec/clearance/password_strategies/deprecated/sha1_spec.rb +52 -0
- data/spec/spec_helper.rb +42 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67f81e06d47c454b68411d9c1483f8779bd09e8a
|
4
|
+
data.tar.gz: 1acef3e65cd0ccbef987844a57ed60ed93f5ebee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 106c50b3b1db2ba45f64e00d17312623160d6bae524d22d62fbba6207f4f89e9ac2446b0a1faa09f8cca9cd52de220c0e8ffdbb676f594fe4be9fdbf070c957d
|
7
|
+
data.tar.gz: c41a4d20e74b5db4499f1f99b7976f28c4bc9b5eb211d3b08571772762669c7931002e48dbe7c4afa24a718ae58394e350750f42d621c172067c8b964e483fe6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
We love pull requests from everyone. By participating in this project, you
|
2
|
+
agree to abide by the thoughtbot [code of conduct].
|
3
|
+
|
4
|
+
[code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
|
5
|
+
|
6
|
+
## Dependencies
|
7
|
+
|
8
|
+
1. Install with `bundle install`
|
9
|
+
|
10
|
+
## Contributing
|
11
|
+
|
12
|
+
1. Fork the repo.
|
13
|
+
|
14
|
+
2. Run the tests. We only take pull requests with passing tests, and it's great
|
15
|
+
to know that you have a clean slate: `rake`
|
16
|
+
|
17
|
+
3. Add a test for your change. Only refactoring and documentation changes
|
18
|
+
require no new tests. If you are adding functionality or fixing a bug, we need
|
19
|
+
a test!
|
20
|
+
|
21
|
+
4. Make the test pass.
|
22
|
+
|
23
|
+
5. Push to your fork and submit a pull request.
|
24
|
+
|
25
|
+
|
26
|
+
At this point you're waiting on us. We like to at least comment on, if not
|
27
|
+
accept, pull requests within three business days (and, typically, one business
|
28
|
+
day). We may suggest some changes or improvements or alternatives.
|
29
|
+
|
30
|
+
And in case we didn't emphasize it enough: we love tests!
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 thoughtbot, inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# clearance-deprecated_password_strategies
|
2
|
+
|
3
|
+
This gem contains the three password strategies deprecated in Clearance 1.10.0:
|
4
|
+
|
5
|
+
* Clearance::PasswordStrategies::Blowfish
|
6
|
+
* Clearance::PasswordStrategies::SHA1
|
7
|
+
* Clearance::PasswordStrategies::BCryptMigrationFromSHA1
|
8
|
+
|
9
|
+
These strategies were removed from Clearance because we no longer use or
|
10
|
+
maintain them.
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'clearance-deprecated_password_strategies'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
See the [CONTRIBUTING] document.
|
27
|
+
Thank you, [contributors]!
|
28
|
+
|
29
|
+
[CONTRIBUTING]: CONTRIBUTING.md
|
30
|
+
[contributors]: https://github.com/thoughtbot/templates/graphs/contributors
|
31
|
+
|
32
|
+
## Need Help?
|
33
|
+
|
34
|
+
We offer 1-on-1 coaching. [Get in touch] if you'd like to learn more about
|
35
|
+
starting, maintaining, and contributing to an open source project.
|
36
|
+
|
37
|
+
[Get in touch]: http://coaching.thoughtbot.com/rails/?utm_source=github
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
Open source templates are Copyright (c) 2015 thoughtbot, inc. It contains free
|
42
|
+
software that may be redistributed under the terms specified in the [LICENSE]
|
43
|
+
file.
|
44
|
+
|
45
|
+
[LICENSE]: /LICENSE
|
46
|
+
|
47
|
+
## About
|
48
|
+
|
49
|
+

|
50
|
+
|
51
|
+
Templates are maintained and funded by thoughtbot, inc.
|
52
|
+
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
53
|
+
|
54
|
+
We love open source software!
|
55
|
+
See [our other projects][community]
|
56
|
+
or [hire us][hire] to help build your product.
|
57
|
+
|
58
|
+
[community]: https://thoughtbot.com/community?utm_source=github
|
59
|
+
[hire]: https://thoughtbot.com/hire-us?utm_source=github
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'clearance/password_strategies/deprecated/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "clearance-deprecated_password_strategies"
|
8
|
+
spec.version = Clearance::PasswordStrategies::Deprecated::VERSION
|
9
|
+
spec.authors = ["Derek Prior"]
|
10
|
+
spec.email = ["derekprior@gmail.com"]
|
11
|
+
spec.summary = "Deprecated password strategies extracted from Clearance"
|
12
|
+
spec.description = "SHA1, Blowfish, and SHA1 to BCrypt migration strategies"
|
13
|
+
spec.homepage = "https://github.com/thoughtbot/clearance-deprecated-password-strategies"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", ">= 1.7"
|
21
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
22
|
+
spec.add_development_dependency "rspec", ">= 3.1"
|
23
|
+
|
24
|
+
spec.add_dependency "activesupport"
|
25
|
+
spec.add_dependency "clearance", ">= 1.10"
|
26
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Clearance
|
2
|
+
module PasswordStrategies
|
3
|
+
module BCryptMigrationFromSHA1
|
4
|
+
class BCryptUser
|
5
|
+
include Clearance::PasswordStrategies::BCrypt
|
6
|
+
|
7
|
+
def initialize(user)
|
8
|
+
@user = user
|
9
|
+
end
|
10
|
+
|
11
|
+
delegate :encrypted_password, :encrypted_password=, to: :@user
|
12
|
+
end
|
13
|
+
|
14
|
+
class SHA1User
|
15
|
+
include Clearance::PasswordStrategies::SHA1
|
16
|
+
|
17
|
+
def initialize(user)
|
18
|
+
@user = user
|
19
|
+
end
|
20
|
+
|
21
|
+
delegate :salt, :salt=, :encrypted_password, :encrypted_password=, to: :@user
|
22
|
+
end
|
23
|
+
|
24
|
+
def authenticated?(password)
|
25
|
+
authenticated_with_sha1?(password) || authenticated_with_bcrypt?(password)
|
26
|
+
end
|
27
|
+
|
28
|
+
def password=(new_password)
|
29
|
+
@password = new_password
|
30
|
+
BCryptUser.new(self).password = new_password
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def authenticated_with_bcrypt?(password)
|
36
|
+
begin
|
37
|
+
BCryptUser.new(self).authenticated? password
|
38
|
+
rescue ::BCrypt::Errors::InvalidHash
|
39
|
+
false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def authenticated_with_sha1?(password)
|
44
|
+
if sha1_password?
|
45
|
+
if SHA1User.new(self).authenticated? password
|
46
|
+
self.password = password
|
47
|
+
self.save
|
48
|
+
true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def sha1_password?
|
54
|
+
self.encrypted_password =~ /^[a-f0-9]{40}$/
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/core_ext/object/blank"
|
3
|
+
require "base64"
|
4
|
+
require "openssl"
|
5
|
+
|
6
|
+
module Clearance
|
7
|
+
module PasswordStrategies
|
8
|
+
module Blowfish
|
9
|
+
def authenticated?(password)
|
10
|
+
encrypted_password == encrypt(password)
|
11
|
+
end
|
12
|
+
|
13
|
+
def password=(new_password)
|
14
|
+
@password = new_password
|
15
|
+
initialize_salt_if_necessary
|
16
|
+
|
17
|
+
if new_password.present?
|
18
|
+
self.encrypted_password = encrypt(new_password)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def encrypt(string)
|
25
|
+
generate_hash("--#{salt}--#{string}--")
|
26
|
+
end
|
27
|
+
|
28
|
+
def generate_hash(string)
|
29
|
+
cipher = OpenSSL::Cipher::Cipher.new("bf-cbc").encrypt
|
30
|
+
cipher.key = Digest::SHA256.digest(salt)
|
31
|
+
hash = cipher.update(string) << cipher.final
|
32
|
+
Base64.encode64(hash).encode("utf-8")
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize_salt_if_necessary
|
36
|
+
if salt.blank?
|
37
|
+
self.salt = generate_salt
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def generate_salt
|
42
|
+
Base64.encode64(SecureRandom.hex(20)).encode("utf-8")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Clearance
|
2
|
+
module PasswordStrategies
|
3
|
+
module SHA1
|
4
|
+
require 'digest/sha1'
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
def authenticated?(password)
|
8
|
+
encrypted_password == encrypt(password)
|
9
|
+
end
|
10
|
+
|
11
|
+
def password=(new_password)
|
12
|
+
@password = new_password
|
13
|
+
initialize_salt_if_necessary
|
14
|
+
|
15
|
+
if new_password.present?
|
16
|
+
self.encrypted_password = encrypt(new_password)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def encrypt(string)
|
23
|
+
generate_hash "--#{salt}--#{string}--"
|
24
|
+
end
|
25
|
+
|
26
|
+
def generate_hash(string)
|
27
|
+
Digest::SHA1.hexdigest(string).encode "UTF-8"
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize_salt_if_necessary
|
31
|
+
if salt.blank?
|
32
|
+
self.salt = generate_salt
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def generate_salt
|
37
|
+
SecureRandom.hex(20).encode("UTF-8")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clearance::PasswordStrategies::BCryptMigrationFromSHA1 do
|
4
|
+
describe "#password=" do
|
5
|
+
it "encrypts the password into a BCrypt-encrypted encrypted_password" do
|
6
|
+
stub_bcrypt_password
|
7
|
+
|
8
|
+
expect(model_instance.encrypted_password).to eq encrypted_password
|
9
|
+
end
|
10
|
+
|
11
|
+
it "encrypts with BCrypt" do
|
12
|
+
stub_bcrypt_password
|
13
|
+
|
14
|
+
expect(BCrypt::Password).to have_received(:create).
|
15
|
+
with(password, anything)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "sets the pasword on the subject" do
|
19
|
+
stub_bcrypt_password
|
20
|
+
|
21
|
+
expect(model_instance.password).to be_present
|
22
|
+
end
|
23
|
+
|
24
|
+
def stub_bcrypt_password
|
25
|
+
model_instance.salt = salt
|
26
|
+
digestable = "--#{salt}--#{password}--"
|
27
|
+
model_instance.encrypted_password = Digest::SHA1.hexdigest(digestable)
|
28
|
+
allow(BCrypt::Password).to receive(:create).and_return(encrypted_password)
|
29
|
+
model_instance.password = password
|
30
|
+
end
|
31
|
+
|
32
|
+
def encrypted_password
|
33
|
+
@encrypted_password ||= double("encrypted password")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#authenticated?" do
|
38
|
+
context "with a SHA1-encrypted password" do
|
39
|
+
it "is authenticated" do
|
40
|
+
model_instance.salt = salt
|
41
|
+
model_instance.encrypted_password = sha1_hash
|
42
|
+
allow(model_instance).to receive(:save)
|
43
|
+
|
44
|
+
expect(model_instance).to be_authenticated(password)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "changes the hash into a BCrypt-encrypted one" do
|
48
|
+
model_instance.salt = salt
|
49
|
+
model_instance.encrypted_password = sha1_hash
|
50
|
+
allow(model_instance).to receive(:save)
|
51
|
+
|
52
|
+
model_instance.authenticated? password
|
53
|
+
|
54
|
+
expect(model_instance.encrypted_password).not_to eq sha1_hash
|
55
|
+
end
|
56
|
+
|
57
|
+
it "does not raise a BCrypt error for invalid passwords" do
|
58
|
+
model_instance.salt = salt
|
59
|
+
model_instance.encrypted_password = sha1_hash
|
60
|
+
|
61
|
+
expect do
|
62
|
+
model_instance.authenticated? "bad" + password
|
63
|
+
end.not_to raise_error
|
64
|
+
end
|
65
|
+
|
66
|
+
it "saves the subject to database" do
|
67
|
+
model_instance.salt = salt
|
68
|
+
model_instance.encrypted_password = sha1_hash
|
69
|
+
allow(model_instance).to receive(:save)
|
70
|
+
|
71
|
+
model_instance.authenticated? password
|
72
|
+
|
73
|
+
expect(model_instance).to have_received(:save)
|
74
|
+
end
|
75
|
+
|
76
|
+
def sha1_hash
|
77
|
+
Digest::SHA1.hexdigest("--#{salt}--#{password}--")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "with a BCrypt-encrypted password" do
|
82
|
+
it "is authenticated" do
|
83
|
+
model_instance.encrypted_password = bcrypt_hash
|
84
|
+
|
85
|
+
expect(model_instance).to be_authenticated(password)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "does not change the hash" do
|
89
|
+
model_instance.encrypted_password = bcrypt_hash
|
90
|
+
|
91
|
+
model_instance.authenticated? password
|
92
|
+
|
93
|
+
expect(model_instance.encrypted_password.to_s).to eq bcrypt_hash.to_s
|
94
|
+
end
|
95
|
+
|
96
|
+
def bcrypt_hash
|
97
|
+
@bcrypt_hash ||= ::BCrypt::Password.create(password)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def model_instance
|
103
|
+
@model_instance ||= fake_model_with_password_strategy(
|
104
|
+
Clearance::PasswordStrategies::BCryptMigrationFromSHA1
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
def salt
|
109
|
+
"salt"
|
110
|
+
end
|
111
|
+
|
112
|
+
def password
|
113
|
+
"password"
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clearance::PasswordStrategies::Blowfish do
|
4
|
+
subject do
|
5
|
+
fake_model_with_password_strategy(Clearance::PasswordStrategies::Blowfish)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#password=" do
|
9
|
+
context "when the password is set" do
|
10
|
+
let(:salt) { "salt" }
|
11
|
+
let(:password) { "password" }
|
12
|
+
|
13
|
+
before do
|
14
|
+
subject.salt = salt
|
15
|
+
subject.password = password
|
16
|
+
end
|
17
|
+
|
18
|
+
it "does not initialize the salt" do
|
19
|
+
expect(subject.salt).to eq salt
|
20
|
+
end
|
21
|
+
|
22
|
+
it "encrypts the password using Blowfish and the existing salt" do
|
23
|
+
cipher = OpenSSL::Cipher::Cipher.new("bf-cbc").encrypt
|
24
|
+
cipher.key = Digest::SHA256.digest(salt)
|
25
|
+
expected = cipher.update("--#{salt}--#{password}--") << cipher.final
|
26
|
+
encrypted_password = Base64.decode64(subject.encrypted_password)
|
27
|
+
expect(encrypted_password).to eq expected
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when the salt is not set" do
|
32
|
+
before do
|
33
|
+
subject.salt = nil
|
34
|
+
subject.password = "whatever"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should initialize the salt" do
|
38
|
+
expect(subject.salt).not_to be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Clearance::PasswordStrategies::SHA1 do
|
4
|
+
describe "#password=" do
|
5
|
+
context "when the salt is set" do
|
6
|
+
it "does not initialize the salt when assigned" do
|
7
|
+
model_instance = fake_model_with_sha1_strategy
|
8
|
+
|
9
|
+
model_instance.salt = salt
|
10
|
+
|
11
|
+
expect(model_instance.salt).to eq salt
|
12
|
+
end
|
13
|
+
|
14
|
+
it "encrypts the password using SHA1 and the existing salt" do
|
15
|
+
model_instance = fake_model_with_sha1_strategy
|
16
|
+
model_instance.salt = salt
|
17
|
+
model_instance.password = password
|
18
|
+
|
19
|
+
expected = Digest::SHA1.hexdigest("--#{salt}--#{password}--")
|
20
|
+
|
21
|
+
expect(model_instance.encrypted_password).to eq expected
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "when the salt is set" do
|
26
|
+
it "generates the salt" do
|
27
|
+
model_instance = fake_model_with_sha1_strategy
|
28
|
+
model_instance.password = ""
|
29
|
+
|
30
|
+
expect(model_instance.salt).not_to be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "doesn't encrypt the password" do
|
34
|
+
model_instance = fake_model_with_sha1_strategy
|
35
|
+
|
36
|
+
expect(model_instance.encrypted_password).to be_nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def fake_model_with_sha1_strategy
|
42
|
+
fake_model_with_password_strategy(Clearance::PasswordStrategies::SHA1)
|
43
|
+
end
|
44
|
+
|
45
|
+
def salt
|
46
|
+
"salt"
|
47
|
+
end
|
48
|
+
|
49
|
+
def password
|
50
|
+
"password"
|
51
|
+
end
|
52
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
require "active_support/core_ext/module/delegation"
|
3
|
+
require "clearance/password_strategies/bcrypt"
|
4
|
+
require "clearance-deprecated_password_strategies"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.expect_with :rspec do |expectations|
|
8
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
9
|
+
end
|
10
|
+
|
11
|
+
config.mock_with :rspec do |mocks|
|
12
|
+
mocks.verify_partial_doubles = true
|
13
|
+
end
|
14
|
+
|
15
|
+
config.warnings = true
|
16
|
+
|
17
|
+
if config.files_to_run.one?
|
18
|
+
config.default_formatter = "doc"
|
19
|
+
end
|
20
|
+
|
21
|
+
config.order = :random
|
22
|
+
|
23
|
+
Kernel.srand config.seed
|
24
|
+
end
|
25
|
+
|
26
|
+
def fake_model_with_password_strategy(password_strategy)
|
27
|
+
Class.new do
|
28
|
+
attr_reader :password
|
29
|
+
attr_accessor :encrypted_password, :salt
|
30
|
+
|
31
|
+
include password_strategy
|
32
|
+
|
33
|
+
def save
|
34
|
+
end
|
35
|
+
end.new
|
36
|
+
end
|
37
|
+
|
38
|
+
module Rails
|
39
|
+
def self.env
|
40
|
+
ActiveSupport::StringInquirer.new("test")
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clearance-deprecated_password_strategies
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.10.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Derek Prior
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: clearance
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.10'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.10'
|
83
|
+
description: SHA1, Blowfish, and SHA1 to BCrypt migration strategies
|
84
|
+
email:
|
85
|
+
- derekprior@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CONTRIBUTING.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- clearance-deprecated_password_strategies.gemspec
|
99
|
+
- lib/clearance-deprecated_password_strategies.rb
|
100
|
+
- lib/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1.rb
|
101
|
+
- lib/clearance/password_strategies/deprecated/blowfish.rb
|
102
|
+
- lib/clearance/password_strategies/deprecated/sha1.rb
|
103
|
+
- lib/clearance/password_strategies/deprecated/version.rb
|
104
|
+
- spec/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1_spec.rb
|
105
|
+
- spec/clearance/password_strategies/deprecated/blowfish_spec.rb
|
106
|
+
- spec/clearance/password_strategies/deprecated/sha1_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: https://github.com/thoughtbot/clearance-deprecated-password-strategies
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.4.5
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Deprecated password strategies extracted from Clearance
|
132
|
+
test_files:
|
133
|
+
- spec/clearance/password_strategies/deprecated/bcrypt_migration_from_sha1_spec.rb
|
134
|
+
- spec/clearance/password_strategies/deprecated/blowfish_spec.rb
|
135
|
+
- spec/clearance/password_strategies/deprecated/sha1_spec.rb
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
has_rdoc:
|