casino-activerecord_authenticator 2.0.1 → 3.0.0.pre.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/.travis.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
|
-
gemspec
|
|
2
|
+
gemspec
|
|
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.add_development_dependency 'sqlite3', '~> 1.3.7'
|
|
24
24
|
s.add_development_dependency 'coveralls'
|
|
25
25
|
|
|
26
|
-
s.add_runtime_dependency 'activerecord', '~>
|
|
26
|
+
s.add_runtime_dependency 'activerecord', '~> 4.1.0'
|
|
27
27
|
s.add_runtime_dependency 'unix-crypt', '~> 1.1'
|
|
28
|
-
s.add_runtime_dependency 'bcrypt
|
|
29
|
-
s.add_runtime_dependency 'casino', '~>
|
|
28
|
+
s.add_runtime_dependency 'bcrypt', '~> 3.0'
|
|
29
|
+
s.add_runtime_dependency 'casino', '~> 3.0.0.pre.1'
|
|
30
30
|
s.add_runtime_dependency 'phpass-ruby', '~> 0.1'
|
|
31
31
|
end
|
|
@@ -11,11 +11,14 @@ class CASino::ActiveRecordAuthenticator
|
|
|
11
11
|
|
|
12
12
|
# @param [Hash] options
|
|
13
13
|
def initialize(options)
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if !options.respond_to?(:deep_symbolize_keys)
|
|
15
|
+
raise ArgumentError, "When assigning attributes, you must pass a hash as an argument."
|
|
16
|
+
end
|
|
17
|
+
@options = options.deep_symbolize_keys
|
|
18
|
+
raise ArgumentError, "Table name is missing" unless @options[:table]
|
|
16
19
|
eval <<-END
|
|
17
20
|
class #{self.class.to_s}::#{@options[:table].classify} < AuthDatabase
|
|
18
|
-
|
|
21
|
+
self.table_name = "#{@options[:table]}"
|
|
19
22
|
end
|
|
20
23
|
END
|
|
21
24
|
|
|
@@ -24,7 +27,6 @@ class CASino::ActiveRecordAuthenticator
|
|
|
24
27
|
end
|
|
25
28
|
|
|
26
29
|
def validate(username, password)
|
|
27
|
-
@model.verify_active_connections!
|
|
28
30
|
user = @model.send("find_by_#{@options[:username_column]}!", username)
|
|
29
31
|
password_from_database = user.send(@options[:password_column])
|
|
30
32
|
|
|
@@ -18,6 +18,7 @@ describe CASino::ActiveRecordAuthenticator do
|
|
|
18
18
|
extra_attributes: extra_attributes
|
|
19
19
|
}
|
|
20
20
|
end
|
|
21
|
+
let(:faulty_options){ options.merge(table: nil) }
|
|
21
22
|
|
|
22
23
|
subject { described_class.new(options) }
|
|
23
24
|
|
|
@@ -50,6 +51,21 @@ describe CASino::ActiveRecordAuthenticator do
|
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
|
|
54
|
+
describe 'invalid yaml input' do
|
|
55
|
+
context 'no hash input' do
|
|
56
|
+
it 'throws an argument error if the supplied input was not hash' do
|
|
57
|
+
expect{described_class.new("string")}.to raise_error ArgumentError
|
|
58
|
+
end
|
|
59
|
+
it 'does not throw an error if the correct hash was supplied' do
|
|
60
|
+
expect{described_class.new(options)}.not_to raise_error
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
context 'invalid table name' do
|
|
64
|
+
it 'throws an argument error if the table was nil/not supplied' do
|
|
65
|
+
expect{described_class.new(faulty_options)}.to raise_error ArgumentError
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
53
69
|
describe '#validate' do
|
|
54
70
|
|
|
55
71
|
context 'valid username' do
|
metadata
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: casino-activerecord_authenticator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 3.0.0.pre.1
|
|
5
|
+
prerelease: 6
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Nils Caspar
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rake
|
|
@@ -99,7 +99,7 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - ~>
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version:
|
|
102
|
+
version: 4.1.0
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -107,7 +107,7 @@ dependencies:
|
|
|
107
107
|
requirements:
|
|
108
108
|
- - ~>
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
110
|
+
version: 4.1.0
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: unix-crypt
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -125,7 +125,7 @@ dependencies:
|
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
126
|
version: '1.1'
|
|
127
127
|
- !ruby/object:Gem::Dependency
|
|
128
|
-
name: bcrypt
|
|
128
|
+
name: bcrypt
|
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
|
130
130
|
none: false
|
|
131
131
|
requirements:
|
|
@@ -147,7 +147,7 @@ dependencies:
|
|
|
147
147
|
requirements:
|
|
148
148
|
- - ~>
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
|
-
version:
|
|
150
|
+
version: 3.0.0.pre.1
|
|
151
151
|
type: :runtime
|
|
152
152
|
prerelease: false
|
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -155,7 +155,7 @@ dependencies:
|
|
|
155
155
|
requirements:
|
|
156
156
|
- - ~>
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
|
-
version:
|
|
158
|
+
version: 3.0.0.pre.1
|
|
159
159
|
- !ruby/object:Gem::Dependency
|
|
160
160
|
name: phpass-ruby
|
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -213,9 +213,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
213
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
none: false
|
|
215
215
|
requirements:
|
|
216
|
-
- - ! '
|
|
216
|
+
- - ! '>'
|
|
217
217
|
- !ruby/object:Gem::Version
|
|
218
|
-
version:
|
|
218
|
+
version: 1.3.1
|
|
219
219
|
requirements: []
|
|
220
220
|
rubyforge_project:
|
|
221
221
|
rubygems_version: 1.8.23
|