if (self->priv->parent) {
g_signal_handler_disconnect (self->priv->parent, self->priv->state_changed_handler_id);
}
- self->priv->parent = GSIGNOND_AUTH_SESSION_IFACE (g_object_ref (iface));
+ self->priv->parent = GSIGNOND_AUTH_SESSION_IFACE (iface);
self->priv->state_changed_handler_id =
g_signal_connect (self->priv->parent, "state-changed",
G_CALLBACK (_emit_state_changed), self);
switch (property_id) {
case PROP_IMPL: {
- g_value_set_instance (value, self->priv->parent);
+ g_value_set_pointer (value, self->priv->parent);
break;
}
default:
g_signal_handler_disconnect (self->priv->parent, self->priv->process_error_handler_id);
if (self->priv->process_result_handler_id)
g_signal_handler_disconnect (self->priv->parent, self->priv->process_result_handler_id);
-
- g_object_unref (self->priv->parent);
- self->priv->parent = NULL;
}
if (self->priv->connection) {
{
GSignondDbusAuthSessionAdapter *self = GSIGNOND_DBUS_AUTH_SESSION_ADAPTER (object);
- g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (object));
-
if (self->priv->parent) {
self->priv->parent = NULL;
}
+ DBG("(-)'%s' object unexported", g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON(object)));
+ g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (object));
+
G_OBJECT_CLASS (gsignond_dbus_auth_session_adapter_parent_class)->finalize (object);
}
g_free (object_path);
return ;
}
-
+ DBG("(+) '%s' object exported", object_path);
g_free (object_path);
g_signal_connect (self, "handle-query-available-mechanisms", G_CALLBACK (_handle_query_available_mechanisms), NULL);
{
GDBusConnection *connection;
GSignondIdentityIface *identity;
- gchar *object_path;
gchar *app_context;
GSignondSecurityContext sec_context;
/* signal handler ids */
{
GSignondDbusIdentityAdapter *self = GSIGNOND_DBUS_IDENTITY_ADAPTER (object);
- g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (object));
-
- if (self->priv->object_path) {
- g_free (self->priv->object_path);
- self->priv->object_path = NULL;
- }
-
if (self->priv->app_context) {
g_free (self->priv->app_context);
self->priv->app_context = NULL;
self->priv->identity = NULL;
}
+ DBG("(-)'%s' object unexported", g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON(object)));
+ g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (object));
+
G_OBJECT_CLASS (gsignond_dbus_identity_adapter_parent_class)->finalize (object);
}
g_free (object_path);
return ;
}
+ DBG("(+)'%s' object exported", object_path);
g_free (object_path);
g_signal_connect (self, "handle-request-credentials-update", G_CALLBACK (_handle_request_credentials_update), NULL);
#include "gsignond-auth-session-iface.h"
#include "gsignond/gsignond-error.h"
#include "gsignond/gsignond-log.h"
+#include "gsignond/gsignond-session-data.h"
+#include "gsignond/gsignond-identity-info.h"
#include "dbus/gsignond-dbus.h"
#include "dbus/gsignond-dbus-auth-session-adapter.h"
#include "gsignond-auth-session.h"
GSignondDbusAuthSessionAdapter *session_adapter;
GSignondPluginProxy *proxy;
GSequence *plugin_mechanisms;
+ GSignondIdentityInfo *identity_info;
};
static void gsignond_auth_session_iface_init (gpointer g_iface);
const gchar **wanted_mechanisms,
GError **error)
{
- if (G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0)) {
+ if (!iface || !GSIGNOND_IS_AUTH_SESSION (iface)) {
WARN ("assertion G_LIKELY ((iface && GSIGNOND_IS_AUTH_SESSION (iface)) == 0) failed");
if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Unknown error");
return NULL;
iter = mechanisms;
for (src_iter = wanted_mechanisms; *src_iter != NULL; src_iter++) {
GSequenceIter *pos = g_sequence_lookup (self->priv->plugin_mechanisms,
- *src_iter,
+ (gpointer)*src_iter,
_sort_cmp,
NULL);
if (pos) {
}
GSignondAuthSession *self = GSIGNOND_AUTH_SESSION (iface);
+ if (session_data &&
+ !gsignond_session_data_get_username (session_data)
+ && self->priv->identity_info) {
+ const gchar *username = gsignond_identity_info_get_username (self->priv->identity_info);
+
+ if (username) {
+ gsignond_session_data_set_username (session_data, username);
+ }
+ }
+
gsignond_plugin_proxy_process(self->priv->proxy, iface, session_data,
mechanism);
self->priv->proxy = NULL;
}
+ if (self->priv->identity_info) {
+ g_hash_table_unref ((GHashTable *)self->priv->identity_info);
+ self->priv->identity_info = NULL;
+ }
+
G_OBJECT_CLASS (gsignond_auth_session_parent_class)->dispose (object);
}
/**
* gsignond_auth_session_new:
- * @owner: instance of #GSignondIdentityIface
+ * @info: instance of #GSignondIdentityInfo
+ * @app_context: application security
* @method: authentication method
*
* Creates instance of #GSignondAuthSession.
* Returns: (transfer full) newly created object
*/
GSignondAuthSession *
-gsignond_auth_session_new (gint id, const gchar *method)
+gsignond_auth_session_new (GSignondIdentityInfo *info, const gchar *app_context, const gchar *method, gint timeout)
{
GSignondPluginProxy* proxy;
+ guint id = 0;
+
+ if (info) id = gsignond_identity_info_get_id (info);
if (id == 0) {
proxy = gsignond_plugin_proxy_new(gsignond_get_config(), method);
if (!proxy) return NULL;
g_object_ref(proxy);
}
-
+
GSignondAuthSession *auth_session =
- g_object_new (GSIGNOND_TYPE_AUTH_SESSION, "method", method, NULL);
+ g_object_new (GSIGNOND_TYPE_AUTH_SESSION, "method", method, "timeout", timeout, NULL);
auth_session->priv->proxy = proxy;
+ auth_session->priv->identity_info = g_hash_table_ref ((GHashTable *)info);
return auth_session;
}
#include <glib-object.h>
-#include "gsignond-identity-iface.h"
+#include <gsignond/gsignond-identity-info.h>
#include "gsignond-disposable.h"
G_BEGIN_DECLS
gboolean gsignond_auth_session_set_id(GSignondAuthSession *session, gint id);
GSignondAuthSession *
-gsignond_auth_session_new (gint id,
- const gchar *method);
+gsignond_auth_session_new (GSignondIdentityInfo *info,
+ const gchar *app_context,
+ const gchar *method,
+ gint timeout);
G_END_DECLS
#include "gsignond-auth-session.h"
#include "plugins/gsignond-plugin-proxy-factory.h"
#include "gsignond-daemon.h"
+#include "gsignond/gsignond-config-dbus.h"
enum
{
{
GSignondIdentity *identity = GSIGNOND_IDENTITY (data);
- g_object_weak_unref (session, _on_session_close, data);
-
identity->priv->auth_sessions = g_list_remove (identity->priv->auth_sessions, session);
if (g_list_length (identity->priv->auth_sessions) == 0) {
const gchar *object_path = NULL;
GHashTable *supported_methods = NULL;
gboolean method_available = FALSE;
+ gchar *app_context = NULL;
+ gint timeout = 0;
if (!method) {
WARN ("assertion (method) failed");
VALIDATE_IDENTITY_READ_ACCESS (identity, ctx, NULL);
- session = gsignond_auth_session_new (gsignond_identity_info_get_id(
- identity->priv->info), method);
+ timeout = gsignond_config_get_integer (gsignond_get_config(), GSIGNOND_CONFIG_DBUS_AUTH_SESSION_TIMEOUT);
+ g_object_get (identity->priv->identity_adapter, "app-context", &app_context, NULL);
+ session = gsignond_auth_session_new (identity->priv->info,
+ app_context,
+ method,
+ timeout);
+ g_free (app_context);
if (!session) {
if (error) *error = gsignond_get_gerror_for_id (GSIGNOND_ERROR_UNKNOWN, "Unknown error");