Class: Aspera::Cli::Plugins::BasicAuth
- Defined in:
- lib/aspera/cli/plugins/basic_auth.rb
Overview
base class for applications supporting basic authentication
Direct Known Subclasses
Alee, Console, Faspex, Faspio, Node, Oauth, Orchestrator, Preview, Server, Shares
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #basic_auth_api(subpath = nil) ⇒ Object
-
#basic_auth_params(subpath = nil) ⇒ Object
returns a Rest object with basic auth.
-
#initialize(context:, basic_options: true) ⇒ BasicAuth
constructor
A new instance of BasicAuth.
Methods inherited from Base
#add_manual_header, #config, #do_bulk_operation, #entity_execute, #formatter, #options, #persistency, #query_read_delete, #transfer, #value_create_modify
Constructor Details
Class Method Details
.declare_options(options) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/aspera/cli/plugins/basic_auth.rb', line 12 def () .declare(:url, 'URL of application, e.g. https://app.example.com/aspera/app') .declare(:username, "User's identifier") .declare(:password, "User's password") . end |
Instance Method Details
#basic_auth_api(subpath = nil) ⇒ Object
39 40 41 |
# File 'lib/aspera/cli/plugins/basic_auth.rb', line 39 def basic_auth_api(subpath = nil) return Rest.new(**basic_auth_params(subpath)) end |
#basic_auth_params(subpath = nil) ⇒ Object
returns a Rest object with basic auth
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aspera/cli/plugins/basic_auth.rb', line 26 def basic_auth_params(subpath = nil) api_url = .get_option(:url, mandatory: true) api_url = "#{api_url}/#{subpath}" unless subpath.nil? return { base_url: api_url, auth: { type: :basic, username: .get_option(:username, mandatory: true), password: .get_option(:password, mandatory: true) } } end |