google-authenticator-rails 2.0.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 00704838d9ed31eedcc4224c0116b6606b50ca57
4
- data.tar.gz: e0c8bf5800b17aa91190e090dd1f44e0f7872e69
2
+ SHA256:
3
+ metadata.gz: 24553cf253ac005e951bbd6937e3ec7da80c0d29dd1ea119cb8a51caaf22bce6
4
+ data.tar.gz: 529785446eb3b6ee2bcd66ecbc8aa1890b7efcfa6c6d98dcfd13a5f7e7663034
5
5
  SHA512:
6
- metadata.gz: e0e2a51adac592a8cd82be253b82007cbd8b39937ec8b161c1c6e5c39eebc26a0d87e252320540e350026d017301f517ef8565d183e17a723540864ca7874341
7
- data.tar.gz: 4f6d131a29bfbb93385637230a192c61682b5e7afb7912532eeae05fc9d6116760a0a5cf37296801aa66d3b3da602ec45ce8277644102e878364b621fd294a88
6
+ metadata.gz: f0592fa696434b350fe844fc6ef86959923d3796a86b7c13d7da70bd2e21da5fad36e6a21ad540ef1215b8d4146dd3f8d7d37f89874f85063afbe6cb2cb889f7
7
+ data.tar.gz: 79b74b86b86e509e34033b4c0da95d68b044d4bcaa255563ef18895234f42421c60074931a603c0c37e386222c19d667debbc25db25141ff5f98b42366b31d1e
data/Appraisals CHANGED
@@ -4,37 +4,10 @@ major = version_info.first.to_i
4
4
  minor = version_info[1].to_i
5
5
  hotfix = version_info.last.to_i
6
6
 
7
- appraise "rails3.0" do
8
- gem "activerecord", "~> 3.0.0"
7
+ appraise "rails-6.1" do
8
+ gem "activerecord", "~> 6.1.0"
9
9
  end
10
10
 
11
- appraise "rails3.1" do
12
- gem "activerecord", "~> 3.1.0"
13
- end
14
-
15
- appraise "rails3.2" do
16
- gem "activerecord", "~> 3.2.0"
17
- end
18
-
19
- appraise "rails4.0" do
20
- gem "activerecord", "~> 4.0.0"
21
- gem "protected_attributes"
22
- end
23
-
24
- appraise "rails4.1" do
25
- gem "activerecord", "~> 4.1.0"
26
- gem "protected_attributes"
27
- gem "json", "~> 1.8.3"
28
- end
29
-
30
- appraise "rails4.2" do
31
- gem "activerecord", "~> 4.2.0"
32
- end
33
-
34
- appraise "rails5.0" do
35
- gem "activerecord", "~> 5.0.0"
36
- end
37
-
38
- appraise "rails5.1" do
39
- gem "activerecord", "~> 5.1.0"
40
- end
11
+ appraise "rails-7.0" do
12
+ gem "activerecord", "~> 7.0.0"
13
+ end
data/CONTRIBUTING.md CHANGED
@@ -4,4 +4,8 @@
4
4
  2. Create your feature branch (`git checkout -b my-new-feature`)
5
5
  3. Commit your changes (`git commit -am 'Added some feature'`)
6
6
  4. Push to the branch (`git push origin my-new-feature`)
7
- 5. Create new Pull Request
7
+ 5. Create new Pull Request
8
+
9
+ ## Bug fixes
10
+
11
+ It's very helpful for me if you include a failing spec with your bug fix so I can verify the behavior that is changing.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in google-authenticator.gemspec
4
- gemspec
4
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,156 +1,196 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google-authenticator-rails (2.0.0)
4
+ google-authenticator-rails (3.2.1)
5
5
  actionpack
6
6
  activerecord
7
- google-qr
8
7
  rails
9
- rotp (= 3.3.0)
8
+ rotp (>= 5.0, < 7.0)
9
+ rqrcode
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (5.2.0)
15
- actionpack (= 5.2.0)
14
+ actioncable (7.0.4.2)
15
+ actionpack (= 7.0.4.2)
16
+ activesupport (= 7.0.4.2)
16
17
  nio4r (~> 2.0)
17
18
  websocket-driver (>= 0.6.1)
18
- actionmailer (5.2.0)
19
- actionpack (= 5.2.0)
20
- actionview (= 5.2.0)
21
- activejob (= 5.2.0)
19
+ actionmailbox (7.0.4.2)
20
+ actionpack (= 7.0.4.2)
21
+ activejob (= 7.0.4.2)
22
+ activerecord (= 7.0.4.2)
23
+ activestorage (= 7.0.4.2)
24
+ activesupport (= 7.0.4.2)
25
+ mail (>= 2.7.1)
26
+ net-imap
27
+ net-pop
28
+ net-smtp
29
+ actionmailer (7.0.4.2)
30
+ actionpack (= 7.0.4.2)
31
+ actionview (= 7.0.4.2)
32
+ activejob (= 7.0.4.2)
33
+ activesupport (= 7.0.4.2)
22
34
  mail (~> 2.5, >= 2.5.4)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
23
38
  rails-dom-testing (~> 2.0)
24
- actionpack (5.2.0)
25
- actionview (= 5.2.0)
26
- activesupport (= 5.2.0)
27
- rack (~> 2.0)
39
+ actionpack (7.0.4.2)
40
+ actionview (= 7.0.4.2)
41
+ activesupport (= 7.0.4.2)
42
+ rack (~> 2.0, >= 2.2.0)
28
43
  rack-test (>= 0.6.3)
29
44
  rails-dom-testing (~> 2.0)
30
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
- actionview (5.2.0)
32
- activesupport (= 5.2.0)
45
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
46
+ actiontext (7.0.4.2)
47
+ actionpack (= 7.0.4.2)
48
+ activerecord (= 7.0.4.2)
49
+ activestorage (= 7.0.4.2)
50
+ activesupport (= 7.0.4.2)
51
+ globalid (>= 0.6.0)
52
+ nokogiri (>= 1.8.5)
53
+ actionview (7.0.4.2)
54
+ activesupport (= 7.0.4.2)
33
55
  builder (~> 3.1)
34
56
  erubi (~> 1.4)
35
57
  rails-dom-testing (~> 2.0)
36
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
37
- activejob (5.2.0)
38
- activesupport (= 5.2.0)
58
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
59
+ activejob (7.0.4.2)
60
+ activesupport (= 7.0.4.2)
39
61
  globalid (>= 0.3.6)
40
- activemodel (5.2.0)
41
- activesupport (= 5.2.0)
42
- activerecord (5.2.0)
43
- activemodel (= 5.2.0)
44
- activesupport (= 5.2.0)
45
- arel (>= 9.0)
46
- activestorage (5.2.0)
47
- actionpack (= 5.2.0)
48
- activerecord (= 5.2.0)
49
- marcel (~> 0.3.1)
50
- activesupport (5.2.0)
62
+ activemodel (7.0.4.2)
63
+ activesupport (= 7.0.4.2)
64
+ activerecord (7.0.4.2)
65
+ activemodel (= 7.0.4.2)
66
+ activesupport (= 7.0.4.2)
67
+ activestorage (7.0.4.2)
68
+ actionpack (= 7.0.4.2)
69
+ activejob (= 7.0.4.2)
70
+ activerecord (= 7.0.4.2)
71
+ activesupport (= 7.0.4.2)
72
+ marcel (~> 1.0)
73
+ mini_mime (>= 1.1.0)
74
+ activesupport (7.0.4.2)
51
75
  concurrent-ruby (~> 1.0, >= 1.0.2)
52
- i18n (>= 0.7, < 2)
53
- minitest (~> 5.1)
54
- tzinfo (~> 1.1)
55
- appraisal (0.5.2)
76
+ i18n (>= 1.6, < 2)
77
+ minitest (>= 5.1)
78
+ tzinfo (~> 2.0)
79
+ appraisal (2.4.1)
56
80
  bundler
57
81
  rake
58
- arel (9.0.0)
59
- builder (3.2.3)
60
- concurrent-ruby (1.0.5)
61
- crass (1.0.4)
62
- diff-lcs (1.1.3)
63
- docile (1.1.5)
64
- erubi (1.7.1)
65
- globalid (0.4.1)
66
- activesupport (>= 4.2.0)
67
- google-qr (0.2.2)
68
- i18n (1.0.1)
82
+ thor (>= 0.14.0)
83
+ builder (3.2.4)
84
+ chunky_png (1.4.0)
85
+ concurrent-ruby (1.2.0)
86
+ crass (1.0.6)
87
+ date (3.3.3)
88
+ diff-lcs (1.5.0)
89
+ docile (1.4.0)
90
+ erubi (1.12.0)
91
+ globalid (1.1.0)
92
+ activesupport (>= 5.0)
93
+ i18n (1.12.0)
69
94
  concurrent-ruby (~> 1.0)
70
- json (2.1.0)
71
- loofah (2.2.2)
95
+ loofah (2.19.1)
72
96
  crass (~> 1.0.2)
73
97
  nokogiri (>= 1.5.9)
74
- mail (2.7.0)
98
+ mail (2.8.1)
75
99
  mini_mime (>= 0.1.1)
76
- marcel (0.3.2)
77
- mimemagic (~> 0.3.2)
78
- method_source (0.9.0)
79
- mimemagic (0.3.2)
80
- mini_mime (1.0.0)
81
- mini_portile2 (2.3.0)
82
- minitest (5.11.3)
83
- nio4r (2.3.1)
84
- nokogiri (1.8.3)
85
- mini_portile2 (~> 2.3.0)
86
- rack (2.0.5)
87
- rack-test (1.0.0)
88
- rack (>= 1.0, < 3)
89
- rails (5.2.0)
90
- actioncable (= 5.2.0)
91
- actionmailer (= 5.2.0)
92
- actionpack (= 5.2.0)
93
- actionview (= 5.2.0)
94
- activejob (= 5.2.0)
95
- activemodel (= 5.2.0)
96
- activerecord (= 5.2.0)
97
- activestorage (= 5.2.0)
98
- activesupport (= 5.2.0)
99
- bundler (>= 1.3.0)
100
- railties (= 5.2.0)
101
- sprockets-rails (>= 2.0.0)
100
+ net-imap
101
+ net-pop
102
+ net-smtp
103
+ marcel (1.0.2)
104
+ method_source (1.0.0)
105
+ mini_mime (1.1.2)
106
+ minitest (5.17.0)
107
+ net-imap (0.3.4)
108
+ date
109
+ net-protocol
110
+ net-pop (0.1.2)
111
+ net-protocol
112
+ net-protocol (0.2.1)
113
+ timeout
114
+ net-smtp (0.3.3)
115
+ net-protocol
116
+ nio4r (2.5.8)
117
+ nokogiri (1.14.2-arm64-darwin)
118
+ racc (~> 1.4)
119
+ racc (1.6.2)
120
+ rack (2.2.6.2)
121
+ rack-test (2.0.2)
122
+ rack (>= 1.3)
123
+ rails (7.0.4.2)
124
+ actioncable (= 7.0.4.2)
125
+ actionmailbox (= 7.0.4.2)
126
+ actionmailer (= 7.0.4.2)
127
+ actionpack (= 7.0.4.2)
128
+ actiontext (= 7.0.4.2)
129
+ actionview (= 7.0.4.2)
130
+ activejob (= 7.0.4.2)
131
+ activemodel (= 7.0.4.2)
132
+ activerecord (= 7.0.4.2)
133
+ activestorage (= 7.0.4.2)
134
+ activesupport (= 7.0.4.2)
135
+ bundler (>= 1.15.0)
136
+ railties (= 7.0.4.2)
102
137
  rails-dom-testing (2.0.3)
103
138
  activesupport (>= 4.2.0)
104
139
  nokogiri (>= 1.6)
105
- rails-html-sanitizer (1.0.4)
106
- loofah (~> 2.2, >= 2.2.2)
107
- railties (5.2.0)
108
- actionpack (= 5.2.0)
109
- activesupport (= 5.2.0)
140
+ rails-html-sanitizer (1.5.0)
141
+ loofah (~> 2.19, >= 2.19.1)
142
+ railties (7.0.4.2)
143
+ actionpack (= 7.0.4.2)
144
+ activesupport (= 7.0.4.2)
110
145
  method_source
111
- rake (>= 0.8.7)
112
- thor (>= 0.18.1, < 2.0)
113
- rake (11.3.0)
114
- rotp (3.3.0)
115
- rspec (2.8.0)
116
- rspec-core (~> 2.8.0)
117
- rspec-expectations (~> 2.8.0)
118
- rspec-mocks (~> 2.8.0)
119
- rspec-core (2.8.0)
120
- rspec-expectations (2.8.0)
121
- diff-lcs (~> 1.1.2)
122
- rspec-mocks (2.8.0)
123
- simplecov (0.15.1)
124
- docile (~> 1.1.0)
125
- json (>= 1.8, < 3)
126
- simplecov-html (~> 0.10.0)
127
- simplecov-html (0.10.2)
128
- sprockets (3.7.2)
146
+ rake (>= 12.2)
147
+ thor (~> 1.0)
148
+ zeitwerk (~> 2.5)
149
+ rake (13.0.6)
150
+ rotp (6.2.2)
151
+ rqrcode (2.1.2)
152
+ chunky_png (~> 1.0)
153
+ rqrcode_core (~> 1.0)
154
+ rqrcode_core (1.2.0)
155
+ rspec (3.4.0)
156
+ rspec-core (~> 3.4.0)
157
+ rspec-expectations (~> 3.4.0)
158
+ rspec-mocks (~> 3.4.0)
159
+ rspec-core (3.4.4)
160
+ rspec-support (~> 3.4.0)
161
+ rspec-expectations (3.4.0)
162
+ diff-lcs (>= 1.2.0, < 2.0)
163
+ rspec-support (~> 3.4.0)
164
+ rspec-mocks (3.4.1)
165
+ diff-lcs (>= 1.2.0, < 2.0)
166
+ rspec-support (~> 3.4.0)
167
+ rspec-support (3.4.1)
168
+ simplecov (0.21.2)
169
+ docile (~> 1.1)
170
+ simplecov-html (~> 0.11)
171
+ simplecov_json_formatter (~> 0.1)
172
+ simplecov-html (0.12.3)
173
+ simplecov_json_formatter (0.1.4)
174
+ sqlite3 (1.4.2)
175
+ thor (1.2.1)
176
+ timeout (0.3.2)
177
+ tzinfo (2.0.6)
129
178
  concurrent-ruby (~> 1.0)
130
- rack (> 1, < 3)
131
- sprockets-rails (3.2.1)
132
- actionpack (>= 4.0)
133
- activesupport (>= 4.0)
134
- sprockets (>= 3.0.0)
135
- sqlite3 (1.3.13)
136
- thor (0.20.0)
137
- thread_safe (0.3.6)
138
- tzinfo (1.2.5)
139
- thread_safe (~> 0.1)
140
- websocket-driver (0.7.0)
179
+ websocket-driver (0.7.5)
141
180
  websocket-extensions (>= 0.1.0)
142
- websocket-extensions (0.1.3)
181
+ websocket-extensions (0.1.5)
182
+ zeitwerk (2.6.7)
143
183
 
144
184
  PLATFORMS
145
185
  ruby
146
186
 
147
187
  DEPENDENCIES
148
- appraisal (~> 0.5.1)
188
+ appraisal (~> 2.4.1)
149
189
  google-authenticator-rails!
150
- rake (~> 11.0)
151
- rspec (~> 2.8.0)
190
+ rake (~> 13.0)
191
+ rspec (~> 3.4.0)
152
192
  simplecov
153
- sqlite3
193
+ sqlite3 (~> 1.4.0)
154
194
 
155
195
  BUNDLED WITH
156
- 1.16.1
196
+ 2.3.15
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # GoogleAuthenticatorRails
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/google-authenticator-rails.png)](http://badge.fury.io/rb/google-authenticator-rails)
4
- [![Build Status](https://secure.travis-ci.org/jaredonline/google-authenticator.png)](http://travis-ci.org/jaredonline/google-authenticator)
5
4
  [![Code Climate](https://codeclimate.com/github/jaredonline/google-authenticator.png)](https://codeclimate.com/github/jaredonline/google-authenticator)
6
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/41e825da75bd7630262f/test_coverage)](https://codeclimate.com/github/jaredonline/google-authenticator/test_coverage)
6
+ [![CircleCI](https://circleci.com/gh/jaredonline/google-authenticator/tree/master.svg?style=svg)](https://circleci.com/gh/jaredonline/google-authenticator/tree/master)
7
7
 
8
8
  Rails (ActiveRecord) integration with the Google Authenticator apps for [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) and the [iPhone](https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8). Uses the Authlogic style for cookie management.
9
9
 
@@ -52,7 +52,7 @@ Example:
52
52
 
53
53
  ```ruby
54
54
  class User
55
- acts_as_google_authenticated :column => :user_name
55
+ acts_as_google_authenticated :column_name => :user_name
56
56
  end
57
57
 
58
58
  @user = User.new(:user_name => "ted")
@@ -200,7 +200,7 @@ class UserMfaSession < GoogleAuthenticatorRails::Session::Base
200
200
  end
201
201
 
202
202
  # app/controllers/mfa_session_controller.rb
203
- def class MfaSessionController < ApplicationController
203
+ class MfaSessionController < ApplicationController
204
204
  def create
205
205
  UserMfaSession.create(user)
206
206
  end
@@ -367,7 +367,7 @@ to change all encrypted google secret fields to use the new key.
367
367
  If the app is not running under Rails version 4.1 or above, encryption will be disabled, and a warning issued if ```:encrypt_secrets```
368
368
  is enabled on a model.
369
369
 
370
- If encryption is enabled for a model, the Google secret column of its table must be able to hold at least 138 characters, rather than just 16.
370
+ If encryption is enabled for a model, the Google secret column of its table must be able to hold at least 162 characters, rather than just 32.
371
371
 
372
372
  ## Contributing
373
373
 
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/google-authenticator-rails/version', __FILE__)
3
+
4
+ version_info = RUBY_VERSION.split(".")
5
+
6
+ major = version_info.first.to_i
7
+ minor = version_info[1].to_i
8
+ hotfix = version_info.last.to_i
9
+
10
+ Gem::Specification.new do |gem|
11
+ gem.authors = ["Jared McFarland"]
12
+ gem.email = ["jared.online@gmail.com"]
13
+ gem.description = %q{Add the ability to use the Google Authenticator with ActiveRecord.}
14
+ gem.summary = %q{Add the ability to use the Google Authenticator with ActiveRecord.}
15
+ gem.homepage = "http://github.com/jaredonline/google-authenticator"
16
+
17
+ gem.files = Dir['lib/**/*.{rb,rake}'] + Dir['bin/*']
18
+ gem.files += Dir['[A-Z]*'] + Dir['spec/**/*.rb']
19
+ gem.files.reject! { |fn| fn.include? "CVS" }
20
+
21
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
22
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
23
+ gem.name = "google-authenticator-rails"
24
+ gem.require_paths = ["lib"]
25
+ gem.version = GoogleAuthenticatorRails::VERSION
26
+
27
+ gem.add_dependency "rotp", ">= 5.0", "< 7.0"
28
+ gem.add_dependency "rails"
29
+ gem.add_dependency "activerecord"
30
+ gem.add_dependency "rqrcode"
31
+ gem.add_dependency "actionpack"
32
+
33
+ gem.add_development_dependency "rake", "~> 13.0"
34
+ gem.add_development_dependency "rspec", "~> 3.4.0"
35
+ gem.add_development_dependency "appraisal", "~> 2.4.1"
36
+ gem.add_development_dependency "simplecov"
37
+ gem.add_development_dependency "sqlite3", "~> 1.4.0"
38
+ end
@@ -20,7 +20,9 @@ module GoogleAuthenticatorRails
20
20
 
21
21
  module Integration
22
22
  def self.included(klass)
23
- raise RailsAdapter::LoadedTooLateError.new if defined?(::ApplicationController)
23
+ if klass.descendants.map(&:name).include?("ApplicationController")
24
+ raise RailsAdapter::LoadedTooLateError.new
25
+ end
24
26
 
25
27
  method = klass.respond_to?(:prepend_before_action) ? :prepend_before_action : :prepend_before_filter
26
28
  klass.send(method, :activate_google_authenticator_rails)
@@ -34,6 +36,6 @@ module GoogleAuthenticatorRails
34
36
  end
35
37
  end
36
38
 
37
- if defined?(ActionController::Base)
39
+ ActiveSupport.on_load(:action_controller) do
38
40
  ActionController::Base.send(:include, GoogleAuthenticatorRails::ActionController::Integration)
39
41
  end
@@ -1,9 +1,9 @@
1
1
  module GoogleAuthenticatorRails # :nodoc:
2
2
  mattr_accessor :secret_encryptor
3
-
3
+
4
4
  module ActiveRecord # :nodoc:
5
5
  module Helpers
6
-
6
+
7
7
  # Returns and memoizes the plain text google secret for this instance, irrespective of the
8
8
  # name of the google secret storage column and whether secret encryption is enabled for this model.
9
9
  #
@@ -16,7 +16,7 @@ module GoogleAuthenticatorRails # :nodoc:
16
16
  @google_secret_value = secret_in_db.present? && self.class.google_secrets_encrypted ? google_secret_encryptor.decrypt_and_verify(secret_in_db) : secret_in_db
17
17
  end
18
18
  end
19
-
19
+
20
20
  def set_google_secret
21
21
  change_google_secret_to!(GoogleAuthenticatorRails::generate_secret)
22
22
  end
@@ -28,11 +28,18 @@ module GoogleAuthenticatorRails # :nodoc:
28
28
  end
29
29
 
30
30
  def google_authentic?(code)
31
- GoogleAuthenticatorRails.valid?(code, google_secret_value, self.class.google_drift)
31
+ raise ArgumentError, "Can't authenticate before google secret is set!" unless google_secret_value.present?
32
+
33
+ GoogleAuthenticatorRails.valid?(code.to_s, google_secret_value, self.class.google_drift)
32
34
  end
33
35
 
34
36
  def google_qr_uri(size = nil)
35
- GoogleQR.new(:data => ROTP::TOTP.new(google_secret_value, :issuer => google_issuer).provisioning_uri(google_label), :size => size || self.class.google_qr_size).to_s
37
+ data = ROTP::TOTP.new(google_secret_value, :issuer => google_issuer).provisioning_uri(google_label)
38
+ "https://chart.googleapis.com/chart?cht=qr&chl=#{CGI.escape(data)}&chs=#{size || self.class.google_qr_size}"
39
+ end
40
+
41
+ def google_qr_to_base64(size = 200)
42
+ "data:image/png;base64,#{Base64.strict_encode64(RQRCode::QRCode.new(ROTP::TOTP.new(google_secret_value, :issuer => google_issuer).provisioning_uri(google_label).to_s).as_png(size: size).to_s)}"
36
43
  end
37
44
 
38
45
  def google_label
@@ -50,7 +57,7 @@ module GoogleAuthenticatorRails # :nodoc:
50
57
  def google_token_value
51
58
  self.__send__(self.class.google_lookup_token)
52
59
  end
53
-
60
+
54
61
  def encrypt_google_secret!
55
62
  change_google_secret_to!(google_secret_column_value)
56
63
  end
@@ -59,7 +66,7 @@ module GoogleAuthenticatorRails # :nodoc:
59
66
  def default_google_label_method
60
67
  self.__send__(self.class.google_label_column)
61
68
  end
62
-
69
+
63
70
  def google_secret_column_value
64
71
  self.__send__(self.class.google_secret_column)
65
72
  end
@@ -75,13 +82,16 @@ module GoogleAuthenticatorRails # :nodoc:
75
82
  issuer = self.class.google_issuer
76
83
  issuer.is_a?(Proc) ? issuer.call(self) : issuer
77
84
  end
78
-
85
+
79
86
  def google_secret_encryptor
80
87
  GoogleAuthenticatorRails.secret_encryptor ||= GoogleAuthenticatorRails::ActiveRecord::Helpers.get_google_secret_encryptor
81
88
  end
82
-
89
+
83
90
  def self.get_google_secret_encryptor
84
- ActiveSupport::MessageEncryptor.new(Rails.application.key_generator.generate_key('Google-secret encryption key', 32))
91
+ encryption_key = Rails.application.key_generator.generate_key('Google-secret encryption key', 32)
92
+ encryptor = ActiveSupport::MessageEncryptor.new(encryption_key)
93
+ encryptor.rotate(encryption_key, cipher: 'aes-256-cbc') # Legacy support for Rails 5.2
94
+ encryptor
85
95
  end
86
96
  end
87
97
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleAuthenticatorRails
2
- VERSION = "2.0.0"
2
+ VERSION = "3.2.1"
3
3
  end
@@ -4,7 +4,7 @@ require 'active_support'
4
4
  require 'active_record'
5
5
  require 'openssl'
6
6
  require 'rotp'
7
- require 'google-qr'
7
+ require 'rqrcode'
8
8
 
9
9
  # Stuff the gem is
10
10
  #
@@ -26,13 +26,13 @@ module GoogleAuthenticatorRails
26
26
  def self.encryption_supported?
27
27
  defined?(Rails) && (Rails::VERSION::MAJOR > 4 || Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR > 0)
28
28
  end
29
-
29
+
30
30
  class Railtie < Rails::Railtie
31
31
  rake_tasks do
32
32
  load 'tasks/google_authenticator.rake'
33
33
  end
34
- end if encryption_supported? && !Rails.env.test? # Without this last condition tasks under test are run twice
35
-
34
+ end if encryption_supported? && !Rails.env.test? # Without this last condition tasks under test are run twice
35
+
36
36
  # Drift is set to 6 because ROTP drift is not inclusive. This allows a drift of 5 seconds.
37
37
  DRIFT = 6
38
38
 
@@ -44,7 +44,7 @@ module GoogleAuthenticatorRails
44
44
 
45
45
  # Additional configuration passed to a Session::Persistence cookie.
46
46
  @@cookie_options = { :httponly => true }
47
-
47
+
48
48
  def self.generate_password(secret, iteration)
49
49
  ROTP::HOTP.new(secret).at(iteration)
50
50
  end
@@ -54,11 +54,11 @@ module GoogleAuthenticatorRails
54
54
  end
55
55
 
56
56
  def self.valid?(code, secret, drift = DRIFT)
57
- ROTP::TOTP.new(secret).verify_with_drift(code, drift)
57
+ !!ROTP::TOTP.new(secret).verify(code, drift_ahead: drift, drift_behind: drift)
58
58
  end
59
59
 
60
60
  def self.generate_secret
61
- ROTP::Base32.random_base32
61
+ ROTP::Base32.random
62
62
  end
63
63
 
64
64
  def self.time_until_expiration
@@ -7,9 +7,9 @@ namespace :google_authenticator do
7
7
  # Adapted from https://stackoverflow.com/a/8248849/7478194
8
8
  Dir[Rails.root.join('app/models/*.rb').to_s].map { |filename| File.basename(filename, '.rb').camelize }
9
9
  end
10
-
10
+
11
11
  ActiveRecord::Base.transaction do
12
- match_op = " = #{already_encrypted ? 138 : 16}"
12
+ match_op = already_encrypted ? " in (138,162)" : "in (16,32)"
13
13
  model_names.each do |model_name|
14
14
  klass = model_name.constantize
15
15
  next unless klass.ancestors.include?(ActiveRecord::Base) && klass.try(:google_secrets_encrypted)
@@ -23,7 +23,7 @@ namespace :google_authenticator do
23
23
  end
24
24
  end
25
25
  end
26
-
26
+
27
27
  desc 'Encrypt all secret columns (add the :encrypt_secrets options *before* running)'
28
28
  task :encrypt_secrets, [:optional_model_list] => :environment do |_t, args|
29
29
  do_encrypt(args, false, 'Encrypt') { |record| record.encrypt_google_secret! }
@@ -46,10 +46,10 @@ namespace :google_authenticator do
46
46
  end
47
47
  end
48
48
  end
49
-
49
+
50
50
  desc 'Decrypt all secret columns (remove the :encrypt_secrets options *after* running)'
51
51
  task :decrypt_secrets, [:optional_model_list] => :environment do |_t, args|
52
52
  do_encrypt(args, true, 'Decrypt') { |record| record.send(:change_google_secret_to!, record.google_secret_value, false) }
53
- end
53
+ end
54
54
 
55
55
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe GoogleAuthenticatorRails::ActionController::Integration do
4
4
  describe '::included' do
5
5
  context 'ApplicationController already defined' do
6
- before { class ApplicationController < MockController; end }
7
- after { Object.send(:remove_const, :ApplicationController) }
8
- subject { lambda { MockController.send(:include, GoogleAuthenticatorRails::ActionController::Integration) } }
6
+ # Autoload ApplicationController.
7
+ before { ApplicationController }
8
+ subject { lambda { MockControllerWithApplicationController.send(:include, GoogleAuthenticatorRails::ActionController::Integration) } }
9
9
 
10
10
  it { should raise_error(GoogleAuthenticatorRails::ActionController::RailsAdapter::LoadedTooLateError) }
11
11
  end
@@ -1,29 +1,33 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe GoogleAuthenticatorRails do
4
+ def get_secret
5
+ 'LMFMFDV3UGN7LBO4FEMVQVJOK7F7FLLE'
6
+ end
7
+
4
8
  describe '#generate_password' do
5
- subject { GoogleAuthenticatorRails::generate_password("test", counter) }
9
+ subject { GoogleAuthenticatorRails::generate_password(get_secret, counter) }
6
10
 
7
11
  context 'counter = 1' do
8
12
  let(:counter) { 1 }
9
- it { should == "868864" }
13
+ it { should == "664045" }
10
14
  end
11
15
 
12
16
  context 'counter = 2' do
13
17
  let(:counter) { 2 }
14
- it { should == "304404" }
18
+ it { should == "548382" }
15
19
  end
16
20
  end
17
21
 
18
22
  context 'time-based passwords' do
19
- let(:secret) { '5qlcip7azyjuwm36' }
23
+ let(:secret) { get_secret }
20
24
  let(:original_time) { Time.parse("2012-08-07 11:11:00 AM +0700") }
21
25
  let!(:time) { original_time }
22
- let(:code) { "495502" }
26
+ let(:code) { "954578" }
23
27
 
24
28
  before do
25
- Time.stub!(:now).and_return(time)
26
- ROTP::Base32.stub!(:random_base32).and_return(secret)
29
+ allow(Time).to receive(:now).and_return(time)
30
+ allow(ROTP::Base32).to receive(:random).and_return(secret)
27
31
  end
28
32
 
29
33
  specify { GoogleAuthenticatorRails::time_based_password(secret).should == code }
@@ -43,49 +47,61 @@ describe GoogleAuthenticatorRails do
43
47
  @user = user
44
48
  user.google_secret = secret
45
49
  end
46
-
50
+
47
51
  context "custom drift" do
48
52
  # 30 seconds drift
49
53
  let(:user) { UserFactory.create DriftUser }
50
54
  subject { user.google_authentic?(code) }
51
-
55
+
52
56
  context '6 seconds of drift' do
53
57
  let(:time) { original_time + 36.seconds }
54
58
  it { should be true }
55
59
  end
56
-
60
+
57
61
  context '30 seconds of drift' do
58
62
  let(:time) { original_time + 61.seconds }
59
63
  it { should be false }
60
64
  end
61
65
  end
62
-
66
+
63
67
  context 'code validation' do
64
68
  subject { user.google_authentic?(code) }
65
-
69
+
66
70
  it { should be true }
67
-
71
+
68
72
  context 'within 5 seconds of drift' do
69
73
  let(:time) { original_time + 34.seconds }
70
74
  it { should be true }
71
75
  end
72
-
76
+
73
77
  context '6 seconds of drift' do
74
78
  let(:time) { original_time + 36.seconds }
75
79
  it { should be false }
76
80
  end
77
81
  end
78
-
82
+
83
+ context 'integer code validation' do
84
+ subject { user.google_authentic?(code.to_i) }
85
+
86
+ it { should be true }
87
+ end
88
+
79
89
  it 'creates a secret' do
80
90
  user.set_google_secret
81
91
  user.google_secret.should == secret
82
92
  end
83
-
93
+
84
94
  shared_examples 'handles nil secrets' do
85
95
  it 'clears a secret' do
86
96
  @user.clear_google_secret!
87
97
  @user.google_secret_value.should(be_nil) && @user.reload.google_secret_value.should(be_nil)
88
98
  end
99
+
100
+ it 'raises exception when checking authenticity' do
101
+ @user.clear_google_secret!
102
+
103
+ expect { @user.google_authentic?(code) }.to raise_error(ArgumentError)
104
+ end
89
105
  end
90
106
 
91
107
  it_behaves_like 'handles nil secrets'
@@ -95,102 +111,102 @@ describe GoogleAuthenticatorRails do
95
111
  @user = UserFactory.create EncryptedUser
96
112
  @user.set_google_secret
97
113
  end
98
-
114
+
99
115
  it 'encrypts_the_secret' do
100
- @user.google_secret.length.should == (GoogleAuthenticatorRails.encryption_supported? ? 138 : 16)
116
+ @user.google_secret.length.should == (GoogleAuthenticatorRails.encryption_supported? ? 162 : 32)
101
117
  end
102
-
118
+
103
119
  it 'decrypts_the_secret' do
104
120
  @user.google_secret_value.should == secret
105
- end
106
-
121
+ end
122
+
107
123
  it 'validates code' do
108
- @user.google_authentic?(code).should be_true
124
+ @user.google_authentic?(code).should be_truthy
109
125
  end
110
126
 
111
127
  it_behaves_like 'handles nil secrets'
112
128
  end
113
-
129
+
114
130
  context 'custom secret column' do
115
131
  before do
116
132
  @user = UserFactory.create CustomUser
117
133
  @user.set_google_secret
118
134
  end
119
-
135
+
120
136
  it 'validates code' do
121
- @user.google_authentic?(code).should be_true
137
+ @user.google_authentic?(code).should be_truthy
122
138
  end
123
-
139
+
124
140
  it 'generates a url for a qr code' do
125
- @user.google_qr_uri.should == "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=200x200"
141
+ @user.google_qr_uri.should == "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200"
126
142
  end
127
143
  end
128
-
144
+
129
145
  context 'encrypted column with custom secret column' do
130
146
  before do
131
147
  @user = UserFactory.create EncryptedCustomUser
132
148
  @user.set_google_secret
133
149
  end
134
-
150
+
135
151
  it 'encrypts the secret' do
136
- @user.mfa_secret.length.should == (GoogleAuthenticatorRails.encryption_supported? ? 138 : 16)
152
+ @user.mfa_secret.length.should == (GoogleAuthenticatorRails.encryption_supported? ? 162 : 32)
137
153
  end
138
-
154
+
139
155
  it 'decrypts the secret' do
140
156
  @user.google_secret_value.should == secret
141
- end
142
-
157
+ end
158
+
143
159
  it 'validates code' do
144
- @user.google_authentic?(code).should be_true
160
+ @user.google_authentic?(code).should be_truthy
145
161
  end
146
162
  end
147
-
163
+
148
164
  if GoogleAuthenticatorRails.encryption_supported?
149
165
  context 'encryption Rake tasks' do
150
166
  before(:all) { Rails.application.load_tasks }
151
-
167
+
152
168
  def set_and_run_task(type)
153
169
  User.delete_all
154
- EncryptedCustomUser.delete_all
170
+ EncryptedCustomUser.delete_all
155
171
  @user = UserFactory.create User
156
172
  @user.set_google_secret
157
173
  @encrypted_user = UserFactory.create EncryptedCustomUser
158
174
  @encrypted_user.set_google_secret
159
175
  @non_encrypted_user = UserFactory.create EncryptedCustomUser
160
- @non_encrypted_user.update_attribute(:mfa_secret, secret)
176
+ @non_encrypted_user.update_attribute(:mfa_secret, get_secret)
161
177
  Rake.application.invoke_task("google_authenticator:#{type}_secrets[User,EncryptedCustomUser]")
162
- end
163
-
178
+ end
179
+
164
180
  def encryption_ok?(user, secret_should_be_encrypted)
165
181
  secret_value = user.reload.send(:google_secret_column_value)
166
- (secret_value.blank? || secret_value.length.should == (secret_should_be_encrypted ? 138 : 16)) &&
182
+ (secret_value.blank? || secret_value.length.should == (secret_should_be_encrypted ? 162 : 32)) &&
167
183
  (user.class.google_secrets_encrypted ^ secret_should_be_encrypted || user.google_secret_value == secret)
168
184
  end
169
-
185
+
170
186
  shared_examples 'task tests' do |type|
171
187
  it 'handles non-encrypted secrets' do
172
188
  encryption_ok?(@non_encrypted_user, type == 'encrypt')
173
189
  end
174
-
190
+
175
191
  it 'handles encrypted secrets' do
176
192
  encryption_ok?(@encrypted_user, type != 'decrypt')
177
193
  end
178
-
194
+
179
195
  it "doesn't #{type} non-encrypted models" do
180
196
  encryption_ok?(@user, false)
181
197
  end
182
198
  end
183
-
199
+
184
200
  context 'encrypt_secrets task' do
185
201
  before(:all) { set_and_run_task('encrypt') }
186
202
  it_behaves_like 'task tests', 'encrypt'
187
203
  end
188
-
204
+
189
205
  context 'decrypt_secrets task' do
190
206
  before(:all) { set_and_run_task('decrypt') }
191
207
  it_behaves_like 'task tests', 'decrypt'
192
208
  end
193
-
209
+
194
210
  context 'reencrypt_secrets task' do
195
211
  before(:all) do
196
212
  def reset_encryption(secret_key_base)
@@ -198,79 +214,84 @@ describe GoogleAuthenticatorRails do
198
214
  Rails.application.instance_eval { @caching_key_generator = nil }
199
215
  GoogleAuthenticatorRails.secret_encryptor = nil
200
216
  end
201
-
217
+
202
218
  current_secret_key_base = Rails.application.secrets[:secret_key_base]
203
219
  reset_encryption(Rails.application.secrets.old_secret_key_base)
204
220
  set_and_run_task('reencrypt')
205
221
  reset_encryption(current_secret_key_base)
206
222
  end
207
-
223
+
208
224
  it_behaves_like 'task tests', 'reencrypt'
209
225
  end
210
226
  end
211
227
  end
212
-
228
+
213
229
  context 'google label' do
214
230
  let(:user) { UserFactory.create NilMethodUser }
215
231
  subject { lambda { user.google_label } }
216
232
  it { should raise_error(NoMethodError) }
217
233
  end
218
-
234
+
219
235
  context "drift value" do
220
236
  it { DriftUser.google_drift.should == 31 }
221
-
237
+
222
238
  context "default value" do
223
239
  it { User.google_drift.should == 6 }
224
240
  end
225
241
  end
226
-
242
+
227
243
  context 'qr codes' do
228
244
  let(:user) { UserFactory.create User }
229
245
  before { user.set_google_secret }
230
246
  subject { user.google_qr_uri }
231
-
232
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=200x200" }
233
-
247
+
248
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200" }
249
+
234
250
  context 'custom column name' do
235
251
  let(:user) { UserFactory.create ColumnNameUser }
236
252
  it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest_user%3Fsecret%3D#{secret}&chs=200x200" }
237
253
  end
238
-
254
+
239
255
  context 'custom proc' do
240
256
  let(:user) { UserFactory.create ProcLabelUser }
241
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest_user%40futureadvisor-admin%3Fsecret%3D#{secret}&chs=200x200" }
257
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest_user%2540futureadvisor-admin%3Fsecret%3D#{secret}&chs=200x200" }
242
258
  end
243
-
259
+
244
260
  context 'custom issuer' do
245
261
  let(:user) { UserFactory.create ProcIssuerUser }
246
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2FFA%2520Admin%3Atest%40example.com%3Fsecret%3D#{secret}%26issuer%3DFA%2BAdmin&chs=200x200" }
262
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2FFA%2520Admin%3Atest%2540example.com%3Fsecret%3D#{secret}%26issuer%3DFA%2520Admin&chs=200x200" }
247
263
  end
248
-
264
+
249
265
  context 'method defined by symbol' do
250
266
  let(:user) { UserFactory.create SymbolUser }
251
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=200x200" }
267
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200" }
252
268
  end
253
-
269
+
254
270
  context 'method defined by string' do
255
271
  let(:user) { UserFactory.create StringUser }
256
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=200x200" }
272
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200" }
257
273
  end
258
-
274
+
259
275
  context 'custom qr size' do
260
276
  let(:user) { UserFactory.create QrCodeUser }
261
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=300x300" }
277
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=300x300" }
262
278
  end
263
-
279
+
264
280
  context 'qr size passed to method' do
265
281
  subject { user.google_qr_uri('400x400') }
266
- let(:user) { UserFactory.create StringUser }
267
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=400x400" }
282
+ let(:user) { UserFactory.create StringUser }
283
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=400x400" }
268
284
  end
269
-
285
+
270
286
  context 'qr size passed to method and size set on model' do
271
287
  let(:user) { UserFactory.create QrCodeUser }
272
288
  subject { user.google_qr_uri('400x400') }
273
- it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%40example.com%3Fsecret%3D#{secret}&chs=400x400" }
289
+ it { should eq "https://chart.googleapis.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=400x400" }
290
+ end
291
+
292
+ context 'generates base64 image' do
293
+ let(:user) { UserFactory.create QrCodeUser }
294
+ it { user.google_qr_to_base64.include?('data:image/png;base64').should be_truthy }
274
295
  end
275
296
  end
276
297
  end
@@ -20,7 +20,9 @@ describe GoogleAuthenticatorRails::Session::Base do
20
20
  after { clear_cookie unless user.nil? }
21
21
 
22
22
  it { should be_a UserMfaSession }
23
- its(:record) { should eq user }
23
+ it "can fetch the record" do
24
+ expect(subject.record).to eq(user)
25
+ end
24
26
 
25
27
  context 'custom lookup token' do
26
28
  let(:user) { SaltUser.create(:password => "password", :email => "email@example.com") }
@@ -28,7 +30,9 @@ describe GoogleAuthenticatorRails::Session::Base do
28
30
  subject { SaltUserMfaSession.find }
29
31
 
30
32
  it { should be_a SaltUserMfaSession }
31
- its(:record) { should eq user }
33
+ it "can fetch the record" do
34
+ expect(subject.record).to eq(user)
35
+ end
32
36
  end
33
37
 
34
38
  context 'after destroy' do
@@ -46,7 +50,9 @@ describe GoogleAuthenticatorRails::Session::Base do
46
50
  subject { UserMfaSession.create(user) }
47
51
 
48
52
  it { should be_a UserMfaSession }
49
- its(:record) { should eq user }
53
+ it "can fetch the record" do
54
+ expect(subject.record).to eq(user)
55
+ end
50
56
 
51
57
  context 'nil user' do
52
58
  let(:user) { nil }
data/spec/spec_helper.rb CHANGED
@@ -13,8 +13,18 @@ SimpleCov.start
13
13
 
14
14
  require 'google-authenticator-rails'
15
15
 
16
- class MockController
17
- class << self
16
+ module MockControllerBase
17
+ def self.included(klass)
18
+ klass.class_eval do
19
+ extend ClassMethods
20
+
21
+ include GoogleAuthenticatorRails::ActionController::Integration
22
+
23
+ attr_accessor :cookies
24
+ end
25
+ end
26
+
27
+ module ClassMethods
18
28
  attr_accessor :callbacks
19
29
 
20
30
  def prepend_before_filter(filter)
@@ -23,15 +33,22 @@ class MockController
23
33
  end
24
34
  end
25
35
 
26
- include GoogleAuthenticatorRails::ActionController::Integration
27
-
28
- attr_accessor :cookies
29
-
30
36
  def initialize
31
37
  @cookies = MockCookieJar.new
32
38
  end
33
39
  end
34
40
 
41
+ class MockController
42
+ include MockControllerBase
43
+ end
44
+
45
+ class MockControllerWithApplicationController
46
+ include MockControllerBase
47
+ end
48
+
49
+ # Simulate Rails' autoloading for ApplicationController.
50
+ autoload :ApplicationController, File.join(File.dirname(__FILE__), 'support/application_controller')
51
+
35
52
  class MockCookieJar < Hash
36
53
  def [](key)
37
54
  hash = super
@@ -0,0 +1,2 @@
1
+ class ApplicationController < MockControllerWithApplicationController
2
+ end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-authenticator-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared McFarland
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rotp
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 3.3.0
22
+ version: '7.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '='
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 3.3.0
29
+ version: '5.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rails
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +59,7 @@ dependencies:
53
59
  - !ruby/object:Gem::Version
54
60
  version: '0'
55
61
  - !ruby/object:Gem::Dependency
56
- name: google-qr
62
+ name: rqrcode
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - ">="
@@ -86,42 +92,42 @@ dependencies:
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '11.0'
95
+ version: '13.0'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '11.0'
102
+ version: '13.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: rspec
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: 2.8.0
109
+ version: 3.4.0
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
- version: 2.8.0
116
+ version: 3.4.0
111
117
  - !ruby/object:Gem::Dependency
112
118
  name: appraisal
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
115
121
  - - "~>"
116
122
  - !ruby/object:Gem::Version
117
- version: 0.5.1
123
+ version: 2.4.1
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - "~>"
123
129
  - !ruby/object:Gem::Version
124
- version: 0.5.1
130
+ version: 2.4.1
125
131
  - !ruby/object:Gem::Dependency
126
132
  name: simplecov
127
133
  requirement: !ruby/object:Gem::Requirement
@@ -140,16 +146,16 @@ dependencies:
140
146
  name: sqlite3
141
147
  requirement: !ruby/object:Gem::Requirement
142
148
  requirements:
143
- - - ">="
149
+ - - "~>"
144
150
  - !ruby/object:Gem::Version
145
- version: '0'
151
+ version: 1.4.0
146
152
  type: :development
147
153
  prerelease: false
148
154
  version_requirements: !ruby/object:Gem::Requirement
149
155
  requirements:
150
- - - ">="
156
+ - - "~>"
151
157
  - !ruby/object:Gem::Version
152
- version: '0'
158
+ version: 1.4.0
153
159
  description: Add the ability to use the Google Authenticator with ActiveRecord.
154
160
  email:
155
161
  - jared.online@gmail.com
@@ -160,12 +166,12 @@ files:
160
166
  - Appraisals
161
167
  - CODE_OF_CONDUCT.md
162
168
  - CONTRIBUTING.md
163
- - Dockerfile
164
169
  - Gemfile
165
170
  - Gemfile.lock
166
171
  - LICENSE
167
172
  - README.md
168
173
  - Rakefile
174
+ - google-authenticator.gemspec
169
175
  - lib/google-authenticator-rails.rb
170
176
  - lib/google-authenticator-rails/action_controller.rb
171
177
  - lib/google-authenticator-rails/action_controller/rails_adapter.rb
@@ -184,10 +190,11 @@ files:
184
190
  - spec/session/activation_spec.rb
185
191
  - spec/session/persistance_spec.rb
186
192
  - spec/spec_helper.rb
193
+ - spec/support/application_controller.rb
187
194
  homepage: http://github.com/jaredonline/google-authenticator
188
195
  licenses: []
189
196
  metadata: {}
190
- post_install_message:
197
+ post_install_message:
191
198
  rdoc_options: []
192
199
  require_paths:
193
200
  - lib
@@ -202,9 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
209
  - !ruby/object:Gem::Version
203
210
  version: '0'
204
211
  requirements: []
205
- rubyforge_project:
206
- rubygems_version: 2.5.1
207
- signing_key:
212
+ rubygems_version: 3.3.15
213
+ signing_key:
208
214
  specification_version: 4
209
215
  summary: Add the ability to use the Google Authenticator with ActiveRecord.
210
216
  test_files:
@@ -214,3 +220,4 @@ test_files:
214
220
  - spec/session/activation_spec.rb
215
221
  - spec/session/persistance_spec.rb
216
222
  - spec/spec_helper.rb
223
+ - spec/support/application_controller.rb
data/Dockerfile DELETED
@@ -1,17 +0,0 @@
1
- FROM ruby:2.3.1
2
-
3
- RUN mkdir -p /var/app
4
-
5
- COPY Gemfile /var/app/Gemfile
6
- COPY Gemfile.lock /var/app/Gemfile.lock
7
- COPY google-authenticator.gemspec /var/app/google-authenticator.gemspec
8
- COPY lib/google-authenticator-rails/version.rb /var/app/lib/google-authenticator-rails/version.rb
9
- COPY Rakefile /var/app/Rakefile
10
- COPY gemfiles/*.gemfile /var/app/
11
- WORKDIR /var/app
12
-
13
- RUN gem install bundler --version=1.15.4 --no-ri --no-rdoc
14
-
15
- RUN bundle install
16
- RUN bundle exec rake appraisal:install
17
-