omniauth-mobileid 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 76a9a63c03bef130935884acc7c8556fa820964c
4
+ data.tar.gz: 9747746b5b9bc7be99e89993a344db32d859b629
5
+ SHA512:
6
+ metadata.gz: 02cf668fc9ffcab83629294ce4ab5ae4ccc46a12d97fb0b29905499467f1d4e24a6ef3351a3c46a1f501ae034863927a112bfcbc31ca2a13deb37dec9b2e7cac
7
+ data.tar.gz: 7ccf7937e3c1b1647e38e860dbbab2c1f464ea34f43b4eab9afc2ed8c0be08a376868ba317844061710f1cc09cec1854e70cde007378ca40542304a3a57706fe
@@ -8,7 +8,7 @@ module OmniAuth
8
8
 
9
9
  PhaseReadPin = 'read_pin'
10
10
  PhaseAuhtenticated = 'authenticated'
11
-
11
+
12
12
  option :name, 'mobileid'
13
13
  option :service_name, 'Testimine'
14
14
  option :country_code, 'EE'
@@ -18,7 +18,7 @@ module OmniAuth
18
18
  option :async_configuration, 0
19
19
  option :endpoint_url, 'https://openxades.org:8443/DigiDocService'
20
20
  option :logger, nil
21
-
21
+
22
22
  def request_phase
23
23
  perform
24
24
  end
@@ -30,7 +30,7 @@ module OmniAuth
30
30
  perform_authentication
31
31
  end
32
32
  end
33
-
33
+
34
34
  def request_session_code
35
35
  request.params['session_code']
36
36
  end
@@ -39,7 +39,7 @@ module OmniAuth
39
39
  debug 'perform_authentication'
40
40
  @auth_data = authenticate(request.params['phone'], request.params['personal_code'])
41
41
  debug user_data.inspect
42
-
42
+
43
43
  if user_data[:status] == 'OK'
44
44
  @env['omniauth.auth'] = auth_hash
45
45
  @env['omniauth.phase'] = PhaseReadPin
@@ -55,7 +55,9 @@ module OmniAuth
55
55
  debug 'get_authentication_status'
56
56
  @auth_data = authentication_status(request_session_code)
57
57
  debug @auth_data.inspect
58
+
58
59
  if ['USER_AUTHENTICATED', 'OUTSTANDING_TRANSACTION'].include?(user_data[:status])
60
+ @env['omniauth.auth'] = auth_hash
59
61
  @env['omniauth.phase'] = user_data[:status] == 'USER_AUTHENTICATED' ? PhaseAuhtenticated : PhaseReadPin
60
62
  @env['REQUEST_METHOD'] = 'GET'
61
63
  @env['PATH_INFO'] = "#{OmniAuth.config.path_prefix}/#{name}/callback"
@@ -69,18 +71,18 @@ module OmniAuth
69
71
  debug "callback_phase"
70
72
  fail!(failure_reason)
71
73
  end
72
-
74
+
73
75
  def failure_reason
74
76
  return :invalid_credentials if user_data.blank?
75
-
77
+
76
78
  code = (user_data[:faultstring] || user_data[:status]).try(:downcase)
77
79
  "error_#{code || 'unknown'}"
78
80
  end
79
-
81
+
80
82
  def user_data
81
83
  @auth_data
82
84
  end
83
-
85
+
84
86
  def auth_hash
85
87
  OmniAuth::Utils.deep_merge(super, {
86
88
  'uid' => user_data[:user_id_code],
@@ -116,7 +118,7 @@ module OmniAuth
116
118
  :return_cert_data => false,
117
119
  :return_revocation_data => false
118
120
  }
119
-
121
+
120
122
  self.mobileid_client.authenticate(data)
121
123
  end
122
124
 
@@ -126,11 +128,11 @@ module OmniAuth
126
128
  end
127
129
 
128
130
  protected
129
-
131
+
130
132
  def debug(message)
131
133
  options[:logger].debug("#{Time.now} #{message}") if options[:logger]
132
- end
133
-
134
+ end
135
+
134
136
  def mobileid_client
135
137
  client = ::Digidoc::Client.new(options[:endpoint_url])
136
138
  client.respond_with_nested_struct = false
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Mobileid
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-mobileid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tarmo Talu
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-04-19 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: omniauth-oauth
16
- requirement: &70123839121140 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70123839121140
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: digidoc_client
27
- requirement: &70123839120400 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0.1'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70123839120400
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
36
41
  description: OmniAuth strategy for Estonian Mobile-ID
37
42
  email:
38
43
  - tarmo.talu@gmail.com
@@ -49,26 +54,25 @@ files:
49
54
  - omniauth-mobileid.gemspec
50
55
  homepage: http://github.com/tarmotalu/omniauth-mobileid
51
56
  licenses: []
57
+ metadata: {}
52
58
  post_install_message:
53
59
  rdoc_options: []
54
60
  require_paths:
55
61
  - lib
56
62
  required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
63
  requirements:
59
- - - ! '>='
64
+ - - '>='
60
65
  - !ruby/object:Gem::Version
61
66
  version: '0'
62
67
  required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
68
  requirements:
65
- - - ! '>='
69
+ - - '>='
66
70
  - !ruby/object:Gem::Version
67
71
  version: '0'
68
72
  requirements: []
69
73
  rubyforge_project: omniauth-mobileid
70
- rubygems_version: 1.8.11
74
+ rubygems_version: 2.1.10
71
75
  signing_key:
72
- specification_version: 3
76
+ specification_version: 4
73
77
  summary: OmniAuth strategy for Estonian Mobile-ID
74
78
  test_files: []