Class: HammerCLIForeman::Auth::LoginCommand::BasicExternal

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



40
41
42
43
44
45
46
47
48
49
# File 'lib/hammer_cli_foreman/auth.rb', line 40

def execute
  Basic.execute_with_params(
    AUTH_TYPES[:basic_auth_external],
    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