Class: Aspera::Cli::Plugins::Oauth

Inherits:
BasicAuth show all
Defined in:
lib/aspera/cli/plugins/oauth.rb

Overview

base class for applications supporting OAuth 2.0 authentication

Direct Known Subclasses

Aoc, Faspex5

Constant Summary collapse

AUTH_TYPES =

OAuth methods supported (web, jwt)

%i[web jwt boot].freeze
AUTH_OPTIONS =

Options used for authentication (url, auth, client_id, etc...)

%i[url auth client_id client_secret redirect_uri private_key passphrase username password].freeze

Constants inherited from Base

Base::FILTER_ARGS

Instance Attribute Summary

Attributes inherited from Base

#context, #help_path

Class Method Summary collapse

Methods inherited from BasicAuth

#basic_auth_api, #basic_auth_params, #initialize

Methods inherited from Base

#action_for, #add_manual_header, application_name, #bulk_result, command, command_registry, commands_under, #config, crud_commands, declare_options, define_action_method, #dispatch_child, #dispatch_from_registry, #dispatch_leaf, #entity_create, #entity_delete, entity_display_name, #entity_list, #entity_modify, #entity_res_path, #entity_show, #execute_action, #execute_leaf, file_matcher, #formatter, #generate_help, #http_config, #initialize, #invoke_action, option, #options, #persistency, #presets, #progress_bar, #query_read_delete, #resolve_argument, root_setup, #transfer, use_options, used_option_sources

Constructor Details

This class inherits a constructor from Aspera::Cli::Plugins::BasicAuth

Class Method Details

.kwargs_from_options(options) ⇒ Hash{Symbol => Object}

Get command line options specified by AUTH_OPTIONS

Parameters:

  • options (Cli::Parser)

    Object to get command line options.

Returns:

  • (Hash{Symbol => Object})

    Options

Raises:

  • (Cli::Error)

    if a required option is missing



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/aspera/cli/plugins/oauth.rb', line 15

def kwargs_from_options(options)
  AUTH_OPTIONS.each_with_object({}) do |i, m|
    v = options.get_option(i)
    m[i] = v unless v.nil?
  end
rescue ::ArgumentError => e
  if (m = e.message.match(/missing keyword: :(.*)$/))
    raise Cli::Error, "Missing option: #{m[1]}"
  end
  raise
end