identikey 0.4.2 → 0.4.3

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
  SHA256:
3
- metadata.gz: 0ee502eb590570b3a09edb58b436ebf72e86cdd22f6891e7f75563978d471ab4
4
- data.tar.gz: cdd45005c57900fb13fbea2d7b40761b0dfb78a7d70aca8458569c823e6b0075
3
+ metadata.gz: 7250ec019f47150ff6dd6c34436cda2615daad7cc2ab27a9ff24b92a8d412985
4
+ data.tar.gz: dc079e945e696d1480f80e90ab1ecf339a8b441c243cca201332c199c22ed570
5
5
  SHA512:
6
- metadata.gz: dc93b984114056589ceba043215c3845f95bf3604085c94b08e19e6f3131d53c083c10a3f3a2b806699d3e44b281b4317af3243cfe007adb947ae4f191c50957
7
- data.tar.gz: 1bbe9da3e86ca3b108c73db040536b609090038fd36fe799680a9cb24690f1a1e9209d9829413c0f415551bcb26e82fd7527d144a678954e4c7525a28a80f7c0
6
+ metadata.gz: 348dc3966a4bf3e9d31afefc738a0f698572035f2fed833de9f5260d115bd2b528eb546a69599cf67982ed23561691554055b1d998255f69454c681b26f48956
7
+ data.tar.gz: 8afac75cce4902ce9e3939505c7f1a6707555b7ba1e9906cec0645d136a820fb8f6108c906c76982753499adec8fcd1a9c7a771e1e3861be6c15b7f25f7ec8fa
data/.gitignore CHANGED
@@ -5,8 +5,10 @@
5
5
  /doc/
6
6
  /pkg/
7
7
  /spec/reports/
8
+ /spec/test.env
8
9
  /tmp/
9
10
  /log/
11
+ /sdk
10
12
 
11
13
  Gemfile.lock
12
14
 
data/README.md CHANGED
@@ -190,6 +190,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then,
190
190
  run `rake` to run the tests. You can also run `bin/console` for an interactive
191
191
  prompt that will allow you to experiment.
192
192
 
193
+ To run specs, please copy `spec/test.env.example` into `spec/test.env` and
194
+ populate it with your Identikey Authentication Server host, username, password
195
+ and domain. You also need the Identikey SDK, that can be placed in `/sdk` and
196
+ its WSDL paths as well referenced in the `spec/test.env` file.
197
+
193
198
  To install this gem onto your local machine, run `bundle exec rake install`.
194
199
 
195
200
  To release a new version, update the version number in `version.rb`, and then
data/identikey.gemspec CHANGED
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'hirb'
32
32
  spec.add_development_dependency 'byebug'
33
33
  spec.add_development_dependency 'simplecov'
34
+ spec.add_development_dependency 'dotenv'
34
35
  end
@@ -77,9 +77,11 @@ module Identikey
77
77
  replace(digipass)
78
78
  end
79
79
 
80
- def test_otp(otp)
80
+ def test_otp(otp, application: nil)
81
+ application ||= self.default_application!
82
+
81
83
  stat, appl, error = @session.execute(
82
- :digipassappl_execute_TEST_OTP, serial_no: self.serial, appl: self.application, otp: otp)
84
+ :digipassappl_execute_TEST_OTP, serial_no: self.serial, appl: application, otp: otp)
83
85
 
84
86
  # Stat is useless here - it reports whether the call or not has
85
87
  # succeeded, not whether the OTP is valid
@@ -90,6 +92,33 @@ module Identikey
90
92
  appl['DIGIPASSAPPLFLD_RESULT_CODE'] == '0'
91
93
  end
92
94
 
95
+ def set_pin(pin, application: nil)
96
+ application ||= self.default_application!
97
+
98
+ stat, _, error = @session.execute(
99
+ :digipassappl_execute_SET_PIN, serial_no: self.serial, appl: application, pin: pin)
100
+
101
+ if stat != 'STAT_SUCCESS'
102
+ raise Identikey::OperationFailed, "Set PIN failed: #{stat} - #{error}"
103
+ end
104
+
105
+ true
106
+ end
107
+
108
+ def default_application!
109
+ if self.applications.size == 1
110
+ self.applications.first
111
+ else
112
+ raise Identikey::UsageError,
113
+ "Digipass #{self.serial} has more than one application. " \
114
+ "Please specify which one to use out of #{applications.join(', ')}"
115
+ end
116
+ end
117
+
118
+ def applications
119
+ @_applications ||= @attributes.fetch(:application).split(',')
120
+ end
121
+
93
122
  def method_missing(name, *args, &block)
94
123
  if @attributes.key?(name)
95
124
  @attributes.fetch(name)
@@ -219,5 +219,18 @@ module Identikey
219
219
  )
220
220
  end
221
221
 
222
+ def digipassappl_execute_SET_PIN(session_id:, serial_no:, appl:, pin:)
223
+ digipassappl_execute(
224
+ session_id: session_id,
225
+ cmd: 'DIGIPASSAPPLCMD_SET_PIN',
226
+ attributes: typed_attributes_list_from(
227
+ DIGIPASSAPPLFLD_SERNO: serial_no,
228
+ DIGIPASSAPPLFLD_APPL_NAME: appl,
229
+ DIGIPASSAPPLFLD_NEW_PIN: pin,
230
+ DIGIPASSAPPLFLD_NEW_PIN_CONF: pin
231
+ )
232
+ )
233
+ end
234
+
222
235
  end
223
236
  end
@@ -1,3 +1,3 @@
1
1
  module Identikey
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: identikey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcello Barnaba
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-01 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: dotenv
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: This gem contains a SOAP client to consume Identikey API
126
140
  email:
127
141
  - vjt@openssl.it