casino-activerecord_authenticator 2.0.0 → 2.0.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.
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--color --format
|
1
|
+
--color --format documentation
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# casino-activerecord_authenticator [](https://travis-ci.org/rbCAS/casino-activerecord_authenticator) [](https://travis-ci.org/rbCAS/casino-activerecord_authenticator) [](https://coveralls.io/r/rbCAS/casino-activerecord_authenticator)
|
2
2
|
|
3
|
-
Provides mechanism to use ActiveRecord as an authenticator for [
|
3
|
+
Provides mechanism to use ActiveRecord as an authenticator for [CASino](https://github.com/rbCAS/CASino).
|
4
4
|
|
5
5
|
ActiveRecord supports many SQL databases such as MySQL, PostgreSQL, SQLite, ...
|
6
6
|
|
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'simplecov', '~> 0.7'
|
23
23
|
s.add_development_dependency 'sqlite3', '~> 1.3.7'
|
24
24
|
s.add_development_dependency 'coveralls'
|
25
|
-
s.add_development_dependency 'fivemat'
|
26
25
|
|
27
26
|
s.add_runtime_dependency 'activerecord', '~> 3.2.12'
|
28
27
|
s.add_runtime_dependency 'unix-crypt', '~> 1.1'
|
29
28
|
s.add_runtime_dependency 'bcrypt-ruby', '~> 3.0'
|
30
29
|
s.add_runtime_dependency 'casino', '~> 2.0'
|
30
|
+
s.add_runtime_dependency 'phpass-ruby', '~> 0.1'
|
31
31
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'active_record'
|
2
2
|
require 'unix_crypt'
|
3
3
|
require 'bcrypt'
|
4
|
+
require 'phpass'
|
4
5
|
|
5
6
|
class CASino::ActiveRecordAuthenticator
|
6
7
|
|
@@ -44,6 +45,8 @@ class CASino::ActiveRecordAuthenticator
|
|
44
45
|
case magic
|
45
46
|
when /\A2a?\z/
|
46
47
|
valid_password_with_bcrypt?(password, password_from_database)
|
48
|
+
when /\AH\z/, /\AP\z/
|
49
|
+
valid_password_with_phpass?(password, password_from_database)
|
47
50
|
else
|
48
51
|
valid_password_with_unix_crypt?(password, password_from_database)
|
49
52
|
end
|
@@ -58,6 +61,10 @@ class CASino::ActiveRecordAuthenticator
|
|
58
61
|
UnixCrypt.valid?(password, password_from_database)
|
59
62
|
end
|
60
63
|
|
64
|
+
def valid_password_with_phpass?(password, password_from_database)
|
65
|
+
Phpass.new().check(password, password_from_database)
|
66
|
+
end
|
67
|
+
|
61
68
|
def extra_attributes(user)
|
62
69
|
attributes = {}
|
63
70
|
extra_attributes_option.each do |attribute_name, database_column|
|
@@ -132,6 +132,19 @@ describe CASino::ActiveRecordAuthenticator do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
context 'support for phpass' do
|
136
|
+
before do
|
137
|
+
described_class::User.create!(
|
138
|
+
username: 'test4',
|
139
|
+
password: '$P$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0', # password: test12345
|
140
|
+
mail_address: 'mail@example.org')
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'is able to handle phpass password hashes' do
|
144
|
+
subject.validate('test4', 'test12345').should be_instance_of(Hash)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
135
148
|
end
|
136
149
|
|
137
150
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casino-activerecord_authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -92,22 +92,6 @@ dependencies:
|
|
92
92
|
- - ! '>='
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: fivemat
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ! '>='
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
|
-
requirements:
|
108
|
-
- - ! '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
95
|
- !ruby/object:Gem::Dependency
|
112
96
|
name: activerecord
|
113
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,6 +156,22 @@ dependencies:
|
|
172
156
|
- - ~>
|
173
157
|
- !ruby/object:Gem::Version
|
174
158
|
version: '2.0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: phpass-ruby
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.1'
|
167
|
+
type: :runtime
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ~>
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0.1'
|
175
175
|
description: This gem can be used to allow the CASino backend to authenticate against
|
176
176
|
an SQL server using ActiveRecord.
|
177
177
|
email:
|