Module: HammerCLIForeman::Authenticate::Login

Instance Method Summary collapse

Instance Method Details

#execute_with_params(auth_type, *args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/hammer_cli_foreman/authenticate/login.rb', line 4

def execute_with_params(auth_type, *args)
  connection = HammerCLIForeman.foreman_api_reconnect(auth_type)
  if !(connection.authenticator.is_a?(HammerCLIForeman::Api::SessionAuthenticatorWrapper))
    raise ArgumentError, _("Can't perform login. Make sure sessions are enabled in hammer"\
      " configuration file.")
  end
  connection.authenticator.set_auth_params(*args)
  connection.authenticator.force_user_change
  connection.
end