gio-unix-2.0
glib-2.0 >= 2.32
gobject-2.0
- dbus-1
- dbus-glib-1
- signond >= 8.40);
+ signond >= 8.40);
AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)
signon-auth-session.c \
signon-errors.h \
signon-errors.c \
- signon-proxy.h \
- signon-proxy.c \
signon-utils.h \
signon-utils.c \
sso-auth-service.c \
#include "signon-enum-types.h"
#include "signon-internals.h"
#include "signoncommon.h"
-#include <dbus/dbus-glib.h>
#include <gio/gio.h>
/**
G_N_ELEMENTS (signon_error_entries));
return (GQuark) quark;
}
-
-GError *
-_signon_errors_get_error_from_dbus (GError *error)
-{
- const gchar *error_name;
- const gchar *nick;
- GType enum_type;
- GEnumClass *enum_class;
- GEnumValue *enum_value;
- GError *new_error;
- gint code = SIGNON_ERROR_UNKNOWN;
-
- if (error == NULL)
- return NULL;
-
- error_name = dbus_g_error_get_name (error);
-
- if (!g_str_has_prefix (error_name, SIGNON_ERROR_PREFIX))
- return error;
-
- nick = error_name + sizeof(SIGNON_ERROR_PREFIX);
-
- enum_type = signon_error_get_type ();
- enum_class = g_type_class_ref (enum_type);
- enum_value = g_enum_get_value_by_nick (enum_class, nick);
-
- if (enum_value)
- code = enum_value->value;
-
- new_error = g_error_new_literal (SIGNON_ERROR, code, error->message);
-
- g_error_free (error);
- g_type_class_unref (enum_class);
-
- return new_error;
-}
g_hash_table_foreach ((GHashTable *)methods, identity_methods_copy, info);
}
-static void
-add_method (gpointer key, gpointer value, gpointer user_data)
-{
- gchar **stringarray = (gchar **)value;
- g_hash_table_insert ((GHashTable *)user_data, g_strdup((gchar *)key),
- g_strdupv (stringarray));
-}
-
-SignonIdentityInfo *
-signon_identity_info_new_from_hash_table (GHashTable *map)
-{
- if (!map)
- return NULL;
-
- SignonIdentityInfo *info = signon_identity_info_new ();
-
- DEBUG("%s: ", G_STRFUNC);
- GValue *value;
-
- /* get the id (gint) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_ID);
- if (value != NULL)
- {
- g_assert (G_VALUE_HOLDS_UINT (value));
- identity_info_set_id (info, g_value_get_uint (value));
- }
-
- /* get the user name (gchar*) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_USERNAME);
- if (value != NULL)
- {
- g_assert (G_VALUE_HOLDS_STRING (value));
- signon_identity_info_set_username (info, g_value_get_string (value));
- }
-
- /* get the password (gchar*) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_SECRET);
- if (value != NULL)
- {
- GValue *v_store_secret;
- gboolean store_secret;
-
- g_assert (G_VALUE_HOLDS_STRING (value));
-
- v_store_secret = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_STORESECRET);
- store_secret = (v_store_secret != NULL) ?
- g_value_get_boolean (v_store_secret) : FALSE;
-
- signon_identity_info_set_secret (info, g_value_get_string (value),
- store_secret);
- }
-
- /* get the caption (gchar*) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_CAPTION);
- if (value != NULL)
- {
- g_assert (G_VALUE_HOLDS_STRING (value));
- signon_identity_info_set_caption (info, g_value_get_string (value));
- }
-
- /* get the realms (gchar**) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_REALMS);
- if (value != NULL)
- {
- g_assert (G_VALUE_TYPE (value) == G_TYPE_STRV);
- signon_identity_info_set_realms (info,
- (const gchar* const *)
- g_value_get_boxed (value));
- }
-
- /* get the methods */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_AUTHMETHODS);
- if (value != NULL)
- {
- g_assert (G_VALUE_HOLDS_BOXED (value));
- g_assert (G_VALUE_TYPE (value) ==
- dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRV));
-
- info->methods = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, (GDestroyNotify)g_strfreev);
- g_hash_table_foreach ((GHashTable *)g_value_get_boxed(value),
- add_method,
- info->methods);
- }
-
- /* get the accessControlList (gchar**) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_ACL);
- if (value != NULL)
- {
- g_assert (G_VALUE_TYPE (value) == G_TYPE_STRV);
- signon_identity_info_set_access_control_list (info,
- (const gchar* const *)
- g_value_get_boxed (value));
- }
-
- /* get the type (gint) */
- value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_TYPE);
- if (value != NULL)
- {
- g_assert (G_VALUE_HOLDS_INT(value));
- signon_identity_info_set_identity_type (info, g_value_get_int (value));
- }
-
- return info;
-}
-
-GHashTable *
-signon_identity_info_to_hash_table (const SignonIdentityInfo *self)
-{
- GHashTable *map;
- GValue *value;
- GType type;
-
- map = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL,
- signon_gvalue_free);
-
- value = signon_gvalue_new (G_TYPE_UINT);
- g_value_set_uint (value, self->id);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_ID, value);
-
- value = signon_gvalue_new (G_TYPE_STRING);
- g_value_set_string (value, self->username);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_USERNAME, value);
-
- value = signon_gvalue_new (G_TYPE_STRING);
- g_value_set_string (value, self->secret);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_SECRET, value);
-
- value = signon_gvalue_new (G_TYPE_STRING);
- g_value_set_string (value, self->caption);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_CAPTION, value);
-
- value = signon_gvalue_new (G_TYPE_BOOLEAN);
- g_value_set_boolean (value, self->store_secret);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_STORESECRET, value);
-
- type = dbus_g_type_get_map ("GHashTable",
- G_TYPE_STRING, G_TYPE_STRV);
- value = signon_gvalue_new (type);
- g_value_set_boxed (value, self->methods);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_AUTHMETHODS, value);
-
- value = signon_gvalue_new (G_TYPE_STRV);
- g_value_set_boxed (value, self->realms);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_REALMS, value);
-
- value = signon_gvalue_new (G_TYPE_STRV);
- g_value_set_boxed (value, self->access_control_list);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_ACL, value);
-
- value = signon_gvalue_new (G_TYPE_INT);
- g_value_set_int (value, self->type);
- g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_TYPE, value);
-
- return map;
-}
-
SignonIdentityInfo *
signon_identity_info_new_from_variant (GVariant *variant)
{
#endif
#include <signoncommon.h>
-#include <dbus/dbus-glib.h>
#include "signon-identity.h"
#include "signon-auth-session.h"
gint type;
};
-G_GNUC_INTERNAL
-SignonIdentityInfo *
-signon_identity_info_new_from_hash_table (GHashTable *map);
-
G_GNUC_INTERNAL
SignonIdentityInfo *
signon_identity_info_new_from_variant (GVariant *variant);
GVariant *
signon_identity_info_to_variant (const SignonIdentityInfo *self);
-G_GNUC_INTERNAL
-GHashTable *
-signon_identity_info_to_hash_table (const SignonIdentityInfo *self);
-
G_GNUC_INTERNAL
void signon_identity_info_set_methods (SignonIdentityInfo *self,
const GHashTable *methods);
-G_GNUC_INTERNAL
-void _signon_identity_registered (SignonIdentity *identity, DBusGProxy *proxy,
- char *objectPath, GPtrArray *identityArray,
- GError *error);
-
-G_GNUC_INTERNAL
-GError *_signon_errors_get_error_from_dbus (GError *error);
-
G_GNUC_INTERNAL
void signon_auth_session_set_id(SignonAuthSession* self,
gint32 id);
-VOID:POINTER,UINT,BOXED
VOID:INT,STRING
+++ /dev/null
-/* vi: set et sw=4 ts=4 cino=t0,(0: */
-/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of libsignon-glib
- *
- * Copyright (C) 2009-2010 Nokia Corporation.
- *
- * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include "signon-proxy.h"
-#include "signon-internals.h"
-#include <dbus/dbus-glib.h>
-
-G_DEFINE_TYPE (SignonProxy, signon_proxy, DBUS_TYPE_G_PROXY);
-
-static SignonProxy *signon_proxy = NULL;
-
-static void
-signon_proxy_init (SignonProxy *self)
-{
-}
-
-static GObject *
-signon_proxy_constructor (GType type, guint n_params,
- GObjectConstructParam *params)
-{
- GObjectClass *object_class =
- (GObjectClass *)signon_proxy_parent_class;
- GObject *object;
-
- if (!signon_proxy)
- {
- object = object_class->constructor (type,
- n_params,
- params);
- signon_proxy = SIGNON_PROXY (object);
- }
- else
- object = g_object_ref (G_OBJECT (signon_proxy));
-
- return object;
-}
-
-static void
-signon_proxy_dispose (GObject *object)
-{
- G_OBJECT_CLASS (signon_proxy_parent_class)->dispose (object);
-}
-
-static void
-signon_proxy_finalize (GObject *object)
-{
- G_OBJECT_CLASS (signon_proxy_parent_class)->finalize (object);
- signon_proxy = NULL;
-}
-
-static void
-signon_proxy_class_init (SignonProxyClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = signon_proxy_dispose;
- object_class->constructor = signon_proxy_constructor;
- object_class->finalize = signon_proxy_finalize;
-}
-
-SignonProxy *
-signon_proxy_new ()
-{
- SignonProxy *proxy;
- GError *error = NULL;
-
- DBusGConnection *connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-
- if (error)
- {
- g_warning ("%s returned error: %s", G_STRFUNC, error->message);
- g_error_free (error);
- return NULL;
- }
-
- proxy = g_object_new (SIGNON_TYPE_PROXY,
- "name", SIGNOND_SERVICE,
- "path", SIGNOND_DAEMON_OBJECTPATH,
- "interface", SIGNOND_DAEMON_INTERFACE,
- "connection", connection,
- NULL);
-
- dbus_g_connection_unref (connection);
-
- return proxy;
-}
+++ /dev/null
-/* vi: set et sw=4 ts=4 cino=t0,(0: */
-/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of libsignon-glib
- *
- * Copyright (C) 2009-2010 Nokia Corporation.
- *
- * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#ifndef _SIGNON_AUTH_PROXY_H_
-#define _SIGNON_AUTH_PROXY_H_
-
-
-#include <glib-object.h>
-#include <dbus/dbus-glib.h>
-
-#define SIGNON_TYPE_PROXY (signon_proxy_get_type ())
-#define SIGNON_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_PROXY, SignonProxy))
-#define SIGNON_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_PROXY, SignonProxyClass))
-#define SIGNON_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_PROXY))
-#define SIGNON_IS_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_PROXY))
-#define SIGNON_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_PROXY, SignonProxyClass))
-
-
-typedef struct _SignonProxyClass SignonProxyClass;
-typedef struct _SignonProxy SignonProxy;
-
-struct _SignonProxyClass
-{
- DBusGProxyClass parent_class;
-};
-
-struct _SignonProxy
-{
- DBusGProxyClass parent_instance;
-};
-
-G_GNUC_INTERNAL
-GType signon_proxy_get_type (void) G_GNUC_CONST;
-
-G_GNUC_INTERNAL
-SignonProxy *signon_proxy_new ();
-
-G_END_DECLS
-
-#endif /* _SIGNON_PROXY_H_ */
#include "libsignon-glib/signon-auth-service.h"
#include "libsignon-glib/signon-auth-session.h"
#include "libsignon-glib/signon-identity.h"
-#include "libsignon-glib/signon-client-glib-gen.h"
-#include "libsignon-glib/signon-identity-glib-gen.h"
#include "libsignon-glib/signon-errors.h"
#include <glib.h>
#include <check.h>
#include <stdlib.h>
#include <string.h>
-#include <dbus/dbus-glib.h>
static GMainLoop *main_loop = NULL;
static SignonIdentity *identity = NULL;