google-authenticator-rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
File without changes
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# GoogleAuthenticatorRails
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/google-authenticator-rails.png)](http://badge.fury.io/rb/google-authenticator-rails)
|
3
4
|
[![Build Status](https://secure.travis-ci.org/jaredonline/google-authenticator.png)](http://travis-ci.org/jaredonline/google-authenticator)
|
4
5
|
|
5
6
|
Rails (ActiveRecord) integration with the Google Authenticator apps for Android and the iPhone. Uses the Authlogic style for cookie management.
|
@@ -157,6 +158,14 @@ class ApplicationController < ActionController::Base
|
|
157
158
|
end
|
158
159
|
```
|
159
160
|
|
161
|
+
By default, the cookie related to the MfaSession expires in 24 hours, but this can be changed:
|
162
|
+
```ruby
|
163
|
+
config/initializers/google_authenticator_rails.rb
|
164
|
+
|
165
|
+
GoogleAuthenticatorRails.time_until_expiration = 1.month
|
166
|
+
```
|
167
|
+
|
168
|
+
|
160
169
|
## Contributing
|
161
170
|
|
162
171
|
1. Fork it
|
@@ -167,4 +176,4 @@ end
|
|
167
176
|
|
168
177
|
## License
|
169
178
|
|
170
|
-
MIT.
|
179
|
+
MIT.
|
@@ -25,7 +25,10 @@ GOOGLE_AUTHENTICATOR_RAILS_PATH = File.dirname(__FILE__) + "/google-authenticato
|
|
25
25
|
module GoogleAuthenticatorRails
|
26
26
|
# Drift is set to 6 because ROTP drift is not inclusive. This allows a drift of 5 seconds.
|
27
27
|
DRIFT = 6
|
28
|
-
|
28
|
+
|
29
|
+
# How long a Session::Persistence cookie should last.
|
30
|
+
@@time_until_expiration = 24.hours
|
31
|
+
|
29
32
|
def self.generate_password(secret, iteration)
|
30
33
|
ROTP::HOTP.new(secret).at(iteration)
|
31
34
|
end
|
@@ -41,4 +44,12 @@ module GoogleAuthenticatorRails
|
|
41
44
|
def self.generate_secret
|
42
45
|
ROTP::Base32.random_base32
|
43
46
|
end
|
47
|
+
|
48
|
+
def self.time_until_expiration
|
49
|
+
@@time_until_expiration
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.time_until_expiration=(time_until_expiration)
|
53
|
+
@@time_until_expiration = time_until_expiration
|
54
|
+
end
|
44
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-authenticator-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rotp
|
@@ -117,7 +117,7 @@ files:
|
|
117
117
|
- .gitignore
|
118
118
|
- .rspec
|
119
119
|
- .travis.yml
|
120
|
-
-
|
120
|
+
- CONTRIBUTING.md
|
121
121
|
- Gemfile
|
122
122
|
- LICENSE
|
123
123
|
- README.md
|