devise_userbin 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devise_userbin/controllers/helpers.rb +4 -5
- data/lib/devise_userbin/hooks.rb +7 -0
- data/lib/devise_userbin/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c04e4b8c1e1975622215e92d66d36465d27557e2
|
4
|
+
data.tar.gz: 40416f06a0627fe5056b020c80d41c34eede76b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aa9ee588470e15e19fdd4e23efdf6fcbc8eb323293cb507267a23afb044866dfb2c1934ad93e208ca24f1918e0990792a930480d39719c389797749d8428f01
|
7
|
+
data.tar.gz: 446bcad60762fd4338bf3bfa6c3dd4cbda2d05412cdddc4f77722a27332caa5fc0fd42f40e53434fff7f84c6e00f9f030dad0d01f622e550170dd916ce40b082
|
@@ -13,11 +13,10 @@ module DeviseUserbin
|
|
13
13
|
def authorize_resource
|
14
14
|
Devise.mappings.keys.flatten.any? do |scope|
|
15
15
|
if signed_in?(scope)
|
16
|
-
resource = send("current_#{scope}")
|
17
|
-
|
18
16
|
begin
|
19
|
-
env['userbin'].authorize
|
20
|
-
|
17
|
+
env['userbin'].authorize
|
18
|
+
rescue Userbin::RequestError
|
19
|
+
# ignore that the API is unreachable
|
21
20
|
rescue Userbin::Error
|
22
21
|
warden.logout(scope)
|
23
22
|
throw :warden, :scope => scope, :message => :signed_out
|
@@ -44,7 +43,7 @@ module DeviseUserbin
|
|
44
43
|
|
45
44
|
# Show form and message specific to the current factor
|
46
45
|
case factor
|
47
|
-
when :authenticator
|
46
|
+
when :authenticator, :yubikey
|
48
47
|
handle_required_two_factor_authentication(scope)
|
49
48
|
end
|
50
49
|
rescue Userbin::Error
|
data/lib/devise_userbin/hooks.rb
CHANGED
@@ -2,6 +2,13 @@ Warden::Manager.on_request do |warden|
|
|
2
2
|
warden.request.env['userbin'] = Userbin::Client.new(warden.request)
|
3
3
|
end
|
4
4
|
|
5
|
+
Warden::Manager.after_authentication do |record, warden, opts|
|
6
|
+
if record.respond_to?(:userbin_id)
|
7
|
+
warden.request.env['userbin'].login(
|
8
|
+
record._userbin_id, email: record.email)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
5
12
|
Warden::Manager.before_logout do |record, warden, opts|
|
6
13
|
if record.respond_to?(:userbin_id)
|
7
14
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_userbin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Brissmyr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
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: 1.
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|