Exemple #1
0
static void
cockpit_auth_choose_login_async (CockpitAuth *self,
                                 const gchar *path,
                                 GHashTable *headers,
                                 const gchar *remote_peer,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data)
{
  const gchar *action;
  gchar *application = NULL;
  gchar *type = NULL;

  application = cockpit_auth_parse_application (path);
  type = cockpit_auth_parse_authorization_type (headers);
  if (!type)
    type = g_strdup ("negotiate");

  action = action_for_type (type, application, self->login_loopback);
  if (g_strcmp0 (action, ACTION_SPAWN_HEADER) == 0)
    {
      cockpit_auth_spawn_login_async (self, application, type, FALSE,
                                      headers, remote_peer,
                                      callback, user_data);
    }
  else if (g_strcmp0 (action, ACTION_SPAWN_DECODE) == 0)
    {
      cockpit_auth_spawn_login_async (self, application, type, TRUE,
                                       headers, remote_peer,
                                       callback, user_data);
    }
  else if (g_strcmp0 (action, ACTION_SSH) == 0)
    {
      cockpit_auth_remote_login_async (self, application, type,
                                       headers, remote_peer,
                                       callback, user_data);
    }
  else if (g_strcmp0 (action, ACTION_CONVERSATION) == 0)
    {
      cockpit_auth_resume_async (self, application, type,
                                 headers, remote_peer,
                                 callback, user_data);
    }
  else if (g_strcmp0 (action, ACTION_NONE) == 0)
    {
      cockpit_auth_none_login_async (self, callback, user_data);
    }
  else
    {
      g_message ("got unknown login action: %s", action);
      cockpit_auth_none_login_async (self, callback, user_data);
    }

  g_free (type);
  g_free (application);
}
Exemple #2
0
static void
cockpit_auth_choose_login_async (CockpitAuth *self,
                                 GHashTable *headers,
                                 const gchar *remote_peer,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data)
{
  if (self->login_loopback)
    cockpit_auth_remote_login_async (self, headers, remote_peer, callback, user_data);
  else
    cockpit_auth_session_login_async (self, headers, remote_peer, callback, user_data);
}