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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35015f1621c2543741995220d6fe872bdead9bd2
4
- data.tar.gz: 5cefc818af46d4e8583260a33156e400064b8f59
3
+ metadata.gz: c04e4b8c1e1975622215e92d66d36465d27557e2
4
+ data.tar.gz: 40416f06a0627fe5056b020c80d41c34eede76b5
5
5
  SHA512:
6
- metadata.gz: 9157e336e309ec819ab20e8bd6d59bb1459d04caf2dfaf0cac7111007e4d933437313b2ec51d9f2deb8976ec600b2796af0bfc66698481f7b3eda03e10853048
7
- data.tar.gz: b2e40e0014f884cee4801450fe6f937f0e7574274513d51beb8318ce5116c27608e9445cf67241936b73cd2fe22beb4d0f4b5a87d545dc74f90cbb629ad690f2
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
- resource._userbin_id, email: resource.email)
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DeviseUserbin
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
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.2.2
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-07-13 00:00:00.000000000 Z
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.1.2
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.1.2
40
+ version: 1.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement