class Aspera::Cli::BasicAuthPlugin

base class for applications supporting basic authentication

Constants

ACTIONS

Public Class Methods

new(env) click to toggle source
Calls superclass method
# File lib/aspera/cli/basic_auth_plugin.rb, line 8
def initialize(env)
  super(env)
  unless env[:skip_basic_auth_options]
    self.options.add_opt_simple(:url,"URL of application, e.g. https://org.asperafiles.com")
    self.options.add_opt_simple(:username,"username to log in")
    self.options.add_opt_simple(:password,"user's password")
    self.options.parse_options!
  end
end

Public Instance Methods

basic_auth_api(subpath=nil) click to toggle source

returns a Rest object with basic auth

# File lib/aspera/cli/basic_auth_plugin.rb, line 24
def basic_auth_api(subpath=nil)
  api_url=self.options.get_option(:url,:mandatory)
  api_url=api_url+'/'+subpath unless subpath.nil?
  return Rest.new({
    :base_url => api_url,
    :auth     => {
    :type     => :basic,
    :username => self.options.get_option(:username,:mandatory),
    :password => self.options.get_option(:password,:mandatory)
    }})
end
execute_action() click to toggle source
# File lib/aspera/cli/basic_auth_plugin.rb, line 19
def execute_action
  raise "do not execute action on this generic plugin"
end