authtrail 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -5
- data/LICENSE.txt +1 -1
- data/README.md +15 -7
- data/app/jobs/auth_trail/geocode_job.rb +4 -0
- data/lib/auth_trail/manager.rb +9 -11
- data/lib/auth_trail/version.rb +1 -1
- data/lib/authtrail.rb +7 -3
- metadata +59 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ca58a6ac201b761a2cf30bed995135a44690ac7616770f9f1d2e74c45e23080
|
4
|
+
data.tar.gz: 3ab3c476d2b75e1697a0a1e08cdc6e0356c07e266b1839c74eea1c1c4d818023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7a769b8963f67a9cc0d37e194dd1e9b936271cfbc7c88ee0f1fe72252926fc6184c01bd9abad0420231507bc99e54fc22b85916c9a0cb3cc1611c402e3436f3
|
7
|
+
data.tar.gz: 5cad0685a4773c31ef10f78380c9e64b4ca56828f9ba9eae8b4471a1b7cdd5d827b6f33c27a4963926003b199bbffad3971c98269e87c7cb850db33ad342a352
|
data/CHANGELOG.md
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
## 0.2.
|
1
|
+
## 0.2.1 (2020-08-17)
|
2
|
+
|
3
|
+
- Added `job_queue` option
|
4
|
+
|
5
|
+
## 0.2.0 (2019-06-23)
|
2
6
|
|
3
7
|
- Added latitude and longitude
|
4
8
|
- `AuthTrail::GeocodeJob` now inherits from `ActiveJob::Base` instead of `ApplicationJob`
|
5
9
|
- Removed support for Rails 4.2
|
6
10
|
|
7
|
-
## 0.1.3
|
11
|
+
## 0.1.3 (2018-09-27)
|
8
12
|
|
9
13
|
- Added support for Rails 4.2
|
10
14
|
|
11
|
-
## 0.1.2
|
15
|
+
## 0.1.2 (2018-07-30)
|
12
16
|
|
13
17
|
- Added `identity_method` option
|
14
18
|
- Fixed geocoding
|
15
19
|
|
16
|
-
## 0.1.1
|
20
|
+
## 0.1.1 (2018-07-13)
|
17
21
|
|
18
22
|
- Improved strategy detection for failures
|
19
23
|
- Fixed migration for MySQL
|
20
24
|
|
21
|
-
## 0.1.0
|
25
|
+
## 0.1.0 (2017-11-07)
|
22
26
|
|
23
27
|
- First release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Track Devise login activity
|
|
4
4
|
|
5
5
|
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
|
6
6
|
|
7
|
+
[![Build Status](https://travis-ci.org/ankane/authtrail.svg?branch=master)](https://travis-ci.org/ankane/authtrail)
|
8
|
+
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application’s Gemfile:
|
@@ -86,7 +88,7 @@ AuthTrail.geocode = false
|
|
86
88
|
Set job queue for geocoding
|
87
89
|
|
88
90
|
```ruby
|
89
|
-
AuthTrail
|
91
|
+
AuthTrail.job_queue = :low_priority
|
90
92
|
```
|
91
93
|
|
92
94
|
### Geocoding Performance
|
@@ -112,15 +114,12 @@ Geocoder.configure(
|
|
112
114
|
|
113
115
|
## Data Protection
|
114
116
|
|
115
|
-
Protect the privacy of your users by encrypting fields that contain personal
|
117
|
+
Protect the privacy of your users by encrypting fields that contain personal data, such as `identity` and `ip`. [Lockbox](https://github.com/ankane/lockbox) is great for this. Use [Blind Index](https://github.com/ankane/blind_index) so you can still query the fields.
|
116
118
|
|
117
119
|
```ruby
|
118
120
|
class LoginActivity < ApplicationRecord
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
blind_index :identity, key: ...
|
123
|
-
blind_index :ip, key: ...
|
121
|
+
encrypts :identity, :ip
|
122
|
+
blind_index :identity, :ip
|
124
123
|
end
|
125
124
|
```
|
126
125
|
|
@@ -153,3 +152,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
153
152
|
- Fix bugs and [submit pull requests](https://github.com/ankane/authtrail/pulls)
|
154
153
|
- Write, clarify, or fix documentation
|
155
154
|
- Suggest or add new features
|
155
|
+
|
156
|
+
To get started with development and testing:
|
157
|
+
|
158
|
+
```sh
|
159
|
+
git clone https://github.com/ankane/authtrail.git
|
160
|
+
cd authtrail
|
161
|
+
bundle install
|
162
|
+
bundle exec rake test
|
163
|
+
```
|
data/lib/auth_trail/manager.rb
CHANGED
@@ -19,18 +19,16 @@ module AuthTrail
|
|
19
19
|
|
20
20
|
def before_failure(env, opts)
|
21
21
|
AuthTrail.safely do
|
22
|
-
|
23
|
-
request = ActionDispatch::Request.new(env)
|
22
|
+
request = ActionDispatch::Request.new(env)
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
24
|
+
AuthTrail.track(
|
25
|
+
strategy: detect_strategy(env["warden"]),
|
26
|
+
scope: opts[:scope].to_s,
|
27
|
+
identity: AuthTrail.identity_method.call(request, opts, nil),
|
28
|
+
success: false,
|
29
|
+
request: request,
|
30
|
+
failure_reason: opts[:message].to_s
|
31
|
+
)
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
data/lib/auth_trail/version.rb
CHANGED
data/lib/authtrail.rb
CHANGED
@@ -9,7 +9,7 @@ require "auth_trail/version"
|
|
9
9
|
|
10
10
|
module AuthTrail
|
11
11
|
class << self
|
12
|
-
attr_accessor :exclude_method, :geocode, :track_method, :identity_method
|
12
|
+
attr_accessor :exclude_method, :geocode, :track_method, :identity_method, :job_queue
|
13
13
|
end
|
14
14
|
self.geocode = true
|
15
15
|
self.identity_method = lambda do |request, opts, user|
|
@@ -45,7 +45,11 @@ module AuthTrail
|
|
45
45
|
if AuthTrail.track_method
|
46
46
|
AuthTrail.track_method.call(info)
|
47
47
|
else
|
48
|
-
login_activity = LoginActivity.
|
48
|
+
login_activity = LoginActivity.new
|
49
|
+
info.each do |k, v|
|
50
|
+
login_activity.try("#{k}=", v)
|
51
|
+
end
|
52
|
+
login_activity.save!
|
49
53
|
AuthTrail::GeocodeJob.perform_later(login_activity) if AuthTrail.geocode
|
50
54
|
end
|
51
55
|
end
|
@@ -66,5 +70,5 @@ Warden::Manager.after_set_user except: :fetch do |user, auth, opts|
|
|
66
70
|
end
|
67
71
|
|
68
72
|
Warden::Manager.before_failure do |env, opts|
|
69
|
-
AuthTrail::Manager.before_failure(env, opts)
|
73
|
+
AuthTrail::Manager.before_failure(env, opts) if opts[:message]
|
70
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authtrail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -96,6 +96,62 @@ dependencies:
|
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: combustion
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: devise
|
99
155
|
requirement: !ruby/object:Gem::Requirement
|
100
156
|
requirements:
|
101
157
|
- - ">="
|
@@ -144,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
200
|
- !ruby/object:Gem::Version
|
145
201
|
version: '0'
|
146
202
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
203
|
+
rubygems_version: 3.1.2
|
148
204
|
signing_key:
|
149
205
|
specification_version: 4
|
150
206
|
summary: Track Devise login activity
|