aspera-cli 4.28.0 → 4.29.1

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.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/BUGS.md +5 -10
  4. data/CHANGELOG.md +217 -2
  5. data/CODE_OF_CONDUCT.md +18 -0
  6. data/CONTRIBUTING.md +135 -56
  7. data/GOVERNANCE.md +30 -0
  8. data/LICENSE +201 -0
  9. data/README.md +122 -26
  10. data/SECURITY.md +84 -0
  11. data/bin/ascli +8 -5
  12. data/bin/asession +9 -6
  13. data/docs/README.md +1895 -632
  14. data/docs/test-mcp-with-ai.md +8 -8
  15. data/lib/aspera/agent/base.rb +23 -2
  16. data/lib/aspera/agent/connect.rb +16 -12
  17. data/lib/aspera/agent/desktop.rb +10 -7
  18. data/lib/aspera/agent/direct.rb +20 -19
  19. data/lib/aspera/agent/factory.rb +6 -3
  20. data/lib/aspera/agent/httpgw.rb +7 -5
  21. data/lib/aspera/agent/node.rb +15 -7
  22. data/lib/aspera/agent/transferd.rb +167 -43
  23. data/lib/aspera/api/alee.rb +4 -1
  24. data/lib/aspera/api/aoc.rb +14 -11
  25. data/lib/aspera/api/ats.rb +4 -2
  26. data/lib/aspera/api/cos_node.rb +7 -4
  27. data/lib/aspera/api/faspex.rb +16 -9
  28. data/lib/aspera/api/httpgw.rb +9 -6
  29. data/lib/aspera/api/node.rb +29 -22
  30. data/lib/aspera/ascmd.rb +8 -5
  31. data/lib/aspera/ascp/installation.rb +95 -67
  32. data/lib/aspera/ascp/log.schema.yaml +1084 -0
  33. data/lib/aspera/ascp/log_analyzer/advice.rb +97 -0
  34. data/lib/aspera/ascp/log_analyzer/diagnostics.rb +344 -0
  35. data/lib/aspera/ascp/log_analyzer/lines.rb +75 -0
  36. data/lib/aspera/ascp/log_analyzer/log_file.rb +593 -0
  37. data/lib/aspera/ascp/log_analyzer/records.rb +379 -0
  38. data/lib/aspera/ascp/log_analyzer/rules.rb +172 -0
  39. data/lib/aspera/ascp/log_analyzer/session.rb +782 -0
  40. data/lib/aspera/ascp/log_analyzer.rb +370 -0
  41. data/lib/aspera/ascp/log_locations.rb +163 -0
  42. data/lib/aspera/ascp/management.rb +16 -8
  43. data/lib/aspera/ascp/session_errors.rb +217 -0
  44. data/lib/aspera/assert.rb +4 -0
  45. data/lib/aspera/cli/ascp_actions.rb +12 -19
  46. data/lib/aspera/cli/ascp_logs_actions.rb +188 -0
  47. data/lib/aspera/cli/async_transfer_store.rb +7 -4
  48. data/lib/aspera/cli/bootstrapper.rb +38 -33
  49. data/lib/aspera/cli/command_line.rb +63 -8
  50. data/lib/aspera/cli/command_registry.rb +9 -1
  51. data/lib/aspera/cli/command_spec.rb +47 -7
  52. data/lib/aspera/cli/completion/ascli.bash +19 -5
  53. data/lib/aspera/cli/completion/ascli.fish +13 -2
  54. data/lib/aspera/cli/completion/ascli.ps1 +31 -9
  55. data/lib/aspera/cli/completion/ascli.zsh +22 -6
  56. data/lib/aspera/cli/completion_actions.rb +303 -69
  57. data/lib/aspera/cli/context.rb +9 -4
  58. data/lib/aspera/cli/deprecation.rb +5 -2
  59. data/lib/aspera/cli/error.rb +6 -0
  60. data/lib/aspera/cli/extended_value.rb +66 -31
  61. data/lib/aspera/cli/formatter.rb +43 -30
  62. data/lib/aspera/cli/gem_checker.rb +9 -6
  63. data/lib/aspera/cli/hints.rb +22 -10
  64. data/lib/aspera/cli/http.rb +38 -10
  65. data/lib/aspera/cli/info.rb +12 -7
  66. data/lib/aspera/cli/mailer.rb +6 -3
  67. data/lib/aspera/cli/mcp/http_servlet.rb +7 -8
  68. data/lib/aspera/cli/mcp/secrets.rb +8 -5
  69. data/lib/aspera/cli/mcp/tool.rb +20 -17
  70. data/lib/aspera/cli/option_declarator.rb +10 -4
  71. data/lib/aspera/cli/option_registry.rb +6 -3
  72. data/lib/aspera/cli/option_types.rb +17 -2
  73. data/lib/aspera/cli/option_value.rb +77 -18
  74. data/lib/aspera/cli/options.schema.yaml +641 -80
  75. data/lib/aspera/cli/parser.rb +71 -35
  76. data/lib/aspera/cli/plugins/alee.rb +7 -4
  77. data/lib/aspera/cli/plugins/aoc.rb +248 -37
  78. data/lib/aspera/cli/plugins/ats.rb +10 -9
  79. data/lib/aspera/cli/plugins/base.rb +50 -18
  80. data/lib/aspera/cli/plugins/basic_auth.rb +5 -2
  81. data/lib/aspera/cli/plugins/config.rb +210 -104
  82. data/lib/aspera/cli/plugins/console.rb +6 -3
  83. data/lib/aspera/cli/plugins/cos.rb +8 -4
  84. data/lib/aspera/cli/plugins/factory.rb +21 -7
  85. data/lib/aspera/cli/plugins/faspex5.rb +31 -26
  86. data/lib/aspera/cli/plugins/faspio.rb +7 -5
  87. data/lib/aspera/cli/plugins/httpgw.rb +7 -4
  88. data/lib/aspera/cli/plugins/mcp.rb +42 -22
  89. data/lib/aspera/cli/plugins/node.rb +39 -38
  90. data/lib/aspera/cli/plugins/oauth.rb +23 -6
  91. data/lib/aspera/cli/plugins/orchestrator.rb +287 -83
  92. data/lib/aspera/cli/plugins/preview.rb +72 -45
  93. data/lib/aspera/cli/plugins/server.rb +66 -14
  94. data/lib/aspera/cli/plugins/shares.rb +87 -18
  95. data/lib/aspera/cli/plugins/transferd.rb +228 -0
  96. data/lib/aspera/cli/poll.rb +236 -0
  97. data/lib/aspera/cli/preset_actions.rb +144 -30
  98. data/lib/aspera/cli/preset_manager.rb +113 -35
  99. data/lib/aspera/cli/prompt.rb +157 -9
  100. data/lib/aspera/cli/result.rb +12 -8
  101. data/lib/aspera/cli/runner.rb +89 -48
  102. data/lib/aspera/cli/secret_finder.rb +4 -1
  103. data/lib/aspera/cli/security.rb +89 -9
  104. data/lib/aspera/cli/special_values.rb +4 -1
  105. data/lib/aspera/cli/sync_actions.rb +15 -10
  106. data/lib/aspera/cli/table_fitter.rb +3 -0
  107. data/lib/aspera/cli/terminal_formatter.rb +9 -6
  108. data/lib/aspera/cli/transfer_actions.rb +11 -8
  109. data/lib/aspera/cli/transfer_agent.rb +43 -20
  110. data/lib/aspera/cli/transfer_progress.rb +14 -45
  111. data/lib/aspera/cli/vault_actions.rb +45 -0
  112. data/lib/aspera/cli/vault_manager.rb +188 -42
  113. data/lib/aspera/cli/version.rb +4 -1
  114. data/lib/aspera/cli/web_secret.rb +12 -10
  115. data/lib/aspera/cli/wizard.rb +42 -39
  116. data/lib/aspera/command_line_builder.rb +9 -5
  117. data/lib/aspera/command_line_converter.rb +4 -1
  118. data/lib/aspera/coverage.rb +103 -33
  119. data/lib/aspera/data_repository.rb +4 -1
  120. data/lib/aspera/dot_container.rb +4 -1
  121. data/lib/aspera/environment.rb +23 -12
  122. data/lib/aspera/exec_spec.rb +3 -0
  123. data/lib/aspera/faspex_gw.rb +13 -9
  124. data/lib/aspera/faspex_postproc.rb +15 -12
  125. data/lib/aspera/formatter_interface.rb +4 -1
  126. data/lib/aspera/graphql.rb +5 -1
  127. data/lib/aspera/hash_ext.rb +3 -0
  128. data/lib/aspera/id_generator.rb +20 -5
  129. data/lib/aspera/inflate.rb +43 -0
  130. data/lib/aspera/json_rpc/client.rb +6 -5
  131. data/lib/aspera/json_rpc/version.rb +3 -0
  132. data/lib/aspera/line_logger.rb +4 -1
  133. data/lib/aspera/link_header.rb +4 -1
  134. data/lib/aspera/log.rb +18 -5
  135. data/lib/aspera/markdown.rb +5 -2
  136. data/lib/aspera/mime.rb +3 -0
  137. data/lib/aspera/nagios.rb +6 -4
  138. data/lib/aspera/node_emulator.rb +15 -13
  139. data/lib/aspera/oauth/client/base.rb +124 -73
  140. data/lib/aspera/oauth/client/boot.rb +7 -4
  141. data/lib/aspera/oauth/client/factory.rb +41 -18
  142. data/lib/aspera/oauth/client/generic.rb +5 -1
  143. data/lib/aspera/oauth/client/json_credentials.rb +7 -3
  144. data/lib/aspera/oauth/client/jwt.rb +6 -3
  145. data/lib/aspera/oauth/client/shares_web.rb +94 -0
  146. data/lib/aspera/oauth/client/url_json.rb +7 -3
  147. data/lib/aspera/oauth/client/web.rb +40 -13
  148. data/lib/aspera/oauth/server/pkce.rb +6 -5
  149. data/lib/aspera/orchestrator_workflow_checker.rb +129 -2
  150. data/lib/aspera/persistency_action_once.rb +5 -3
  151. data/lib/aspera/persistency_folder.rb +6 -3
  152. data/lib/aspera/preview/file_types.rb +6 -3
  153. data/lib/aspera/preview/generator.rb +9 -5
  154. data/lib/aspera/preview/options.schema.yaml +3 -3
  155. data/lib/aspera/preview/terminal.rb +16 -6
  156. data/lib/aspera/preview/utils.rb +6 -4
  157. data/lib/aspera/products/connect.rb +5 -2
  158. data/lib/aspera/products/desktop.rb +17 -2
  159. data/lib/aspera/products/other.rb +4 -2
  160. data/lib/aspera/products/transferd.rb +6 -2
  161. data/lib/aspera/products/transferd_service.rb +610 -0
  162. data/lib/aspera/proxy_auto_config.js +2 -2
  163. data/lib/aspera/proxy_auto_config.rb +5 -2
  164. data/lib/aspera/rainbow.rb +3 -0
  165. data/lib/aspera/rest/aspera_errors.rb +4 -1
  166. data/lib/aspera/rest/call_error.rb +3 -0
  167. data/lib/aspera/rest/client.rb +45 -34
  168. data/lib/aspera/rest/error_analyzer.rb +5 -2
  169. data/lib/aspera/rest/list.rb +8 -4
  170. data/lib/aspera/rest/parameters.rb +3 -0
  171. data/lib/aspera/rest/util.rb +8 -5
  172. data/lib/aspera/rest.rb +9 -6
  173. data/lib/aspera/schema/IBM Aspera Faspex API-5.0-enhanced.yaml +9 -9
  174. data/lib/aspera/schema/IBM Aspera Orchestrator API-v1-enhanced.yaml +118 -30
  175. data/lib/aspera/schema/IBM Aspera on Cloud API-0.2.6-enhanced.yaml +11 -11
  176. data/lib/aspera/schema/IBM Aspera on Cloud Automation API-1.0.5-enhanced.yaml +2437 -1437
  177. data/lib/aspera/schema/async_tables.yaml +11 -10
  178. data/lib/aspera/schema/documentation.rb +8 -2
  179. data/lib/aspera/schema/reader.rb +7 -0
  180. data/lib/aspera/schema/registry.rb +44 -28
  181. data/lib/aspera/schema/transferd-config.schema.json +333 -0
  182. data/lib/aspera/schema/validator.rb +4 -1
  183. data/lib/aspera/sealed_hash.rb +150 -0
  184. data/lib/aspera/secret/hider.rb +213 -0
  185. data/lib/aspera/secret/reference.rb +150 -0
  186. data/lib/aspera/secret/resolver.rb +212 -0
  187. data/lib/aspera/secret/store/base.rb +153 -0
  188. data/lib/aspera/secret/store/encrypted_hash.rb +329 -0
  189. data/lib/aspera/secret/store/factory.rb +103 -0
  190. data/lib/aspera/secret/store/hashicorp_vault.rb +390 -0
  191. data/lib/aspera/secret/store/keeper.rb +141 -0
  192. data/lib/aspera/secret/store/macos_security.rb +284 -0
  193. data/lib/aspera/secret/store/one_password_api.rb +99 -0
  194. data/lib/aspera/secret/store/one_password_base.rb +42 -0
  195. data/lib/aspera/secret/store/one_password_cli.rb +112 -0
  196. data/lib/aspera/secret/store/secret_service.rb +125 -0
  197. data/lib/aspera/secret/strength.rb +119 -0
  198. data/lib/aspera/servlet_helpers.rb +5 -2
  199. data/lib/aspera/ssh.rb +10 -7
  200. data/lib/aspera/ssl.rb +5 -2
  201. data/lib/aspera/string_ext.rb +3 -0
  202. data/lib/aspera/sync/args.schema.yaml +3 -0
  203. data/lib/aspera/sync/conf.schema.yaml +9 -4
  204. data/lib/aspera/sync/database.rb +3 -0
  205. data/lib/aspera/sync/operations.rb +17 -15
  206. data/lib/aspera/temp_file_manager.rb +8 -4
  207. data/lib/aspera/timer_limiter.rb +3 -0
  208. data/lib/aspera/transfer/error.rb +4 -1
  209. data/lib/aspera/transfer/faux_file.rb +4 -1
  210. data/lib/aspera/transfer/parameters.rb +17 -14
  211. data/lib/aspera/transfer/result.rb +23 -0
  212. data/lib/aspera/transfer/resumer.rb +6 -4
  213. data/lib/aspera/transfer/spec.rb +9 -22
  214. data/lib/aspera/units/decimal.rb +67 -0
  215. data/lib/aspera/units/duration.rb +109 -0
  216. data/lib/aspera/uri_reader.rb +64 -9
  217. data/lib/aspera/web_auth/index.html.erb +6 -2
  218. data/lib/aspera/web_auth/paste.rb +109 -0
  219. data/lib/aspera/web_auth/receiver.rb +50 -0
  220. data/lib/aspera/web_auth/relay.rb +76 -0
  221. data/lib/aspera/web_auth/reply.html.erb +150 -0
  222. data/lib/aspera/web_auth/server.rb +47 -10
  223. data/lib/aspera/web_page.rb +7 -2
  224. data/lib/aspera/web_server_simple.rb +6 -3
  225. data/lib/aspera/yaml.rb +5 -1
  226. data/llms-install.md +88 -0
  227. data/llms.txt +87 -0
  228. data/skills/ascli/SKILL.md +94 -0
  229. data.tar.gz.sig +0 -0
  230. metadata +77 -20
  231. metadata.gz.sig +0 -0
  232. data/lib/aspera/duration.rb +0 -42
  233. data/lib/aspera/keychain/base.rb +0 -30
  234. data/lib/aspera/keychain/encrypted_hash.rb +0 -192
  235. data/lib/aspera/keychain/factory.rb +0 -58
  236. data/lib/aspera/keychain/hashicorp_vault.rb +0 -77
  237. data/lib/aspera/keychain/macos_security.rb +0 -277
  238. data/lib/aspera/keychain/one_password_api.rb +0 -91
  239. data/lib/aspera/keychain/one_password_base.rb +0 -39
  240. data/lib/aspera/keychain/one_password_cli.rb +0 -100
  241. data/lib/aspera/secret_hider.rb +0 -196
  242. data/lib/aspera/secret_strength.rb +0 -114
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ require_relative '../../assert'
7
+ require_relative '../error'
8
+ require_relative '../security'
9
+ require_relative '../../environment'
10
+ require_relative '../../string_ext'
3
11
  require 'singleton'
4
- require 'aspera/assert'
5
- require 'aspera/cli/error'
6
- require 'aspera/environment'
7
- require 'aspera/string_ext'
8
12
 
9
13
  module Aspera
10
14
  module Cli
@@ -20,6 +24,8 @@ module Aspera
20
24
 
21
25
  def initialize
22
26
  @lookup_folders = []
27
+ # Security level (see `Security`) of each folder: a plugin is code
28
+ @folder_security = {}
23
29
  # information on plugins
24
30
  @plugins = {}
25
31
  end
@@ -31,8 +37,12 @@ module Aspera
31
37
 
32
38
  # add a folder to the list of folders to look for plugins
33
39
  # (absolute, as `require` resolves a relative path against $LOAD_PATH)
34
- def add_lookup_folder(folder)
40
+ # @param folder [String] Folder
41
+ # @param security [Symbol, nil] Most restrictive security level at which plugins of this folder are used, `nil` for all levels (folder of the gem).
42
+ # A folder that a user or a client can write is `:low`: a file written there would be loaded as code.
43
+ def add_lookup_folder(folder, security: nil)
35
44
  folder = File.expand_path(folder)
45
+ @folder_security[folder] = security
36
46
  @lookup_folders.unshift(folder) unless @lookup_folders.include?(folder)
37
47
  end
38
48
 
@@ -40,6 +50,8 @@ module Aspera
40
50
  def add_plugins_from_lookup_folders
41
51
  @lookup_folders.each do |folder|
42
52
  next unless File.directory?(folder)
53
+ # Plugins registered at start (level low) stay, but files that appear later are not
54
+ next unless Security.instance.allowed?(@folder_security[folder])
43
55
  # TODO: add gem root to load path ? and require short folder ?
44
56
  # $LOAD_PATH.push(folder) if i[:add_path]
45
57
  Dir.children(folder).each do |source|
@@ -49,7 +61,7 @@ module Aspera
49
61
  next if IGNORE_PLUGINS.include?(plugin_symbol)
50
62
  req = path.sub(/#{Environment::RB_EXT}$/o, '')
51
63
  next if @plugins.key?(plugin_symbol)
52
- @plugins[plugin_symbol] = {source: path, require_stanza: req}
64
+ @plugins[plugin_symbol] = {source: path, require_stanza: req, security: @folder_security[folder]}
53
65
  end
54
66
  end
55
67
  end
@@ -63,6 +75,8 @@ module Aspera
63
75
  # @return [Class] class object for plugin
64
76
  def plugin_class(plugin_name_sym)
65
77
  Aspera.assert(@plugins.key?(plugin_name_sym), type: NoSuchElement) { "plugin not found: #{plugin_name_sym}" }
78
+ # A plugin registered at start can be replaced by a file written since: it is code
79
+ Security.instance.check_level(@plugins[plugin_name_sym][:security], "plugin #{plugin_name_sym}")
66
80
  require @plugins[plugin_name_sym][:require_stanza]
67
81
  # Module.nesting[1] is Aspera::Cli::Plugins
68
82
  return Object.const_get("#{Module.nesting[1]}::#{plugin_name_sym.to_s.snake_to_capital}")
@@ -76,7 +90,7 @@ module Aspera
76
90
  plugin_class(plugin_name_sym).new(**args)
77
91
  end
78
92
 
79
- IGNORE_PLUGINS = %i[factory base basic_auth oauth]
93
+ IGNORE_PLUGINS = %i[factory base basic_auth oauth].freeze
80
94
  private_constant :IGNORE_PLUGINS
81
95
  end
82
96
  end
@@ -1,24 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
3
6
  # spellchecker: ignore workgroups mypackages passcode
4
7
 
5
- require 'aspera/schema/registry'
6
- require 'aspera/cli/plugins/oauth'
7
- require 'aspera/cli/extended_value'
8
- require 'aspera/cli/formatter'
9
- require 'aspera/transfer/result'
10
- require 'aspera/cli/special_values'
11
- require 'aspera/cli/wizard'
12
- require 'aspera/api/faspex'
13
- require 'aspera/persistency_action_once'
14
- require 'aspera/id_generator'
15
- require 'aspera/nagios'
16
- require 'aspera/environment'
17
- require 'aspera/assert'
8
+ require_relative '../../schema/registry'
9
+ require_relative 'oauth'
10
+ require_relative '../extended_value'
11
+ require_relative '../formatter'
12
+ require_relative '../../transfer/result'
13
+ require_relative '../special_values'
14
+ require_relative '../wizard'
15
+ require_relative '../../api/faspex'
16
+ require_relative '../../persistency_action_once'
17
+ require_relative '../../id_generator'
18
+ require_relative '../../nagios'
19
+ require_relative '../../environment'
20
+ require_relative '../../assert'
21
+ require_relative '../../rainbow'
18
22
  require 'securerandom'
19
23
  require 'digest'
20
24
  require 'json'
21
- require 'aspera/rainbow'
22
25
  using Rainbow
23
26
 
24
27
  module Aspera
@@ -79,7 +82,7 @@ module Aspera
79
82
  end
80
83
  wiz_username = options.get_option(:username, mandatory: true)
81
84
  wizard.check_email(wiz_username)
82
- private_key_path = wizard.ask_private_key(
85
+ private_key = wizard.ask_private_key(
83
86
  user: wiz_username,
84
87
  url: app_url,
85
88
  page: [Environment.char('👤'), 'Account Settings', 'Preferences', 'Public Key in PEM']
@@ -90,7 +93,7 @@ module Aspera
90
93
  url: app_url,
91
94
  username: wiz_username,
92
95
  auth: :jwt.to_s,
93
- private_key: "@file:#{private_key_path}",
96
+ private_key: private_key,
94
97
  client_id: client_id,
95
98
  client_secret: client_secret
96
99
  },
@@ -109,9 +112,8 @@ module Aspera
109
112
  Aspera.assert_type(parameters[type], Array) { type }
110
113
  recipient_types = Api::Faspex::RECIPIENT_TYPES
111
114
  if parameters.key?('recipient_types')
112
- recipient_types = parameters['recipient_types']
113
- parameters.delete('recipient_types')
114
- recipient_types = [recipient_types] unless recipient_types.is_a?(Array)
115
+ recipient_types = Array(parameters.delete('recipient_types'))
116
+ Aspera.assert_array_all(recipient_types, String) { 'recipient_types' }
115
117
  end
116
118
  parameters[type].map! do |recipient_data|
117
119
  # If just a string, make a general lookup and build expected name/type hash
@@ -251,7 +253,7 @@ module Aspera
251
253
  Log.dump(:package_ids, level: :trace1) { packages.map { |p| p['id'] } }
252
254
  else
253
255
  # a single id was provided, or a list of ids
254
- package_ids = [package_ids] unless package_ids.is_a?(Array)
256
+ package_ids = Array(package_ids)
255
257
  Aspera.assert_array_all(package_ids, String) { 'Package id(s)' }
256
258
  # packages = package_ids.map{|pkg_id|api_v5.read("packages/#{pkg_id}")}
257
259
  packages = package_ids.map { |pkg_id| {'id'=>pkg_id} }
@@ -297,6 +299,8 @@ module Aspera
297
299
  end
298
300
 
299
301
  def package_send(parameters)
302
+ # The package is created before the transfer
303
+ transfer.assert_no_dry_run
300
304
  # autofill recipient for public url
301
305
  if api_v5.pub_link_context&.key?('recipient_type') && !parameters.key?('recipients')
302
306
  parameters['recipients'] = [{
@@ -497,7 +501,7 @@ module Aspera
497
501
 
498
502
  # :health and :postprocessing work without authentication: they do not use api_v5.
499
503
  command :health, description: 'Check Faspex 5 health'
500
- command :version, description: 'Show Faspex 5 version', action: ->(**) { Result::SingleObject.new(api_v5.read('version')) }
504
+ command :version, read_only: true, description: 'Show Faspex 5 version', action: ->(**) { Result::SingleObject.new(api_v5.read('version')) }
501
505
  command :bearer_token, description: 'Show OAuth bearer token', action: ->(**) { Result::Text.new(api_v5.oauth.authorization) }
502
506
  # Package id argument; with a public link to a package, setup_package_id provides it instead
503
507
  PACKAGE_ID_ARG = [{name: :package_id, type: :identifier}].freeze
@@ -530,7 +534,7 @@ module Aspera
530
534
  command :shared_folders, description: 'Browse shared folders'
531
535
  command :gateway, description: 'Start Faspex 4 gateway emulation',
532
536
  arguments: [{name: :parameters, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::GATEWAY_OPTIONS}]
533
- command :postprocessing, description: 'Start Faspex 4 post-processing server',
537
+ command :postprocessing, description: 'Start Faspex 4 post-processing server', security: :low,
534
538
  arguments: [{name: :parameters, type: Hash, mandatory: false, default: {}, schema: Schema::Registry::POSTPROC_OPTIONS}]
535
539
  command :invitations, description: 'Manage invitations'
536
540
 
@@ -833,7 +837,8 @@ module Aspera
833
837
  # @param users [Array] raw user ids or percent-selector strings
834
838
  # @return [Array<String>] resolved user ids
835
839
  def resolve_member_user_ids(users)
836
- users = [users] unless users.is_a?(Array)
840
+ users = Array(users)
841
+ Aspera.assert_array_all(users, String) { 'users' }
837
842
  users.map do |user|
838
843
  if (m = Parser.percent_selector(user))
839
844
  api_v5.lookup_entity_by_field(entity: 'accounts', field: m[:field], value: m[:value], query: Rest.php_style({type: ACCOUNT_TYPES}))['id']
@@ -977,20 +982,20 @@ module Aspera
977
982
  end
978
983
 
979
984
  def action_gateway(parameters: {}, **)
980
- require 'aspera/faspex_gw'
985
+ require_relative '../../faspex_gw'
981
986
  Faspex4GWServlet.serve(parameters.symbolize_keys, type: Cli::BadArgument) { [api_v5, nil] }
982
987
  Result::Status.new('Gateway terminated')
983
988
  end
984
989
 
985
990
  def action_postprocessing(parameters: {}, **)
986
- require 'aspera/faspex_postproc' # cspell:disable-line
991
+ require_relative '../../faspex_postproc'
987
992
  Faspex4PostProcServlet.serve(parameters.symbolize_keys, type: Cli::BadArgument)
988
993
  Result::Status.new('Post-processing terminated')
989
994
  end
990
995
  ACCOUNT_TYPES = %w{local_user saml_user self_registered_user external_user}.freeze
991
996
  WORKGROUP_TYPES = %w{workgroup shared_inbox}.freeze
992
997
  CONTACT_TYPES = (WORKGROUP_TYPES + %w{distribution_list user external_user}).freeze
993
- PACKAGE_RECIPIENT_TYPES = %i{recipients private_recipients notified_on_upload notified_on_download notified_on_receipt}
998
+ PACKAGE_RECIPIENT_TYPES = %i{recipients private_recipients notified_on_upload notified_on_download notified_on_receipt}.freeze
994
999
  private_constant :ACCOUNT_TYPES, :CONTACT_TYPES, :PACKAGE_RECIPIENT_TYPES,
995
1000
  :CRUD_NO_SHOW, :CRUD_NO_LIST
996
1001
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aspera/rest'
4
- require 'aspera/nagios'
5
- require 'aspera/cli/plugins/basic_auth'
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ require_relative '../../rest'
7
+ require_relative '../../nagios'
8
+ require_relative 'basic_auth'
6
9
 
7
10
  module Aspera
8
11
  module Cli
@@ -46,8 +49,7 @@ module Aspera
46
49
  when :jwt
47
50
  client_id = options.get_option(:client_id, mandatory: true)
48
51
  preset_value[:client_id] = client_id
49
- key_path = options.get_option(:key_path)
50
- preset_value[:private_key] = key_path ? "@file:#{key_path}" : options.get_option(:private_key, mandatory: true)
52
+ preset_value[:private_key] = options.get_option(:private_key, mandatory: true)
51
53
  passphrase = options.get_option(:passphrase)
52
54
  preset_value[:passphrase] = passphrase unless passphrase.nil?
53
55
  preset_ids.push(client_id)
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aspera/cli/plugins/base'
4
- require 'aspera/rest'
5
- require 'aspera/api/httpgw'
6
- require 'aspera/nagios'
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ require_relative 'base'
7
+ require_relative '../../rest'
8
+ require_relative '../../api/httpgw'
9
+ require_relative '../../nagios'
7
10
 
8
11
  module Aspera
9
12
  module Cli
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # cspell:ignore ascli jsonrpc pkce
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
4
5
 
5
- require 'aspera/cli/plugins/base'
6
- require 'aspera/cli/info'
7
- require 'aspera/cli/version'
8
- require 'aspera/oauth/server/pkce'
9
- require 'aspera/cli/security'
10
- require 'aspera/cli/deprecation'
11
- require 'aspera/secret_strength'
6
+ require_relative 'base'
7
+ require_relative '../info'
8
+ require_relative '../version'
9
+ require_relative '../../oauth/server/pkce'
10
+ require_relative '../security'
11
+ require_relative '../deprecation'
12
+ require_relative '../../secret/strength'
12
13
  require 'securerandom'
13
14
 
14
15
  module Aspera
@@ -96,19 +97,38 @@ module Aspera
96
97
  cleanup → ["config", "transfer", "cleanup"]
97
98
 
98
99
  ORCHESTRATOR WORKFLOW DEVELOPMENT
99
- Before writing or modifying an Orchestrator workflow, read the documentation for workflow
100
- development (file format, graph, execution, recipes, authoring checklist):
101
- ["orchestrator", "workflows", "development", "authoring"]
100
+ Before writing or modifying an Orchestrator workflow, read the development guide (large: read
101
+ sections, not the whole document). Start with the sections "quick-start" and "authoring-checklist":
102
+ ["orchestrator", "workflows", "development", "guide", "section", "authoring-checklist"]
103
+ then the sections you need (file format, graph, inputs of steps, execution, recipes, known issues):
104
+ "workflow-file", "graph-xml", "inputs-of-a-step", "execution", "recipes", "known-issues".
105
+ Command "toc" lists the anchors of the sections of a document, up to a default level, or the level
106
+ given after it:
107
+ ["orchestrator", "workflows", "development", "guide", "toc"]
102
108
  For the template attributes (allowed values), inputs and outputs of an action plugin, and the
103
109
  template settings they depend on, read its specification (fields: section "plugin-specifications"
104
- of the authoring guide); without plugin name, the list of plugins:
105
- ["orchestrator", "plugins", "spec", "<PluginClass>"]
110
+ of the development guide); the list of plugins is given by ["orchestrator", "plugins", "spec", "toc"]:
111
+ ["orchestrator", "plugins", "spec", "show", "<PluginClass>"]
106
112
  For the functional description and the setup of a plugin (for example the API client of Faspex),
107
- read its section of the Plugin Manual (large: read one section):
108
- ["orchestrator", "workflows", "development", "manual", "<anchor>"]
109
- The anchor "toc" lists the sections of a document, up to a default level, or the level given after it.
113
+ read its section of the Plugin Manual (large: read one section only). The anchor of the section is
114
+ field "manual_anchor" of the specification of the plugin (also in the list of plugins):
115
+ ["orchestrator", "workflows", "development", "manual", "section", "<manual_anchor>"]
110
116
  Before importing a workflow file, check it (graph, templates, inputs of steps) and fix all errors:
111
117
  ["orchestrator", "workflows", "check_import", "<file>"]
118
+
119
+ AOC AUTOMATION WORKFLOW DEVELOPMENT
120
+ Before writing or modifying an Aspera on Cloud Automation workflow, read the development guide
121
+ (large: read sections, not the whole document). Start with the section of each trigger and action
122
+ used (for example "Send a package" is action type package_transfer, section "package-transfer"),
123
+ then "payload-rules-enforced-by-the-api" and "finding-the-identifiers":
124
+ ["aoc", "automation", "guide", "section", "package-transfer"]
125
+ Other sections: "triggers", "actions", "substitution-variables", "importing-a-workflow",
126
+ "design-recipes-and-patterns", "common-pitfalls-and-resolutions". List the anchors with:
127
+ ["aoc", "automation", "guide", "toc"]
128
+
129
+ GENERAL GUIDANCE
130
+ For the general rules of use of ascli by an AI (written for a shell: each command line maps to args):
131
+ ["config", "skill"]
112
132
  INST
113
133
 
114
134
  # Keys forwarded to MCP::Server constructor (symbolized)
@@ -136,8 +156,8 @@ module Aspera
136
156
  arguments: [{name: :mcp_options, type: [Hash], mandatory: false, schema: 'opts:components.schemas.McpServerOptions'}]
137
157
 
138
158
  def action_server(mcp_options: nil, **)
139
- require 'aspera/cli/mcp/tool'
140
- require 'aspera/cli/extended_value'
159
+ require_relative '../mcp/tool'
160
+ require_relative '../extended_value'
141
161
  mcp_options = (mcp_options || {}).transform_keys(&:to_sym)
142
162
  unknown = mcp_options.keys - SERVER_KEYS - CONFIG_KEYS - STDIO_KEYS - HTTP_KEYS - HTTP_SERVER_KEYS - TOOL_KEYS - %i[transport]
143
163
  Aspera.assert(unknown.empty?, type: Cli::BadArgument) { "Unknown MCP option(s): #{unknown.join(', ')}" }
@@ -241,16 +261,16 @@ module Aspera
241
261
  # On an address that is not loopback, `auth_token` is mandatory, also with OAuth:
242
262
  # it is the secret asked on the consent page, else anyone could approve its own client.
243
263
  def start_http_transport(server, mcp_options)
244
- require 'aspera/cli/mcp/http_servlet'
245
- require 'aspera/web_server_simple'
264
+ require_relative '../mcp/http_servlet'
265
+ require_relative '../../web_server_simple'
246
266
  parameters = http_server_parameters(mcp_options)
247
267
  uri = WebServerSimple.url(parameters)
248
268
  auth_token = mcp_options[:auth_token]
249
269
  oauth_enabled = mcp_options.fetch(:oauth, false)
250
270
  access_token_ttl = mcp_options.fetch(:oauth_access_token_ttl, OAuth::Server::Pkce.default_access_token_ttl)
251
271
  refresh_token_ttl = mcp_options.fetch(:oauth_refresh_token_ttl, OAuth::Server::Pkce.default_refresh_token_ttl)
252
- min_bits = mcp_options.fetch(:auth_token_min_bits, SecretStrength::DEFAULT_MIN_BITS)
253
- SecretStrength.assert_strong(auth_token, name: 'auth_token', min_bits: min_bits, type: Cli::BadArgument) unless auth_token.nil?
272
+ min_bits = mcp_options.fetch(:auth_token_min_bits, Secret::Strength::DEFAULT_MIN_BITS)
273
+ Secret::Strength.assert_strong(auth_token, name: 'auth_token', min_bits: min_bits, type: Cli::BadArgument) unless auth_token.nil?
254
274
  base_url = http_base_url(uri, mcp_options[:public_url], oauth_enabled)
255
275
  what = "auth_token#{' (asked on the consent page)' if oauth_enabled}"
256
276
  # Clients reach the server at public_url (e.g. through a reverse proxy), whatever the address it listens on
@@ -1,20 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # cspell:ignore snid fnid bidi ssync asyncs rund asnodeadmin mkfile mklink asperabrowser asperabrowserurl watchfolders watchfolderd entsrv
4
- require 'aspera/schema/registry'
5
- require 'aspera/cli/plugins/basic_auth'
6
- require 'aspera/cli/sync_actions'
7
- require 'aspera/cli/special_values'
8
- require 'aspera/transfer/spec'
9
- require 'aspera/nagios'
10
- require 'aspera/hash_ext'
11
- require 'aspera/id_generator'
12
- require 'aspera/api/node'
13
- require 'aspera/oauth/client/factory'
14
- require 'aspera/rest/list'
15
- require 'aspera/assert'
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # cspell:ignore asperabrowserurl
7
+ require_relative '../../schema/registry'
8
+ require_relative '../../sealed_hash'
9
+ require_relative 'basic_auth'
10
+ require_relative '../sync_actions'
11
+ require_relative '../special_values'
12
+ require_relative '../../transfer/spec'
13
+ require_relative '../../nagios'
14
+ require_relative '../../hash_ext'
15
+ require_relative '../../id_generator'
16
+ require_relative '../../api/node'
17
+ require_relative '../../oauth/client/factory'
18
+ require_relative '../../rest/list'
19
+ require_relative '../../assert'
16
20
  require 'base64'
17
- require 'zlib'
18
21
 
19
22
  module Aspera
20
23
  module Cli
@@ -73,7 +76,7 @@ module Aspera
73
76
  # DSL option declarations - at class level, picked up by Base#initialize via ancestor chain.
74
77
  # Included by other plugins (Ats, Cos, Aoc) via `use_options Node`.
75
78
  option :validator, description: 'Identifier of validator (optional for central)'
76
- option :asperabrowserurl, description: 'URL for simple aspera web ui', default: 'https://asperabrowser.mybluemix.net'
79
+ option :asperabrowserurl, description: 'URL of Aspera Browser, web application to browse the node', default: 'https://laurent-martin.github.io/aspera-browser-react/'
77
80
  option :node_api, description: 'Gen4: standard_ports: Use standard FASP ports (true) or get from node API (false). cache: Set to false to force actual file system read',
78
81
  allowed: Hash, on_set: Api::Node.method(:api_options=)
79
82
  option :root_id, description: 'Gen4: File id of top folder when using access key (override AK root id)'
@@ -126,7 +129,7 @@ module Aspera
126
129
  spec: {description: 'Show transfer spec base'},
127
130
  api_details: {description: 'Show API details'},
128
131
  health: {description: 'Check node health'},
129
- events: {description: 'List events'},
132
+ events: {description: 'List events', read_only: true},
130
133
  info: {description: 'Show node info'},
131
134
  slash: {description: 'Show root info'},
132
135
  license: {description: 'Show license'},
@@ -153,7 +156,7 @@ module Aspera
153
156
  modify: {description: 'Modify file', arguments: [{name: :path}, {name: :file, type: Hash, schema: 'node:components.schemas.files-id-put-request'}]},
154
157
  cat: {description: 'Show file contents', arguments: SINGLE_PATH_ARG},
155
158
  show: {description: 'Show file info', arguments: SINGLE_PATH_ARG},
156
- thumbnail: {description: 'Show file thumbnail', arguments: SINGLE_PATH_ARG},
159
+ thumbnail: {description: 'Show file thumbnail', arguments: SINGLE_PATH_ARG, read_only: true},
157
160
  bearer_token_node: {description: 'Show bearer token for file node', arguments: SINGLE_PATH_ARG},
158
161
  node_info: {description: 'Show node info for file', arguments: SINGLE_PATH_ARG},
159
162
  ls: {description: 'List files', arguments: SINGLE_PATH_ARG, aliases: [:browse]},
@@ -451,19 +454,19 @@ module Aspera
451
454
  Result::Status.new('Done')
452
455
  end
453
456
  )
454
- command :bandwidth, description: 'Show sync bandwidth',
457
+ command :bandwidth, read_only: true, description: 'Show sync bandwidth',
455
458
  arguments: [{name: :ssync_id, type: :identifier, lookup: :ssync_lookup}],
456
459
  action: ->(ssync_id:, **) { Result::SingleObject.new(api_node.read("asyncs/#{ssync_id}/bandwidth", query_read_delete(default: {}))) }
457
- command :counters, description: 'Show sync counters',
460
+ command :counters, read_only: true, description: 'Show sync counters',
458
461
  arguments: [{name: :ssync_id, type: :identifier, lookup: :ssync_lookup}],
459
462
  action: ->(ssync_id:, **) { Result::SingleObject.new(api_node.read("asyncs/#{ssync_id}/counters", query_read_delete(default: {}))) }
460
- command :files, description: 'List sync files',
463
+ command :files, read_only: true, description: 'List sync files',
461
464
  arguments: [{name: :ssync_id, type: :identifier, lookup: :ssync_lookup}],
462
465
  action: ->(ssync_id:, **) { Result::SingleObject.new(api_node.read("asyncs/#{ssync_id}/files", query_read_delete(default: {}))) }
463
- command :state, description: 'Show sync state',
466
+ command :state, read_only: true, description: 'Show sync state',
464
467
  arguments: [{name: :ssync_id, type: :identifier, lookup: :ssync_lookup}],
465
468
  action: ->(ssync_id:, **) { Result::SingleObject.new(api_node.read("asyncs/#{ssync_id}/state")) }
466
- command :summary, description: 'Show sync summary',
469
+ command :summary, read_only: true, description: 'Show sync summary',
467
470
  arguments: [{name: :ssync_id, type: :identifier, lookup: :ssync_lookup}],
468
471
  action: ->(ssync_id:, **) { Result::SingleObject.new(api_node.read("asyncs/#{ssync_id}/summary")) }
469
472
  end
@@ -558,7 +561,7 @@ module Aspera
558
561
  Result::Status.new("#{watch_folder_id} deleted")
559
562
  end
560
563
  )
561
- command :state, description: 'Show watch folder state',
564
+ command :state, read_only: true, description: 'Show watch folder state',
562
565
  arguments: [{name: :watch_folder_id, type: :identifier}],
563
566
  action: ->(watch_folder_id:, **) { Result::SingleObject.new(api_node.read("v3/watchfolders/#{watch_folder_id}/state")) }
564
567
  end
@@ -579,7 +582,7 @@ module Aspera
579
582
  arguments: [{name: :file, type: Hash, mandatory: false, default: nil}]
580
583
  end
581
584
  # Standalone leaf commands
582
- command :asperabrowser, description: 'Open Aspera browser'
585
+ command :asperabrowser, description: 'Open Aspera Browser on this node (the password is optional: it is then entered in the application)'
583
586
  command :basic_token, description: 'Generate basic auth token', action: ->(**) { Result::Text.new(Rest.basic_authorization(options.get_option(:username, mandatory: true), options.get_option(:password, mandatory: true))) }
584
587
  command(
585
588
  :bearer_token, description: 'Generate bearer token',
@@ -777,7 +780,7 @@ module Aspera
777
780
  # access_keys > do > show
778
781
  def action_access_keys_do_show(path:, do_root_file_id:, **)
779
782
  apifid = apifid_from_path(do_root_file_id, path)
780
- Result::SingleObject.new(apifid.node_api.read("files/#{apifid.file_id}"))
783
+ Result::SingleObject.new(apifid.node_api.read("files/#{apifid.file_id}", headers: Api::Node.add_cache_control))
781
784
  end
782
785
 
783
786
  # access_keys > do > modify
@@ -790,7 +793,7 @@ module Aspera
790
793
  # access_keys > do > thumbnail
791
794
  def action_access_keys_do_thumbnail(path:, do_root_file_id:, **)
792
795
  apifid = apifid_from_path(do_root_file_id, path)
793
- Result::Image.new(apifid.node_api.read("files/#{apifid.file_id}/preview", headers: {'Accept' => 'image/png'}, ret: :resp).body)
796
+ Result::Image.new(apifid.node_api.read("files/#{apifid.file_id}/preview", headers: Api::Node.add_cache_control({'Accept' => 'image/png'}), ret: :resp).body)
794
797
  end
795
798
 
796
799
  # access_keys > do > rename
@@ -1122,19 +1125,19 @@ module Aspera
1122
1125
  def action_asperabrowser(**)
1123
1126
  browse_params = {
1124
1127
  'nodeUser' => options.get_option(:username, mandatory: true),
1125
- 'nodePW' => options.get_option(:password, mandatory: true),
1128
+ 'nodePW' => options.get_option(:password),
1126
1129
  'nodeURL' => options.get_option(:url, mandatory: true)
1127
- }
1128
- # encode parameters so that it looks good in url
1129
- encoded_params = Base64.strict_encode64(Zlib::Deflate.deflate(JSON.generate(browse_params))).gsub(/=+$/, '').tr('+/', '-_').reverse
1130
- Environment.instance.open_uri("#{options.get_option(:asperabrowserurl)}?goto=#{encoded_params}")
1130
+ }.reject { |_key, value| value.to_s.empty? }
1131
+ # Not encrypted (decoded by the web application), in the fragment: it is not sent to the web server
1132
+ encoded_params = SealedHash.seal(browse_params, encrypt: false, reverse: true)
1133
+ Environment.instance.open_uri("#{options.get_option(:asperabrowserurl)}##{URI.encode_www_form(goto: encoded_params)}")
1131
1134
  return Result::Status.new('done')
1132
1135
  end
1133
1136
 
1134
1137
  def action_emulator(parameters: {}, **)
1135
- require 'aspera/secret_strength'
1136
- require 'aspera/web_server_simple'
1137
- require 'aspera/node_emulator'
1138
+ require_relative '../../secret/strength'
1139
+ require_relative '../../web_server_simple'
1140
+ require_relative '../../node_emulator'
1138
1141
  # missing parameters take the default of the schema
1139
1142
  defaults = Schema::Registry.instance.reader(Schema::Registry::NODE_EMULATOR_OPTIONS).current['properties'].each_with_object({}) do |(name, property), result|
1140
1143
  result[name.to_sym] = property['default'] if property.key?('default')
@@ -1145,7 +1148,7 @@ module Aspera
1145
1148
  retention_sec = config.delete(:retention_sec)
1146
1149
  password_min_bits = config.delete(:password_min_bits)
1147
1150
  Aspera.assert(config[:username].nil? == config[:password].nil?, type: Cli::BadArgument) { 'Parameters username and password must be set together' }
1148
- SecretStrength.assert_strong(config[:password], name: 'password', min_bits: password_min_bits, type: Cli::BadArgument) unless config[:password].nil?
1151
+ Secret::Strength.assert_strong(config[:password], name: 'password', min_bits: password_min_bits, type: Cli::BadArgument) unless config[:password].nil?
1149
1152
  # Files of the docroot can be sent to, or received from, any host by anyone who can reach the server
1150
1153
  WebServerSimple.serve(parameters, NodeEmulatorServlet, protected: !config[:username].nil?, what: 'username and password', type: Cli::BadArgument) do
1151
1154
  Log.log.warn('No username and password: emulator accepts requests without authentication') if config[:username].nil?
@@ -1155,10 +1158,8 @@ module Aspera
1155
1158
  end
1156
1159
 
1157
1160
  def action_telemetry(parameters: {}, **)
1161
+ # `url` and `key` are required by the schema
1158
1162
  parameters = parameters.symbolize_keys
1159
- %i[url key].each do |psym|
1160
- Aspera.assert(parameters.key?(psym), type: Cli::BadArgument) { "Missing parameter: #{psym}" }
1161
- end
1162
1163
  require 'socket'
1163
1164
  parameters[:interval] = 10 unless parameters.key?(:interval)
1164
1165
  parameters[:hostname] = Socket.gethostname unless parameters.key?(:hostname)
@@ -1,10 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aspera/cli/plugins/basic_auth'
3
+ # SPDX-FileCopyrightText: IBM Corp.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ require_relative 'basic_auth'
7
+ require_relative '../error'
4
8
 
5
9
  module Aspera
6
10
  module Cli
7
11
  module Plugins
12
+ # Options of OAuth web authentication (authorization code): client and redirect URI.
13
+ # For a plugin that uses only this flow: `use_options OauthWebOptions` (without the options of `Oauth`)
14
+ module OauthWebOptions
15
+ extend OptionDeclarator
16
+ option :client_id, description: 'OAuth client identifier'
17
+ option :client_secret, description: 'OAuth client secret'
18
+ option :redirect_uri, description: 'OAuth (Web) redirect URI for web authentication'
19
+ end
20
+
21
+ # Options of OAuth JWT authentication: private key
22
+ module OauthJwtOptions
23
+ extend OptionDeclarator
24
+ option :private_key, description: 'OAuth (JWT) RSA private key PEM value (prefix file path with @file:)'
25
+ option :passphrase, description: 'OAuth (JWT) RSA private key passphrase'
26
+ end
27
+
8
28
  # base class for applications supporting OAuth 2.0 authentication
9
29
  class Oauth < BasicAuth
10
30
  class << self
@@ -29,11 +49,8 @@ module Aspera
29
49
  # Options used for authentication (url, auth, client_id, etc...)
30
50
  AUTH_OPTIONS = %i[url auth client_id client_secret redirect_uri private_key passphrase username password].freeze
31
51
  option :auth, description: 'OAuth type of authentication', allowed: AUTH_TYPES, default: :jwt
32
- option :client_id, description: 'OAuth client identifier'
33
- option :client_secret, description: 'OAuth client secret'
34
- option :redirect_uri, description: 'OAuth (Web) redirect URI for web authentication'
35
- option :private_key, description: 'OAuth (JWT) RSA private key PEM value (prefix file path with @file:)'
36
- option :passphrase, description: 'OAuth (JWT) RSA private key passphrase'
52
+ use_options OauthWebOptions
53
+ use_options OauthJwtOptions
37
54
  end
38
55
  end
39
56
  end