Class: HammerCLIForeman::Auth::LoginCommand::Basic

Inherits:
HammerCLI::AbstractCommand
  • Object
show all
Extended by:
HammerCLIForeman::Authenticate::Login
Defined in:
lib/hammer_cli_foreman/auth.rb

Instance Method Summary collapse

Methods included from HammerCLIForeman::Authenticate::Login

execute_with_params

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/hammer_cli_foreman/auth.rb', line 19

def execute
  Basic.execute_with_params(
    AUTH_TYPES[:basic_auth],
    option_username || HammerCLI::Settings.get('_params', 'username'),
    option_password || HammerCLI::Settings.get('_params', 'password')
  )
  logged_user = HammerCLIForeman.foreman_api_connection.authenticator.user
  print_message(_("Successfully logged in as '%s'.") % logged_user)
  HammerCLI::EX_OK
end