identikey 0.5.2 → 0.5.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: 39bb043b3ece2e37fc84ec06bb4f83b88be7af8391fb2061bee01d64fc9f0464
4
- data.tar.gz: 94114e6c78ce9572c80b415be3a27bb39e17eb57e978fcb1a446da4a63fc1d00
3
+ metadata.gz: e0048f4b07f0fbc24be2b831720ab1c7c69c6258a35991ba562bf61f83773a9b
4
+ data.tar.gz: 49e7727c5ee48b62558e673d7dc43b17a26f61ef0b3131e9b7a8f96a90ed0526
5
5
  SHA512:
6
- metadata.gz: 43194c6c964d57d6565ccd01d5b714ad4f61ae9658d24c3798b240715b543e67378f1e44ade48c3d76af245072bb7704399b80763934a4a8141b444806288b76
7
- data.tar.gz: 3aa8e78fc6d9b07b1d308b28cfaa4da4ede847dd33af3311a2db2f699ed9521720ec5d88485286be66f2c71aaf4f6b0bc276fd92b32e7e4df976064fb9ca9a83
6
+ metadata.gz: 43286dad58a7fac8d978c5c1f403c3dc7007af49c8eafe509566a2da10f38774b7555b6c524d1cf401d1d55a8e2f4e4a6cf4fcc5a9c93cc2cc42637745341a09
7
+ data.tar.gz: 54396564a6e61eeebcd20656f72a3462412fd53212c4b88d34be3a0806913a71ea8778184ec3dabef47ba7001d21c46380136aaaa245583d49573775920c186c
data/.gitignore CHANGED
@@ -14,6 +14,8 @@ Gemfile.lock
14
14
 
15
15
  .byebug_history
16
16
 
17
+ .env
18
+
17
19
  # vim swap files
18
20
 
19
21
  .*.sw?
data/Guardfile ADDED
@@ -0,0 +1,23 @@
1
+ # Note: The cmd option is now required due to the increasing number of ways
2
+ # rspec may be run, below are examples of the most common uses.
3
+ # * bundler: 'bundle exec rspec'
4
+ # * bundler binstubs: 'bin/rspec'
5
+ # * spring: 'bin/rspec' (This will use spring if running and you have
6
+ # installed the spring binstubs per the docs)
7
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
8
+ # * 'just' rspec: 'rspec'
9
+
10
+ guard :rspec, cmd: "bundle exec rspec" do
11
+ require "guard/rspec/dsl"
12
+ dsl = Guard::RSpec::Dsl.new(self)
13
+
14
+ # RSpec files
15
+ rspec = dsl.rspec
16
+ watch(rspec.spec_helper) { rspec.spec_dir }
17
+ watch(rspec.spec_support) { rspec.spec_dir }
18
+ watch(rspec.spec_files)
19
+
20
+ # Ruby files
21
+ ruby = dsl.ruby
22
+ dsl.watch_spec_files_for(ruby.lib_files)
23
+ end
data/README.md CHANGED
@@ -186,15 +186,21 @@ your application.
186
186
 
187
187
  ## Development
188
188
 
189
- After checking out the repo, run `bin/setup` to install dependencies. Then,
190
- run `rake` to run the tests. You can also run `bin/console` for an interactive
191
- prompt that will allow you to experiment.
189
+ After checking out the repo, run `bin/setup` to install dependencies.
192
190
 
193
- To run specs, please copy `spec/test.env.example` into `spec/test.env` and
191
+ Then, please copy `spec/test.env.example` into `spec/test.env` and
194
192
  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
193
+ and domain.
194
+
195
+ You also need the Identikey SDK, that can be placed in `sdk/` and
196
196
  its WSDL paths as well referenced in the `spec/test.env` file.
197
197
 
198
+ Then, run `rake` to run the tests.
199
+
200
+ You can also run `bin/console` for an interactive prompt that will allow you
201
+ to experiment. It requires the same environment variables required by the
202
+ specs.
203
+
198
204
  To install this gem onto your local machine, run `bundle exec rake install`.
199
205
 
200
206
  To release a new version, update the version number in `version.rb`, and then
data/bin/console CHANGED
@@ -3,8 +3,27 @@
3
3
  require 'bundler/setup'
4
4
  require 'identikey'
5
5
 
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
6
+ Identikey::Authentication.configure do
7
+ wsdl ENV.fetch('IK_WSDL_AUTH')
8
+ endpoint ENV.fetch('IK_HOST')
9
+ end
10
+
11
+ puts "Configured Auth WSDL #{ENV.fetch('IK_WSDL_AUTH')} against #{ENV.fetch('IK_HOST')}"
12
+
13
+ Identikey::Administration.configure do
14
+ wsdl ENV.fetch('IK_WSDL_ADMIN')
15
+ endpoint ENV.fetch('IK_HOST')
16
+ end
17
+
18
+ puts "Configured Admin WSDL #{ENV.fetch('IK_WSDL_ADMIN')} against #{ENV.fetch('IK_HOST')}"
19
+
20
+ $ik = Identikey::Administration::Session.new(
21
+ username: ENV.fetch('IK_USER'),
22
+ password: ENV.fetch('IK_PASS'),
23
+ domain: ENV.fetch('IK_DOMAIN')
24
+ )
25
+
26
+ puts "Opened admin session with #{ENV.fetch('IK_USER')}@#{ENV.fetch('IK_DOMAIN')} against #{ENV.fetch('IK_HOST')}. Find it in $ik variable"
8
27
 
9
28
  require "pry"
10
29
  Pry.start
data/identikey.gemspec CHANGED
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'byebug'
33
33
  spec.add_development_dependency 'simplecov'
34
34
  spec.add_development_dependency 'dotenv'
35
+ spec.add_development_dependency 'guard-rspec'
35
36
  end
@@ -102,26 +102,20 @@ module Identikey
102
102
  })
103
103
 
104
104
  if stat != 'STAT_SUCCESS'
105
- raise Identikey::OperationFailed, "Save user failed: #{stat} - #{error}"
105
+ raise Identikey::OperationFailed, "Save user #{self.username} failed: #{stat} - #{error}"
106
106
  end
107
107
 
108
108
  replace(user, persisted: true)
109
109
  end
110
110
 
111
111
  def destroy!
112
- unless self.persisted?
113
- raise Identikey::UsageError, "User #{self.username} is not persisted"
114
- end
115
-
116
- unless self.username && self.domain
117
- raise Identikey::UsageError, "User #{self} is missing username and/or domain"
118
- end
112
+ ensure_persisted!
119
113
 
120
114
  stat, _, error = @session.execute(
121
115
  :user_execute_DELETE, username: username, domain: domain)
122
116
 
123
117
  if stat != 'STAT_SUCCESS'
124
- raise Identikey::OperationFailed, "Delete user failed: #{stat} - #{error}"
118
+ raise Identikey::OperationFailed, "Delete user #{self.username} failed: #{stat} - #{error}"
125
119
  end
126
120
 
127
121
  @persisted = false
@@ -129,6 +123,32 @@ module Identikey
129
123
  self
130
124
  end
131
125
 
126
+ def clear_password!
127
+ ensure_persisted!
128
+
129
+ stat, _, error = @session.execute(
130
+ :user_execute_RESET_PASSWORD, username: username, domain: domain)
131
+
132
+ if stat != 'STAT_SUCCESS'
133
+ raise Identikey::OperationFailed, "Clear user #{self.username} password failed: #{stat} - #{error}"
134
+ end
135
+
136
+ true
137
+ end
138
+
139
+ def set_password!(password)
140
+ ensure_persisted!
141
+
142
+ stat, _, error = @session.execute(
143
+ :user_execute_SET_PASSWORD, username: username, domain: domain, password: password)
144
+
145
+ if stat != 'STAT_SUCCESS'
146
+ raise Identikey::OperationFailed, "Set user #{self.username} password failed: #{stat} - #{error}"
147
+ end
148
+
149
+ true
150
+ end
151
+
132
152
  protected
133
153
  def replace(user, persisted: false)
134
154
  self.username = user['USERFLD_USERID']
@@ -156,6 +176,16 @@ module Identikey
156
176
 
157
177
  self
158
178
  end
179
+
180
+ def ensure_persisted!
181
+ unless self.persisted?
182
+ raise Identikey::UsageError, "User #{self.username} is not persisted"
183
+ end
184
+
185
+ unless self.username && self.domain
186
+ raise Identikey::UsageError, "User #{self} is missing username and/or domain"
187
+ end
188
+ end
159
189
  end
160
190
 
161
191
  end
@@ -145,6 +145,30 @@ module Identikey
145
145
  )
146
146
  end
147
147
 
148
+ def user_execute_RESET_PASSWORD(session_id:, username:, domain:)
149
+ user_execute(
150
+ session_id: session_id,
151
+ cmd: 'USERCMD_RESET_PASSWORD',
152
+ attributes: typed_attributes_list_from(
153
+ USERFLD_USERID: username,
154
+ USERFLD_DOMAIN: domain
155
+ )
156
+ )
157
+ end
158
+
159
+ def user_execute_SET_PASSWORD(session_id:, username:, domain:, password:)
160
+ user_execute(
161
+ session_id: session_id,
162
+ cmd: 'USERCMD_SET_PASSWORD',
163
+ attributes: typed_attributes_list_from(
164
+ USERFLD_USERID: username,
165
+ USERFLD_DOMAIN: domain,
166
+ USERFLD_NEW_PASSWORD: password,
167
+ USERFLD_CONFIRM_NEW_PASSWORD: password
168
+ )
169
+ )
170
+ end
171
+
148
172
 
149
173
  # Executes a userQuery command that searches users. By default, it doesn't
150
174
  # log anywhere. To enable logging to a specific destination, pass a logger
@@ -1,3 +1,3 @@
1
1
  module Identikey
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.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.5.2
4
+ version: 0.5.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-12-11 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: This gem contains a SOAP client to consume Identikey API
140
154
  email:
141
155
  - vjt@openssl.it
@@ -146,6 +160,7 @@ files:
146
160
  - ".gitignore"
147
161
  - ".rspec"
148
162
  - Gemfile
163
+ - Guardfile
149
164
  - LICENSE.txt
150
165
  - README.md
151
166
  - Rakefile