omniauth-multipassword 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,11 +19,13 @@ module OmniAuth
19
19
  end
20
20
 
21
21
  def username
22
- request[username_id]
22
+ @username || request[username_id].to_s
23
23
  end
24
24
 
25
- def request=(request)
26
- @request = request
25
+ def init_authenticator(request, env, username)
26
+ @request = request
27
+ @env = env
28
+ @username = username
27
29
  end
28
30
 
29
31
  def callback_phase
@@ -2,8 +2,8 @@ module Omniauth
2
2
  module Multipassword
3
3
  module VERSION
4
4
  MAJOR = 0
5
- MINOR = 1
6
- PATCH = 1
5
+ MINOR = 2
6
+ PATCH = 0
7
7
  STAGE = nil
8
8
 
9
9
  def self.to_s
@@ -32,8 +32,9 @@ module OmniAuth
32
32
  end
33
33
  end
34
34
 
35
+ args << block if block
35
36
  @authenticators ||= []
36
- @authenticators << [ klass, args, block ]
37
+ @authenticators << [ klass, args ]
37
38
  end
38
39
 
39
40
  def callback_phase
@@ -49,12 +50,8 @@ module OmniAuth
49
50
  def authenticate(username, password)
50
51
  @authenticators.each do |auth|
51
52
  begin
52
- if auth[2]
53
- @authenticator = auth[0].new @app, *auth[1], auth[2]
54
- else
55
- @authenticator = auth[0].new @app, *auth[1]
56
- end
57
- @authenticator.request = self.request
53
+ @authenticator = auth[0].new @app, *auth[1]
54
+ @authenticator.init_authenticator(@request, @env, username)
58
55
  return true if @authenticator.authenticate(username, password)
59
56
  rescue Error => e
60
57
  OmniAuth.logger.warn "OmniAuth ERR >>> " + e
@@ -65,11 +62,9 @@ module OmniAuth
65
62
  end
66
63
 
67
64
  info do
68
- if @authenticator and @authenticator.info.is_a?(Hash)
69
- @authenticator.info
70
- else
71
- {}
72
- end
65
+ info = @authenticator.info if @authenticator
66
+ info = {} unless info.is_a?(Hash)
67
+ info
73
68
  end
74
69
  end
75
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-multipassword
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
16
- requirement: &14724960 !ruby/object:Gem::Requirement
16
+ requirement: &18337760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *14724960
24
+ version_requirements: *18337760
25
25
  description: A OmniAuth strategy to authenticate using different passwort strategies.
26
26
  email:
27
27
  - jan.graichen@altimos.de