fortifier 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/fortifier/auth_user.rb +18 -18
- data/app/models/fortifier/max_mind.rb +2 -2
- data/lib/fortifier/version.rb +1 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 627acec90ae1d790dd438438de615d1ea3dfada8
|
4
|
+
data.tar.gz: 84be89b1d08e92ce0d38901526490c6b9925b4e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d298350e78d00abf9c6370762e8054b2f0f99133ef76ee8e72f53d93ea80bb426d92813de7b63060cd5a48f36106730c7f6387aadb9d4e04ff83b874805070db
|
7
|
+
data.tar.gz: 87c21c4ddf36eb364a76f08bed5c7d0efd464ccc161bdc78a228695e16948c94d457d178447ff4bfcfa5e07f84e001d3e0c8c7b646358c5cb5271f97ce2d5b6f
|
@@ -26,7 +26,7 @@ module Fortifier
|
|
26
26
|
|
27
27
|
# NOTE: These custom validations are used so that symbols/codes
|
28
28
|
# can be returned to applications, rather than explicit text.
|
29
|
-
# Fortifier provides the symbols and the apps are responsible
|
29
|
+
# Fortifier provides the symbols and the apps are responsible
|
30
30
|
# for handling error messaging.
|
31
31
|
def login_is_present
|
32
32
|
return if login.present?
|
@@ -118,9 +118,9 @@ module Fortifier
|
|
118
118
|
return nil if token.blank?
|
119
119
|
AuthUser.
|
120
120
|
joins(:secrets).
|
121
|
-
where("find_in_set(? , account_uuids_csv)
|
121
|
+
where("find_in_set(? , account_uuids_csv)
|
122
122
|
AND (expired IS NULL OR expired = false)
|
123
|
-
AND enc_type = '#{Secret::SSO_TOKEN}'
|
123
|
+
AND enc_type = '#{Secret::SSO_TOKEN}'
|
124
124
|
AND secret_value = ?", account_uuid, token).
|
125
125
|
first
|
126
126
|
end
|
@@ -129,9 +129,9 @@ module Fortifier
|
|
129
129
|
return nil if token.blank?
|
130
130
|
AuthUser.
|
131
131
|
joins(:secrets).
|
132
|
-
where("find_in_set(? , account_uuids_csv)
|
132
|
+
where("find_in_set(? , account_uuids_csv)
|
133
133
|
AND (expired IS NULL OR expired = false)
|
134
|
-
AND enc_type = '#{Secret::SSO_TOKEN}'
|
134
|
+
AND enc_type = '#{Secret::SSO_TOKEN}'
|
135
135
|
AND secret_value = ?", account_uuid, token).
|
136
136
|
first
|
137
137
|
end
|
@@ -165,12 +165,12 @@ module Fortifier
|
|
165
165
|
|
166
166
|
def public_attribute_hash
|
167
167
|
auth_log = self.auth_logs.last
|
168
|
-
{
|
169
|
-
uuid: self.uuid,
|
170
|
-
email: self.email,
|
171
|
-
login: self.login,
|
172
|
-
name: self.name,
|
173
|
-
note: self.note,
|
168
|
+
{
|
169
|
+
uuid: self.uuid,
|
170
|
+
email: self.email,
|
171
|
+
login: self.login,
|
172
|
+
name: self.name,
|
173
|
+
note: self.note,
|
174
174
|
disabled: self.disabled?,
|
175
175
|
last_auth_log: ({user_agent: auth_log.user_agent, status: auth_log.status, created_at: auth_log.created_at.to_time} if auth_log)
|
176
176
|
}
|
@@ -209,12 +209,12 @@ module Fortifier
|
|
209
209
|
# joined with their most recent AuthLog,
|
210
210
|
# sort by the AuthLog created_at date (according to user preference),
|
211
211
|
# then paginate with WillPaginate. Capisce?
|
212
|
-
Fortifier::AuthUser.find_by_sql("SELECT * FROM fortifier_auth_users fau
|
213
|
-
LEFT OUTER JOIN ( select auth_user_id, max(created_at)
|
214
|
-
AS last_login_at
|
215
|
-
FROM fortifier_auth_logs fal
|
216
|
-
GROUP BY auth_user_id)
|
217
|
-
AS last_seen
|
212
|
+
Fortifier::AuthUser.find_by_sql("SELECT * FROM fortifier_auth_users fau
|
213
|
+
LEFT OUTER JOIN ( select auth_user_id, max(created_at)
|
214
|
+
AS last_login_at
|
215
|
+
FROM fortifier_auth_logs fal
|
216
|
+
GROUP BY auth_user_id)
|
217
|
+
AS last_seen
|
218
218
|
ON fau.id = last_seen.auth_user_id
|
219
219
|
#{'WHERE ' + aggregate_query}
|
220
220
|
#{'AND ' + user_search_query if user_search_query.present?}
|
@@ -229,7 +229,7 @@ module Fortifier
|
|
229
229
|
end
|
230
230
|
|
231
231
|
private
|
232
|
-
|
232
|
+
|
233
233
|
def create_unique_uuid
|
234
234
|
self.uuid = loop do
|
235
235
|
uuid = SecureRandom.uuid
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Fortifier
|
2
|
-
class MaxMind
|
2
|
+
class MaxMind
|
3
3
|
|
4
4
|
def self.valid_ip?(auth_log)
|
5
5
|
return true unless Rails.env=="production"
|
@@ -47,7 +47,7 @@ module Fortifier
|
|
47
47
|
|
48
48
|
def self.local_ip?(ip)
|
49
49
|
ip_regex = /(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1)|(^0:0:0:0:0:0:0:1)$/
|
50
|
-
return
|
50
|
+
return ip_regex.match(ip).present?
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.previously_validated_ip?(ip)
|
data/lib/fortifier/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Koloditch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.1.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.1.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: bcrypt
|
28
|
+
name: bcrypt-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.1.
|
33
|
+
version: 3.1.5
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.1.
|
40
|
+
version: 3.1.5
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: attr-csv
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: will_paginate
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: foreigner
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.6.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.6.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: mysql2
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Different stuff.
|
@@ -159,17 +159,17 @@ require_paths:
|
|
159
159
|
- lib
|
160
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- -
|
162
|
+
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
|
-
- -
|
167
|
+
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.2.2
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: It does stuff.
|