passwordstate 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8339c30925359da2d1fb10918796945cb5bdc4ad56beff7e99af39781bdfae96
4
- data.tar.gz: 6d9c0c54ce250813c874fa7007c63e8378c9c20ac4a6b9df887b6fe74b5939b9
3
+ metadata.gz: 16f9541b2823f0afcc423ea6a1dc815fa325d03b8634ad176e3ee0761cd0989d
4
+ data.tar.gz: 66cc0353de3b5c7f773dc59b027abec898ba2bb41cd19175ccefa47238f0a644
5
5
  SHA512:
6
- metadata.gz: 7cbe2c67683aa901f0d4b3fc4c9991115c59f93ecef0b1b8436e78c0f752abcf71c60a2f8151df7714e0d872d9620402a2fc1273d30875f70648916f8f5459ab
7
- data.tar.gz: 5feb809a4426576eb901a18c137f0d70337a692ef7cfdc633122ca1d0042d7b59f1727841f8b32ff68186ff0cc93cf4fa895de21622b250d5d9c92341d44a709
6
+ metadata.gz: 8748e111737f2a536cbaf9f80c03687dbe2aed6fc5fa418f4bebe8b657bafdd40dc7c621c77506362697d8db258f0b34372e7e1945a44c3614f0636d220d3afb
7
+ data.tar.gz: 2a76e68492d073eefad2604663bedc690a6e9a0fe496a8a95864739925f3e11defde2bba6c57476244b0b320dc2490c235b5fb1699d2db0d5bc98b4e458e8d1e
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  AllCops:
3
- TargetRubyVersion: 2.7
3
+ TargetRubyVersion: 3.0
4
4
  Exclude:
5
5
  - '*.spec'
6
6
  - 'Rakefile'
@@ -11,7 +11,7 @@ AllCops:
11
11
  Style/Documentation:
12
12
  Enabled: false
13
13
 
14
- Style/FrozenStringLiteralComment:
14
+ Style/DirectiveScope:
15
15
  Enabled: false
16
16
 
17
17
  Style/MultilineBlockChain:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.2.0 2026-11-23
2
+
3
+ - Update against Passwordstate 10.0+ API docs
4
+ - Remove no longer possible multi-version support, now always assumes latest version
5
+ - Remove old Ruby 2.X references
6
+
1
7
  ## v0.1.2 2025-08-26
2
8
 
3
9
  - Improved performance when working with large lists
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'pp' # rubocop:disable Lint/RedundantRequireStatement - required for pretty_print_inspect
4
+ require 'pp'
5
5
 
6
6
  module Passwordstate
7
7
  class Client
8
- USER_AGENT = "RubyPasswordstate/#{Passwordstate::VERSION}"
8
+ USER_AGENT = "RubyPasswordstate/#{Passwordstate::VERSION}".freeze
9
9
  DEFAULT_HEADERS = {
10
10
  'accept' => 'application/json',
11
11
  'user-agent' => USER_AGENT
@@ -19,7 +19,7 @@ module Passwordstate
19
19
  @server_url = URI(url)
20
20
  @validate_certificate = true
21
21
  @headers = DEFAULT_HEADERS
22
- @auth_data = options.select { |k, _v| %i[apikey username password].include? k }
22
+ @auth_data = options.slice(:apikey, :user_id, :username, :password)
23
23
  @api_type = options.fetch(:api_type) if options.key? :api_type
24
24
  @open_timeout = options.fetch(:open_timeout, 5)
25
25
  @timeout = options.fetch(:timeout, 15)
@@ -30,7 +30,12 @@ module Passwordstate
30
30
  end
31
31
 
32
32
  def api_type
33
- @api_type || (auth_data.key?(:apikey) ? :api : :winapi)
33
+ @api_type || begin
34
+ api_type ||= :userapi if auth_data.key?(:apikey) && auth_data.key?(:user_id)
35
+ api_type ||= :api if auth_data.key?(:apikey)
36
+ api_type ||= :winapi
37
+ api_type
38
+ end
34
39
  end
35
40
 
36
41
  def open_timeout=(sec)
@@ -78,32 +83,19 @@ module Passwordstate
78
83
  false
79
84
  end
80
85
 
86
+ ## Stub methods
87
+ #
88
+ # Passwordstate no longer provides any API compatibility information
81
89
  def version
82
- @version ||= begin
83
- html = request(:get, '', allow_html: true)
84
- version = html.find_line { |line| line.include? '<span>V</span>' }
85
- version = />(\d\.\d) \(Build (.+)\)</.match(version)
86
- "#{version[1]}.#{version[2]}" if version
87
- end
90
+ nil
88
91
  end
89
92
 
90
- def version?(compare)
91
- if version.nil?
92
- logger.debug 'Unable to detect Passwordstate version, assuming recent enough.'
93
- return true
94
- end
95
-
96
- Gem::Dependency.new(to_s, compare).match?(to_s, version)
93
+ def version?(_compare)
94
+ true
97
95
  end
98
96
 
99
- def require_version(compare)
100
- if version.nil?
101
- logger.debug 'Unable to detect Passwordstate version, assuming recent enough.'
102
- return true
103
- end
104
-
105
- raise "Your version of Passwordstate (#{version}) doesn't support the requested feature" unless version? compare
106
- end
97
+ def require_version(compare); end
98
+ ## End stub methods
107
99
 
108
100
  def request(method, api_path, query: nil, reason: nil, **options)
109
101
  uri = URI(server_url + "/#{api_type}/" + api_path)
@@ -13,9 +13,7 @@ module Passwordstate
13
13
  @request = request
14
14
  @response = response
15
15
 
16
- if errors.count == 1 && errors.first.is_a?(Hash) && errors.first.key?('errors')
17
- errors = errors.first['errors']
18
- end
16
+ errors = errors.first['errors'] if errors.one? && errors.first.is_a?(Hash) && errors.first.key?('errors')
19
17
  @errors = errors
20
18
 
21
19
  errorstr = errors.map { |err| err['message'] || err['phrase'] || err['error'] }.join('; ')
@@ -3,7 +3,7 @@
3
3
  module Passwordstate
4
4
  # A simple resource DSL helper
5
5
  #
6
- # rubocop:disable Metrics/ClassLength This DSL class will be large
6
+ # rubocop:disable Metrics/ClassLength -- This DSL class will be large
7
7
  class Resource
8
8
  attr_reader :client
9
9
 
@@ -166,7 +166,7 @@ module Passwordstate
166
166
  @modified ||= {}
167
167
  end
168
168
 
169
- def set!(data, reset_modified = true)
169
+ def set!(data, reset_modified: true)
170
170
  @modified = {} if reset_modified
171
171
  data = data.attributes if data.is_a? Passwordstate::Resource
172
172
  data.each do |key, value|
@@ -214,7 +214,7 @@ module Passwordstate
214
214
  def acceptable_methods(*meths)
215
215
  if meths.empty?
216
216
  @acceptable_methods || %i[post get put delete]
217
- elsif meths.count == 1 && meths.to_s.upcase == meths.to_s
217
+ elsif meths.one? && meths.to_s.upcase == meths.to_s
218
218
  @acceptable_methods = []
219
219
  meths = meths.first.to_s
220
220
  @acceptable_methods << :post if meths.include? 'C'
@@ -269,6 +269,7 @@ module Passwordstate
269
269
  if field.is_a? Symbol
270
270
  accessor_field_names << field
271
271
  attr_reader field
272
+
272
273
  build_writer_method field
273
274
  else
274
275
  field_options[accessor_field_names.last] = field
@@ -87,7 +87,7 @@ module Passwordstate
87
87
  api_path = options.fetch(:search_path, resource.api_path)
88
88
  query = options.fetch(:search_query, {}).merge(query)
89
89
 
90
- resource.search(client, **query.merge(_api_path: api_path))
90
+ resource.search(client, **query, _api_path: api_path)
91
91
  end
92
92
 
93
93
  def all(**query)
@@ -96,7 +96,7 @@ module Passwordstate
96
96
  api_path = options.fetch(:all_path, resource.api_path)
97
97
  query = options.fetch(:all_query, {}).merge(query)
98
98
 
99
- load resource.all(client, **query.merge(_api_path: api_path))
99
+ load resource.all(client, **query, _api_path: api_path)
100
100
  end
101
101
 
102
102
  def get(id, **query)
@@ -112,7 +112,7 @@ module Passwordstate
112
112
  api_path = options.fetch(:get_path, resource.api_path)
113
113
  query = options.fetch(:get_query, {}).merge(query)
114
114
 
115
- resource.get(client, id, **query.merge(_api_path: api_path))
115
+ resource.get(client, id, **query, _api_path: api_path)
116
116
  end
117
117
 
118
118
  def post(data, **query)
@@ -121,7 +121,7 @@ module Passwordstate
121
121
  api_path = options.fetch(:post_path, resource.api_path)
122
122
  query = options.fetch(:post_query, {}).merge(query)
123
123
 
124
- resource.post(client, data, **query.merge(_api_path: api_path))
124
+ resource.post(client, data, **query, _api_path: api_path)
125
125
  end
126
126
 
127
127
  def put(data, **query)
@@ -130,7 +130,7 @@ module Passwordstate
130
130
  api_path = options.fetch(:put_path, resource.api_path)
131
131
  query = options.fetch(:put_query, {}).merge(query)
132
132
 
133
- resource.put(client, data, **query.merge(_api_path: api_path))
133
+ resource.put(client, data, **query, _api_path: api_path)
134
134
  end
135
135
 
136
136
  def delete(id, **query)
@@ -139,7 +139,7 @@ module Passwordstate
139
139
  api_path = options.fetch(:delete_path, resource.api_path)
140
140
  query = options.fetch(:delete_query, {}).merge(query)
141
141
 
142
- resource.delete(client, id, **query.merge(_api_path: api_path))
142
+ resource.delete(client, id, **query, _api_path: api_path)
143
143
  end
144
144
 
145
145
  private
@@ -17,7 +17,8 @@ module Passwordstate
17
17
  :protocol,
18
18
  :domain_controller_fqdn, { name: 'DomainControllerFQDN' }
19
19
 
20
- read_fields :ad_domain_id, { name: 'ADDomainID' }
20
+ read_fields :ad_domain_id, { name: 'ADDomainID' },
21
+ :site_location
21
22
  end
22
23
  end
23
24
  end
@@ -7,8 +7,20 @@ module Passwordstate
7
7
 
8
8
  index_field :document_id
9
9
 
10
+ accessor_fields :document_name,
11
+ :document_description
12
+
10
13
  read_fields :document_id, { name: 'DocumentID' },
11
- :document_name
14
+ :modified, { is: Time },
15
+ :modified_by,
16
+ :file_size,
17
+ :folder_id, { name: 'FolderID' },
18
+ :folder_name,
19
+ :password_list_id, { name: 'PasswordListID' },
20
+ :password_list,
21
+ :tree_path,
22
+ :password_id, { name: 'PasswordID' },
23
+ :title
12
24
 
13
25
  alias title document_name
14
26
 
@@ -27,7 +27,6 @@ module Passwordstate
27
27
  end
28
28
 
29
29
  def permissions
30
- client.require_version('>= 8.4.8449')
31
30
  FolderPermission.new(_client: client, folder_id: folder_id)
32
31
  end
33
32
 
@@ -43,6 +42,11 @@ module Passwordstate
43
42
 
44
43
  index_field :folder_id
45
44
 
45
+ accessor_fields :permission,
46
+ :apply_permissions_for_user_id, { name: 'ApplyPermissionsForUserID' },
47
+ :apply_permissions_for_security_group_id, { name: 'ApplyPermissionsForSecurityGroupID' },
48
+ :apply_permissions_for_security_group_name
49
+
46
50
  read_fields :folder_id, { name: 'FolderID' }
47
51
  end
48
52
  end
@@ -25,6 +25,7 @@ module Passwordstate
25
25
  :internal_ip, { name: 'InternalIP', is: IPAddr },
26
26
  :external_ip, { name: 'ExternalIP', is: IPAddr },
27
27
  :mac_address, { name: 'MACAddress' },
28
+ :session_recording,
28
29
  :virtual_machine,
29
30
  :virtual_machine_type,
30
31
  :notes
@@ -26,19 +26,21 @@ module Passwordstate
26
26
  :generic_field_info,
27
27
  :account_type_id, { name: 'AccountTypeID' },
28
28
  :notes,
29
- :url,
29
+ :url, { name: 'URL' },
30
30
  :password, { redact: true },
31
31
  :expiry_date, { is: Time },
32
32
  :allow_export,
33
33
  :web_user_id, { name: 'WebUser_ID' },
34
34
  :web_password_id, { name: 'WebPassword_ID' },
35
+ :web_otp_id, { name: 'WebOTP_ID' },
35
36
  :password_list_id, { name: 'PasswordListID' } # NB: POST only
36
37
  # rubocop:enable Naming/VariableNumber
37
38
 
38
39
  read_fields :account_type,
39
40
  :password_id, { name: 'PasswordID' },
40
41
  :password_list,
41
- :otp,
42
+ :otp, { name: 'OTP', redact: true },
43
+ :otp_uri, { name: 'OTPUri', redact: true },
42
44
  # For 'Managed' passwords
43
45
  :status,
44
46
  :current_password,
@@ -61,7 +63,7 @@ module Passwordstate
61
63
  :validate_with_priv_account
62
64
 
63
65
  def otp!
64
- client.request(:get, "onetimepassword/#{password_id}").first['OTP']
66
+ [client.request(:get, "onetimepassword/#{password_id}")].flatten.first['OTP']
65
67
  end
66
68
 
67
69
  def check_in
@@ -97,7 +99,6 @@ module Passwordstate
97
99
  end
98
100
 
99
101
  def permissions
100
- client.require_version('>= 8.4.8449')
101
102
  PasswordPermission.new(_client: client, password_id: password_id)
102
103
  end
103
104
 
@@ -113,17 +114,17 @@ module Passwordstate
113
114
 
114
115
  def self.all(client, **query)
115
116
  query = { query_all: true }.merge(query)
116
- super(client, **query)
117
+ super
117
118
  end
118
119
 
119
120
  def self.search(client, **query)
120
121
  query = { _api_path: 'searchpasswords' }.merge(query)
121
- super(client, **query)
122
+ super
122
123
  end
123
124
 
124
125
  def self.generate(client, **options)
125
126
  results = client.request(:get, 'generatepassword', query: options).map { |r| r['Password'] }
126
- return results.first if results.count == 1
127
+ return results.first if results.one?
127
128
 
128
129
  results
129
130
  end
@@ -28,6 +28,8 @@ module Passwordstate
28
28
  :private_password_list,
29
29
  :time_based_access_required,
30
30
  :handshake_approval_required,
31
+ :no_approvers,
32
+ :disable_notifications,
31
33
  :password_strength_policy_id, { name: 'PasswordStrengthPolicyID' },
32
34
  :password_generator_id, { name: 'PasswordGeneratorID' },
33
35
  :code_page,
@@ -35,6 +37,7 @@ module Passwordstate
35
37
  :authentication_type,
36
38
  :authentication_per_session,
37
39
  :prevent_expiry_date_modification,
40
+ :set_expiry_date,
38
41
  :reset_expiry_date,
39
42
  :prevent_drag_drop,
40
43
  :prevent_bad_password_use,
@@ -83,7 +86,6 @@ module Passwordstate
83
86
  end
84
87
 
85
88
  def permissions
86
- client.require_version('>= 8.4.8449')
87
89
  PasswordListPermission.new(_client: client, password_list_id: password_list_id)
88
90
  end
89
91
 
@@ -18,7 +18,8 @@ module Passwordstate
18
18
  :account_type,
19
19
  :enable_password
20
20
 
21
- read_fields :privileged_account_id
21
+ read_fields :privileged_account_id,
22
+ :site_location
22
23
  end
23
24
 
24
25
  class PrivilegedAccountPermission < Permission
@@ -4,6 +4,7 @@ module Passwordstate
4
4
  module Resources
5
5
  class Report < Passwordstate::Resource
6
6
  REPORT_PARAMETERS = {
7
+ # User reports
7
8
  1 => %i[user_id],
8
9
  2 => %i[user_id site_id],
9
10
  3 => %i[user_id duration],
@@ -15,6 +16,8 @@ module Passwordstate
15
16
  9 => %i[],
16
17
  10 => %i[duration],
17
18
  11 => %i[duration],
19
+ 41 => %i[site_id],
20
+ # Passwords
18
21
  12 => %i[site_id],
19
22
  13 => %i[site_id],
20
23
  14 => %i[site_i],
@@ -25,19 +28,37 @@ module Passwordstate
25
28
  19 => %i[site_id],
26
29
  20 => %i[site_id],
27
30
  21 => %i[site_id],
31
+ 36 => %i[site_id],
28
32
  22 => %i[site_id],
33
+ 35 => %i[],
34
+ # Permissions
29
35
  23 => %i[site_id],
30
36
  24 => %i[site_id user_id],
31
37
  25 => %i[site_id security_group_name],
32
38
  26 => %i[duration],
39
+ 43 => %i[site_id],
40
+ 44 => %i[site_id],
33
41
  27 => %i[duration],
34
42
  28 => %i[duration],
43
+ 37 => %i[site_id],
44
+ 38 => %i[site_id],
45
+ # Activity
35
46
  29 => %i[duration],
36
47
  30 => %i[duration],
37
48
  31 => %i[duration],
38
49
  32 => %i[duration],
39
50
  33 => %i[duration],
40
- 34 => %i[duration]
51
+ 34 => %i[duration],
52
+ # Document Reports
53
+ 45 => %i[site_id],
54
+ 46 => %i[site_id],
55
+ 47 => %i[site_id],
56
+ 48 => %i[site_id],
57
+ 49 => %i[site_id],
58
+ # Misc Reports
59
+ 39 => %i[site_id],
60
+ 40 => %i[site_id],
61
+ 42 => %i[site_id]
41
62
  }.freeze
42
63
 
43
64
  api_path 'reporting'
@@ -3,6 +3,8 @@
3
3
  require 'net/http'
4
4
  require 'net/ntlm'
5
5
 
6
+ # rubocop:disable Style/OneClassPerFile
7
+
6
8
  module Net
7
9
  # NTLM header extension
8
10
  #
@@ -63,7 +65,7 @@ module Passwordstate
63
65
  # }
64
66
  module NetHTTPExtensions
65
67
  def request(req, body = nil, &block)
66
- return super(req, body, &block) if req.ntlm_auth_information.nil?
68
+ return super if req.ntlm_auth_information.nil?
67
69
 
68
70
  unless started?
69
71
  @last_body = req.body
@@ -88,7 +90,7 @@ module Passwordstate
88
90
  req.body_stream.rewind if req.body_stream
89
91
  req.body = @last_body if @last_body
90
92
 
91
- super(req, body, &block)
93
+ super
92
94
  else
93
95
  yield res if block_given?
94
96
  res
@@ -98,3 +100,4 @@ module Passwordstate
98
100
  end
99
101
 
100
102
  Net::HTTP.prepend Passwordstate::NetHTTPExtensions unless Net::HTTP.ancestors.include? Passwordstate::NetHTTPExtensions
103
+ # rubocop:enable Style/OneClassPerFile
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Passwordstate
4
- VERSION = '0.1.2'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'https://github.com/ananace/ruby-passwordstate'
14
14
  spec.license = 'MIT'
15
15
 
16
- spec.required_ruby_version = '>= 2.7'
16
+ spec.required_ruby_version = '>= 3.0'
17
17
  spec.metadata['rubygems_mfa_required'] = 'true'
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0")
@@ -0,0 +1,41 @@
1
+ {
2
+ "PasswordID": 3,
3
+ "Title": "borgdrone-4673615 @ Unimatrix Zero",
4
+ "Domain": "",
5
+ "HostName": "",
6
+ "UserName": "borgdrone-4673615",
7
+ "Description": "",
8
+ "GenericField1": "",
9
+ "GenericField2": "",
10
+ "GenericField3": "",
11
+ "GenericField4": "",
12
+ "GenericField5": "",
13
+ "GenericField6": "",
14
+ "GenericField7": "",
15
+ "GenericField8": "",
16
+ "GenericField9": "",
17
+ "GenericField10": "",
18
+ "GenericFieldInfo": [],
19
+ "AccountTypeID": 0,
20
+ "Notes": "",
21
+ "URL": "",
22
+ "Password": "shrine-jsb4D",
23
+ "ExpiryDate": "",
24
+ "AllowExport": true,
25
+ "AccountType": "",
26
+ "OTP": "",
27
+ "OTPUri": null,
28
+ "WebUser_ID": "",
29
+ "WebPassword_ID": "",
30
+ "WebOTP_ID": "",
31
+ "WebGenericField1_ID": "",
32
+ "WebGenericField2_ID": "",
33
+ "WebGenericField3_ID": "",
34
+ "WebGenericField4_ID": "",
35
+ "WebGenericField5_ID": "",
36
+ "WebGenericField6_ID": "",
37
+ "WebGenericField7_ID": "",
38
+ "WebGenericField8_ID": "",
39
+ "WebGenericField9_ID": "",
40
+ "WebGenericField10_ID": ""
41
+ }
@@ -1,13 +1,11 @@
1
1
  [
2
2
  {
3
- "PasswordListID": "100",
4
- "PasswordList": "Managed Passwords",
5
- "PasswordID": 18075,
3
+ "PasswordID": 3,
6
4
  "Title": "borgdrone-4673615 @ Unimatrix Zero",
7
5
  "Domain": "",
8
6
  "HostName": "",
9
7
  "UserName": "borgdrone-4673615",
10
- "Description": "Unimatrix Zero access key for borgdrone-4673615",
8
+ "Description": "",
11
9
  "GenericField1": "",
12
10
  "GenericField2": "",
13
11
  "GenericField3": "",
@@ -22,10 +20,24 @@
22
20
  "AccountTypeID": 0,
23
21
  "Notes": "",
24
22
  "URL": "",
25
- "Password": "weishe4uChee0woh4ahquineibahpheiquaiy2yuRohjohChee6eet6rahbaiceetucoothooph8ooKahwoh5Teepah3ieLohwahkeigh4eefeivoohee8quee5oohoe",
23
+ "Password": "shrine-jsb4D",
26
24
  "ExpiryDate": "",
27
25
  "AllowExport": true,
28
26
  "AccountType": "",
29
- "OTP": null
27
+ "OTP": "",
28
+ "OTPUri": null,
29
+ "WebUser_ID": "",
30
+ "WebPassword_ID": "",
31
+ "WebOTP_ID": "",
32
+ "WebGenericField1_ID": "",
33
+ "WebGenericField2_ID": "",
34
+ "WebGenericField3_ID": "",
35
+ "WebGenericField4_ID": "",
36
+ "WebGenericField5_ID": "",
37
+ "WebGenericField6_ID": "",
38
+ "WebGenericField7_ID": "",
39
+ "WebGenericField8_ID": "",
40
+ "WebGenericField9_ID": "",
41
+ "WebGenericField10_ID": ""
30
42
  }
31
43
  ]
@@ -1,11 +1,11 @@
1
1
  [
2
2
  {
3
- "PasswordListID": 100,
4
- "PasswordList": "Managed Passwords",
5
- "Description": "Someone's managed passwords",
6
- "ImageFileName": "system.png",
3
+ "PasswordListID": 7,
4
+ "PasswordList": "Unimatrix",
5
+ "Description": "",
6
+ "ImageFileName": "protect.png",
7
7
  "Guide": "",
8
- "AllowExport": false,
8
+ "AllowExport": true,
9
9
  "PrivatePasswordList": false,
10
10
  "NoApprovers": "1",
11
11
  "DisableNotifications": false,
@@ -13,19 +13,19 @@
13
13
  "PasswordStrengthPolicyID": 1,
14
14
  "PasswordGeneratorID": 1,
15
15
  "CodePage": "Using Passwordstate Default Code Page",
16
- "PreventPasswordReuse": 0,
17
- "AuthenticationType": "Use RADIUS Authentication",
16
+ "PreventPasswordReuse": 5,
17
+ "AuthenticationType": "None Required",
18
18
  "AuthenticationPerSession": false,
19
- "PreventExpiryDateModification": true,
19
+ "PreventExpiryDateModification": false,
20
20
  "SetExpiryDate": 0,
21
21
  "ResetExpiryDate": 0,
22
22
  "PreventDragDrop": true,
23
- "PreventBadPasswordUse": false,
24
- "ProvideAccessReason": true,
25
- "TreePath": "\\Shared\\Somewhere\\Managed Passwords",
26
- "TotalPasswords": 656,
27
- "GeneratorName": "Corporate Password Generator",
28
- "PolicyName": "Corporate Password Strength Policy",
23
+ "PreventBlacklistedPasswordUse": true,
24
+ "ProvideAccessReason": false,
25
+ "TreePath": "\\Collective\\Control\\Unimatrix",
26
+ "TotalPasswords": 2,
27
+ "GeneratorName": "Default Password Generator",
28
+ "PolicyName": "Default Policy",
29
29
  "PasswordResetEnabled": false,
30
30
  "ForcePasswordGenerator": false,
31
31
  "HidePasswords": "False:True:False",
@@ -37,6 +37,6 @@
37
37
  "SiteID": 0,
38
38
  "SiteLocation": "Internal",
39
39
  "OneTimePasswords": false,
40
- "DisableInheritance": true
40
+ "DisableInheritance": false
41
41
  }
42
42
  ]
@@ -1,5 +1,3 @@
1
- [
2
- {
3
- "OTP": "123456"
4
- }
5
- ]
1
+ {
2
+ "OTP": "123456"
3
+ }
@@ -1,13 +1,13 @@
1
1
  [
2
2
  {
3
- "PasswordListID": "100",
4
- "PasswordList": "Managed Passwords",
5
- "PasswordID": 18075,
6
- "Title": "borgdrone-4673615 @ Unimatrix Zero",
3
+ "PasswordListID": "7",
4
+ "PasswordList": "Unimatrix",
5
+ "PasswordID": 2,
6
+ "Title": "dronecontrol",
7
7
  "Domain": "",
8
8
  "HostName": "",
9
- "UserName": "borgdrone-4673615",
10
- "Description": "Unimatrix Zero access key for borgdrone-4673615",
9
+ "UserName": "admin",
10
+ "Description": "Borg Drone admin",
11
11
  "GenericField1": "",
12
12
  "GenericField2": "",
13
13
  "GenericField3": "",
@@ -22,21 +22,35 @@
22
22
  "AccountTypeID": 0,
23
23
  "Notes": "",
24
24
  "URL": "",
25
- "Password": "weishe4uChee0woh4ahquineibahpheiquaiy2yuRohjohChee6eet6rahbaiceetucoothooph8ooKahwoh5Teepah3ieLohwahkeigh4eefeivoohee8quee5oohoe",
25
+ "Password": "ebai6uoLie2coht3uzuwaRieD9ieroon7chie2choexoiThoofaing0xuosh3aez",
26
26
  "ExpiryDate": "",
27
27
  "AllowExport": true,
28
28
  "AccountType": "",
29
- "OTP": null
29
+ "OTP": null,
30
+ "OTPUri": null,
31
+ "WebUser_ID": null,
32
+ "WebPassword_ID": null,
33
+ "WebOTP_ID": null,
34
+ "WebGenericField1_ID": null,
35
+ "WebGenericField2_ID": null,
36
+ "WebGenericField3_ID": null,
37
+ "WebGenericField4_ID": null,
38
+ "WebGenericField5_ID": null,
39
+ "WebGenericField6_ID": null,
40
+ "WebGenericField7_ID": null,
41
+ "WebGenericField8_ID": null,
42
+ "WebGenericField9_ID": null,
43
+ "WebGenericField10_ID": null
30
44
  },
31
45
  {
32
- "PasswordListID": "100",
33
- "PasswordList": "Managed Passwords",
34
- "PasswordID": 29467,
35
- "Title": "borgdrone-9342756 @ Unimatrix Zero",
46
+ "PasswordListID": "7",
47
+ "PasswordList": "Unimatrix",
48
+ "PasswordID": 1,
49
+ "Title": "hivemind - unimatrix01",
36
50
  "Domain": "",
37
51
  "HostName": "",
38
- "UserName": "borgdrone-9342756",
39
- "Description": "Unimatrix Zero access key for borgdrone-9342756",
52
+ "UserName": "unimatrix01",
53
+ "Description": "Borg Hivemind admin @ unimatrix01",
40
54
  "GenericField1": "",
41
55
  "GenericField2": "",
42
56
  "GenericField3": "",
@@ -51,10 +65,24 @@
51
65
  "AccountTypeID": 0,
52
66
  "Notes": "",
53
67
  "URL": "",
54
- "Password": "chaihohd6aemeitivaefei0zahjee0IN7aevaisoGohrae5ileeHaquaik7lo1aicoo3lohchae2nujohRu2oofiizieth6aezahng8ohp9siesaemahKaifah8Ooyoo",
68
+ "Password": "ou3chaengieY1rai7oesee2thi1ohb4the5eidux8ETaeteish6diiJ9UWi6AeQu",
55
69
  "ExpiryDate": "",
56
70
  "AllowExport": true,
57
71
  "AccountType": "",
58
- "OTP": null
72
+ "OTP": null,
73
+ "OTPUri": null,
74
+ "WebUser_ID": null,
75
+ "WebPassword_ID": null,
76
+ "WebOTP_ID": null,
77
+ "WebGenericField1_ID": null,
78
+ "WebGenericField2_ID": null,
79
+ "WebGenericField3_ID": null,
80
+ "WebGenericField4_ID": null,
81
+ "WebGenericField5_ID": null,
82
+ "WebGenericField6_ID": null,
83
+ "WebGenericField7_ID": null,
84
+ "WebGenericField8_ID": null,
85
+ "WebGenericField9_ID": null,
86
+ "WebGenericField10_ID": null
59
87
  }
60
88
  ]
@@ -1,13 +1,11 @@
1
1
  [
2
2
  {
3
- "PasswordListID": "100",
4
- "PasswordList": "Managed Passwords",
5
- "PasswordID": 18075,
3
+ "PasswordID": 3,
6
4
  "Title": "borgdrone-4673615 @ Unimatrix Zero",
7
- "Domain": "1c0389a1-6e63-4276-8500-1e595f0288e9.cube.collective",
8
- "HostName": "",
5
+ "Domain": null,
6
+ "HostName": null,
9
7
  "UserName": "borgdrone-4673615",
10
- "Description": "Unimatrix Zero access key for borgdrone-4673615",
8
+ "Description": "",
11
9
  "GenericField1": "",
12
10
  "GenericField2": "",
13
11
  "GenericField3": "",
@@ -21,11 +19,25 @@
21
19
  "GenericFieldInfo": [],
22
20
  "AccountTypeID": 0,
23
21
  "Notes": "",
24
- "URL": "",
25
- "Password": "weishe4uChee0woh4ahquineibahpheiquaiy2yuRohjohChee6eet6rahbaiceetucoothooph8ooKahwoh5Teepah3ieLohwahkeigh4eefeivoohee8quee5oohoe",
22
+ "URL": "https://1c0389a1-6e63-4276-8500-1e595f0288e9.cube.collective",
23
+ "Password": "shrine-jsb4D",
26
24
  "ExpiryDate": "",
27
25
  "AllowExport": true,
28
- "AccountType": "",
29
- "OTP": null
26
+ "AccountType": null,
27
+ "OTP": "",
28
+ "OTPUri": null,
29
+ "WebUser_ID": "",
30
+ "WebPassword_ID": "",
31
+ "WebOTP_ID": "",
32
+ "WebGenericField1_ID": "",
33
+ "WebGenericField2_ID": "",
34
+ "WebGenericField3_ID": "",
35
+ "WebGenericField4_ID": "",
36
+ "WebGenericField5_ID": "",
37
+ "WebGenericField6_ID": "",
38
+ "WebGenericField7_ID": "",
39
+ "WebGenericField8_ID": "",
40
+ "WebGenericField9_ID": "",
41
+ "WebGenericField10_ID": ""
30
42
  }
31
43
  ]
@@ -8,10 +8,10 @@ class PasswordListTest < Minitest::Test
8
8
 
9
9
  @client = Passwordstate::Client.new 'http://passwordstate.example.com'
10
10
  @client.expects(:request)
11
- .with(:get, 'passwordlists/100', query: {}, reason: nil)
11
+ .with(:get, 'passwordlists/7', query: {}, reason: nil)
12
12
  .returns(JSON.parse(File.read('test/fixtures/get_password_list.json')))
13
13
 
14
- @list = @client.password_lists.get 100
14
+ @list = @client.password_lists.get 7
15
15
  end
16
16
 
17
17
  # CRUD tests
@@ -32,7 +32,7 @@ class PasswordListTest < Minitest::Test
32
32
 
33
33
  def test_read
34
34
  @client.expects(:request)
35
- .with(:get, 'passwordlists/100', query: {}, reason: nil)
35
+ .with(:get, 'passwordlists/7', query: {}, reason: nil)
36
36
  .returns(JSON.parse(File.read('test/fixtures/get_password_list.json')))
37
37
 
38
38
  @list.get
@@ -50,13 +50,13 @@ class PasswordListTest < Minitest::Test
50
50
  def test_parsed
51
51
  refute_nil @list.nil?
52
52
 
53
- assert_equal 100, @list.password_list_id
53
+ assert_equal 7, @list.password_list_id
54
54
 
55
55
  assert_equal false, @list.hide_passwords.view
56
56
  assert_equal true, @list.hide_passwords.modify
57
57
  assert_equal false, @list.hide_passwords.admin
58
58
 
59
- assert_equal '/Shared/Somewhere/Managed Passwords', @list.full_path(unix: true)
59
+ assert_equal '/Collective/Control/Unimatrix', @list.full_path(unix: true)
60
60
  end
61
61
 
62
62
  def test_search
@@ -69,13 +69,13 @@ class PasswordListTest < Minitest::Test
69
69
 
70
70
  def test_password_search
71
71
  @client.expects(:request)
72
- .with(:get, 'searchpasswords/100', query: { 'Description' => 'borg' }, reason: nil)
72
+ .with(:get, 'searchpasswords/7', query: { 'Description' => 'borg' }, reason: nil)
73
73
  .returns(JSON.parse(File.read('test/fixtures/password_list_search_passwords.json')))
74
74
 
75
75
  passwords = @list.passwords.search description: 'borg'
76
76
 
77
77
  assert_equal 2, passwords.count
78
- assert_equal 'borgdrone-4673615', passwords.first.user_name
79
- assert_equal 'borgdrone-9342756', passwords.last.user_name
78
+ assert_equal 'admin', passwords.first.user_name
79
+ assert_equal 'unimatrix01', passwords.last.user_name
80
80
  end
81
81
  end
@@ -7,11 +7,11 @@ class PasswordTest < Minitest::Test
7
7
  Net::HTTP.any_instance.expects(:start).never
8
8
 
9
9
  @client = Passwordstate::Client.new 'http://passwordstate.example.com'
10
- @client.expects(:request)
11
- .with(:get, 'passwords/18075', query: {}, reason: nil)
10
+ @client.stubs(:request)
11
+ .with(:get, 'passwords/3', query: {}, reason: nil)
12
12
  .returns(JSON.parse(File.read('test/fixtures/get_password.json')))
13
13
 
14
- @password = @client.passwords.get 18_075
14
+ @password = @client.passwords.get 3
15
15
  end
16
16
 
17
17
  # CRUD tests
@@ -19,14 +19,14 @@ class PasswordTest < Minitest::Test
19
19
  @client.expects(:request)
20
20
  .with(:post, 'passwords', query: {}, reason: nil, body:
21
21
  {
22
- 'PasswordListID' => 100,
22
+ 'PasswordListID' => 7,
23
23
  'Title' => 'borgdrone-4673615 @ Unimatrix Zero',
24
24
  'UserName' => 'borgdrone-4673615',
25
25
  'GeneratePassword' => true
26
26
  })
27
- .returns(JSON.parse(File.read('test/fixtures/get_password.json')))
27
+ .returns(JSON.parse(File.read('test/fixtures/create_password.json')))
28
28
 
29
- @client.passwords.create password_list_id: 100,
29
+ @client.passwords.create password_list_id: 7,
30
30
  title: 'borgdrone-4673615 @ Unimatrix Zero',
31
31
  user_name: 'borgdrone-4673615',
32
32
  generate_password: true
@@ -34,20 +34,20 @@ class PasswordTest < Minitest::Test
34
34
 
35
35
  def test_read
36
36
  @client.expects(:request)
37
- .with(:get, 'passwords/18075', query: {}, reason: nil)
37
+ .with(:get, 'passwords/3', query: {}, reason: nil)
38
38
  .returns(JSON.parse(File.read('test/fixtures/get_password.json')))
39
39
 
40
40
  @password.get
41
41
  end
42
42
 
43
43
  def test_update
44
- @password.domain = '1c0389a1-6e63-4276-8500-1e595f0288e9.cube.collective'
44
+ @password.url = 'https://1c0389a1-6e63-4276-8500-1e595f0288e9.cube.collective'
45
45
 
46
46
  @client.expects(:request)
47
47
  .with(:put, 'passwords', query: {}, reason: nil, body:
48
48
  {
49
- 'PasswordID' => 18_075,
50
- 'Domain' => @password.domain
49
+ 'PasswordID' => 3,
50
+ 'URL' => @password.url
51
51
  })
52
52
  .returns(JSON.parse(File.read('test/fixtures/update_password.json')))
53
53
 
@@ -58,7 +58,7 @@ class PasswordTest < Minitest::Test
58
58
  @client.expects(:request)
59
59
  .with(:put, 'passwords', query: {}, reason: nil, body:
60
60
  {
61
- 'PasswordID' => 18_075,
61
+ 'PasswordID' => 3,
62
62
  'Password' => '<redacted>'
63
63
  })
64
64
  .returns(JSON.parse(File.read('test/fixtures/update_password_managed.json')))
@@ -73,13 +73,13 @@ class PasswordTest < Minitest::Test
73
73
 
74
74
  def test_delete
75
75
  @client.expects(:request)
76
- .with(:delete, 'passwords/18075', query: { 'MoveToRecycleBin' => false }, reason: nil)
76
+ .with(:delete, 'passwords/3', query: { 'MoveToRecycleBin' => false }, reason: nil)
77
77
  .returns(true)
78
78
 
79
79
  @password.delete
80
80
 
81
81
  @client.expects(:request)
82
- .with(:get, 'passwords/18075', query: {}, reason: nil)
82
+ .with(:get, 'passwords/3', query: {}, reason: nil)
83
83
  .raises(Passwordstate::HTTPError.new_by_code(404, nil, nil))
84
84
 
85
85
  assert_raises(Passwordstate::NotFoundError) { @password.get }
@@ -88,7 +88,7 @@ class PasswordTest < Minitest::Test
88
88
  # Functionality test
89
89
  def test_otp
90
90
  @client.expects(:request)
91
- .with(:get, 'onetimepassword/18075')
91
+ .with(:get, 'onetimepassword/3')
92
92
  .returns(JSON.parse(File.read('test/fixtures/get_password_otp.json')))
93
93
 
94
94
  assert_nil @password.otp
@@ -97,7 +97,7 @@ class PasswordTest < Minitest::Test
97
97
 
98
98
  def test_check_in
99
99
  @client.expects(:request)
100
- .with(:get, 'passwords/18075', query: { 'CheckIn' => nil })
100
+ .with(:get, 'passwords/3', query: { 'CheckIn' => nil })
101
101
  .returns(true)
102
102
 
103
103
  @password.check_in
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passwordstate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Olofsson
@@ -157,6 +157,7 @@ files:
157
157
  - lib/passwordstate/version.rb
158
158
  - passwordstate.gemspec
159
159
  - test/client_test.rb
160
+ - test/fixtures/create_password.json
160
161
  - test/fixtures/get_password.json
161
162
  - test/fixtures/get_password_list.json
162
163
  - test/fixtures/get_password_otp.json
@@ -179,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
180
  requirements:
180
181
  - - ">="
181
182
  - !ruby/object:Gem::Version
182
- version: '2.7'
183
+ version: '3.0'
183
184
  required_rubygems_version: !ruby/object:Gem::Requirement
184
185
  requirements:
185
186
  - - ">="