Class: Aspera::Cli::BasicAuthPlugin
- Defined in:
- lib/aspera/cli/basic_auth_plugin.rb
Overview
base class for applications supporting basic authentication
Direct Known Subclasses
Plugins::Alee, Plugins::Aoc, Plugins::Bss, Plugins::Console, Plugins::Faspex, Plugins::Faspex5, Plugins::Node, Plugins::Orchestrator, Plugins::Preview, Plugins::Server, Plugins::Shares
Constant Summary
Constants inherited from Plugin
Plugin::ALL_OPS, Plugin::GLOBAL_OPS, Plugin::INSTANCE_OPS, Plugin::MAX_ITEMS, Plugin::MAX_PAGES, Plugin::REGEX_LOOKUP_ID_BY_FIELD, Plugin::VAL_ALL
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(env) ⇒ BasicAuthPlugin
constructor
A new instance of BasicAuthPlugin.
Methods inherited from Plugin
#do_bulk_operation, #entity_action, #entity_command, #instance_identifier, #old_query_read_delete, #query_read_delete, #value_create_modify, #value_or_query
Constructor Details
#initialize(env) ⇒ BasicAuthPlugin
Returns a new instance of BasicAuthPlugin.
19 20 21 22 |
# File 'lib/aspera/cli/basic_auth_plugin.rb', line 19 def initialize(env) super(env) self.class.(env) unless env[:skip_basic_auth_options] end |
Class Method Details
.register_options(env) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/aspera/cli/basic_auth_plugin.rb', line 11 def (env) env[:options].declare(:url, 'URL of application, e.g. https://org.asperafiles.com') env[:options].declare(:username, 'Username to log in') env[:options].declare(:password, "User's password") env[:options]. end |
Instance Method Details
#basic_auth_api(subpath = nil) ⇒ Object
37 38 39 |
# File 'lib/aspera/cli/basic_auth_plugin.rb', line 37 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
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/aspera/cli/basic_auth_plugin.rb', line 25 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 |