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 +4 -4
- data/.gitignore +2 -0
- data/Guardfile +23 -0
- data/README.md +11 -5
- data/bin/console +21 -2
- data/identikey.gemspec +1 -0
- data/lib/identikey/administration/user.rb +39 -9
- data/lib/identikey/administration.rb +24 -0
- data/lib/identikey/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0048f4b07f0fbc24be2b831720ab1c7c69c6258a35991ba562bf61f83773a9b
|
4
|
+
data.tar.gz: 49e7727c5ee48b62558e673d7dc43b17a26f61ef0b3131e9b7a8f96a90ed0526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43286dad58a7fac8d978c5c1f403c3dc7007af49c8eafe509566a2da10f38774b7555b6c524d1cf401d1d55a8e2f4e4a6cf4fcc5a9c93cc2cc42637745341a09
|
7
|
+
data.tar.gz: 54396564a6e61eeebcd20656f72a3462412fd53212c4b88d34be3a0806913a71ea8778184ec3dabef47ba7001d21c46380136aaaa245583d49573775920c186c
|
data/.gitignore
CHANGED
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.
|
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
|
-
|
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.
|
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
|
-
|
7
|
-
|
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
@@ -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
|
-
|
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
|
data/lib/identikey/version.rb
CHANGED
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.
|
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
|
+
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
|