diff options
author | Imran Zaman <imran.zaman@intel.com> | 2013-06-14 16:30:56 +0300 |
---|---|---|
committer | Imran Zaman <imran.zaman@intel.com> | 2013-06-14 16:30:56 +0300 |
commit | f03389054fb6aa786f9d82b77e7b3113fdbbe345 (patch) | |
tree | fbff5bca740905f1eb2ffd60802a4162415547a4 /include | |
parent | 75d5b6ec568d8ae9d54da087d20cfc6b47cf666b (diff) | |
download | gsignond-f03389054fb6aa786f9d82b77e7b3113fdbbe345.tar.gz gsignond-f03389054fb6aa786f9d82b77e7b3113fdbbe345.tar.bz2 gsignond-f03389054fb6aa786f9d82b77e7b3113fdbbe345.zip |
gsignond first release 0.0.1
Diffstat (limited to 'include')
19 files changed, 2090 insertions, 0 deletions
diff --git a/include/gsignond/gsignond-access-control-manager.h b/include/gsignond/gsignond-access-control-manager.h new file mode 100644 index 0000000..54116b3 --- /dev/null +++ b/include/gsignond/gsignond-access-control-manager.h @@ -0,0 +1,155 @@ +/* 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 gsignond + * + * Copyright (C) 2012-2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 _GSIGNOND_ACCESS_CONTROL_MANAGER_H_ +#define _GSIGNOND_ACCESS_CONTROL_MANAGER_H_ + +#include <glib-object.h> + +#include <gsignond/gsignond-config.h> +#include <gsignond/gsignond-security-context.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER \ + (gsignond_access_control_manager_get_type ()) +#define GSIGNOND_ACCESS_CONTROL_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER, \ + GSignondAccessControlManager)) +#define GSIGNOND_IS_ACCESS_CONTROL_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER)) +#define GSIGNOND_ACCESS_CONTROL_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER, \ + GSignondAccessControlManagerClass)) +#define GSIGNOND_IS_ACCESS_CONTROL_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER)) +#define GSIGNOND_ACCESS_CONTROL_MANAGER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER, \ + GSignondAccessControlManagerClass)) + +typedef struct _GSignondAccessControlManager + GSignondAccessControlManager; +typedef struct _GSignondAccessControlManagerClass + GSignondAccessControlManagerClass; +typedef struct _GSignondAccessControlManagerPrivate + GSignondAccessControlManagerPrivate; + +struct _GSignondAccessControlManager +{ + GObject parent_instance; + GSignondConfig *config; + + /* private */ + GSignondAccessControlManagerPrivate *priv; +}; + +struct _GSignondAccessControlManagerClass +{ + GObjectClass parent_class; + + /** + * security_context_of_peer: + * + * See #gsignond_access_control_manager_security_context_of_peer. + */ + void (*security_context_of_peer) ( + GSignondAccessControlManager *self, + GSignondSecurityContext *peer_ctx, + int peer_fd, const gchar *peer_service, + const gchar *peer_app_ctx); + /** + * peer_is_allowed_to_use_identity: + * + * See #gsignond_access_control_manager_peer_is_allowed_to_use_identity. + */ + gboolean (*peer_is_allowed_to_use_identity) ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *owner_ctx, + const GSignondSecurityContextList *identity_acl); + /** + * peer_is_owner_of_identity: + * + * See #gsignond_access_control_manager_peer_is_owner_of_identity. + */ + gboolean (*peer_is_owner_of_identity) ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *owner_ctx); + /** + * acl_is_valid: + * + * See #gsignond_access_control_manager_acl_is_valid. + */ + gboolean (*acl_is_valid) ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContextList *identity_acl); + /** + * security_context_of_keychain: + * + * See #gsignond_access_control_manager_security_context_of_keychain. + */ + GSignondSecurityContext * (*security_context_of_keychain) ( + GSignondAccessControlManager *self); +}; + +GType gsignond_access_control_manager_get_type (); + +void +gsignond_access_control_manager_security_context_of_peer ( + GSignondAccessControlManager *self, + GSignondSecurityContext *peer_ctx, + int peer_fd, const gchar *peer_service, + const gchar *peer_app_ctx); + +gboolean +gsignond_access_control_manager_peer_is_allowed_to_use_identity ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *owner_ctx, + const GSignondSecurityContextList *identity_acl); + +gboolean +gsignond_access_control_manager_peer_is_owner_of_identity ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *owner_ctx); + +gboolean +gsignond_access_control_manager_acl_is_valid ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContextList *identity_acl); + +GSignondSecurityContext * +gsignond_access_control_manager_security_context_of_keychain ( + GSignondAccessControlManager *self); + + +G_END_DECLS + +#endif /* _GSIGNOND_ACCESS_CONTROL_MANAGER_H_ */ + diff --git a/include/gsignond/gsignond-config-db.h b/include/gsignond/gsignond-config-db.h new file mode 100644 index 0000000..28ae6b9 --- /dev/null +++ b/include/gsignond/gsignond-config-db.h @@ -0,0 +1,35 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_CONFIG_DB_H_ +#define __GSIGNOND_CONFIG_DB_H_ + +#define GSIGNOND_CONFIG_DB_SSO "Storage" +#define GSIGNOND_CONFIG_DB_SECRET_DB_FILENAME GSIGNOND_CONFIG_DB_SSO \ + "/SecretDBFilename" +#define GSIGNOND_CONFIG_DB_METADATA_DB_FILENAME GSIGNOND_CONFIG_DB_SSO \ + "/MetadataDBFilename" + +#endif /* __GSIGNOND_DB_CONFIG_H_ */ diff --git a/include/gsignond/gsignond-config-dbus.h b/include/gsignond/gsignond-config-dbus.h new file mode 100644 index 0000000..2423b4d --- /dev/null +++ b/include/gsignond/gsignond-config-dbus.h @@ -0,0 +1,37 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_CONFIG_DBUS_H_ +#define __GSIGNOND_CONFIG_DBUS_H_ + +#define GSIGNOND_CONFIG_DBUS_TIMEOUTS "ObjectTimeouts" + +#define GSIGNOND_CONFIG_DBUS_DAEMON_TIMEOUT GSIGNOND_CONFIG_DBUS_TIMEOUTS \ + "/DaemonTimeout" +#define GSIGNOND_CONFIG_DBUS_IDENTITY_TIMEOUT GSIGNOND_CONFIG_DBUS_TIMEOUTS \ + "/IdentityTimeout" +#define GSIGNOND_CONFIG_DBUS_AUTH_SESSION_TIMEOUT GSIGNOND_CONFIG_DBUS_TIMEOUTS \ + "/AuthSessionTimeout" +#endif /* __GSIGNOND_CONFIG_DBUS_H_ */ diff --git a/include/gsignond/gsignond-config-general.h b/include/gsignond/gsignond-config-general.h new file mode 100644 index 0000000..31419cd --- /dev/null +++ b/include/gsignond/gsignond-config-general.h @@ -0,0 +1,45 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_CONFIG_GENERAL_H_ +#define __GSIGNOND_CONFIG_GENERAL_H_ + +#define GSIGNOND_CONFIG_GENERAL "General" +#define GSIGNOND_CONFIG_GENERAL_STORAGE_PATH GSIGNOND_CONFIG_GENERAL \ + "/StoragePath" +#define GSIGNOND_CONFIG_GENERAL_EXTENSIONS_DIR GSIGNOND_CONFIG_GENERAL \ + "/ExtensionsDir" +#define GSIGNOND_CONFIG_GENERAL_PLUGINS_DIR GSIGNOND_CONFIG_GENERAL \ + "/PluginsDir" +#define GSIGNOND_CONFIG_GENERAL_BIN_DIR GSIGNOND_CONFIG_GENERAL \ + "/BinDir" +#define GSIGNOND_CONFIG_GENERAL_EXTENSION GSIGNOND_CONFIG_GENERAL \ + "/Extension" +#define GSIGNOND_CONFIG_GENERAL_SECURE_DIR GSIGNOND_CONFIG_GENERAL \ + "/SecureDir" +#define GSIGNOND_CONFIG_PLUGIN_TIMEOUT GSIGNOND_CONFIG_GENERAL \ + "/PluginTimeout" + +#endif /* __GSIGNOND_GENERAL_CONFIG_H_ */ diff --git a/include/gsignond/gsignond-config.h b/include/gsignond/gsignond-config.h new file mode 100644 index 0000000..2b779f6 --- /dev/null +++ b/include/gsignond/gsignond-config.h @@ -0,0 +1,81 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_CONFIG_H_ +#define __GSIGNOND_CONFIG_H_ + +#include <glib.h> +#include <glib-object.h> + +#include "gsignond-config-general.h" +#include "gsignond-config-db.h" +#include "gsignond-config-dbus.h" + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_CONFIG (gsignond_config_get_type()) +#define GSIGNOND_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GSIGNOND_TYPE_CONFIG, GSignondConfig)) +#define GSIGNOND_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GSIGNOND_TYPE_CONFIG, GSignondConfigClass)) +#define GSIGNOND_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GSIGNOND_TYPE_CONFIG)) +#define GSIGNOND_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GSIGNOND_TYPE_CONFIG)) +#define GSIGNOND_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSIGNOND_TYPE_CONFIG, GSignondConfigClass)) + +typedef struct _GSignondConfig GSignondConfig; +typedef struct _GSignondConfigClass GSignondConfigClass; +typedef struct _GSignondConfigPrivate GSignondConfigPrivate; + +struct _GSignondConfig +{ + GObject parent; + + /* priv */ + GSignondConfigPrivate *priv; +}; + +struct _GSignondConfigClass +{ + GObjectClass parent_class; +}; + +GType gsignond_config_get_type (void) G_GNUC_CONST; + +GSignondConfig * gsignond_config_new (); + +gint +gsignond_config_get_integer (GSignondConfig *config, const gchar *key); + +void +gsignond_config_set_integer (GSignondConfig *config, const gchar *key, + gint value) ; +const gchar* +gsignond_config_get_string (GSignondConfig *config, const gchar *key); + +void +gsignond_config_set_string (GSignondConfig *config, const gchar *key, + const gchar *value); + +G_END_DECLS + +#endif /* __GSIGNOND_CONFIG_H_ */ diff --git a/include/gsignond/gsignond-credentials.h b/include/gsignond/gsignond-credentials.h new file mode 100644 index 0000000..1bd009e --- /dev/null +++ b/include/gsignond/gsignond-credentials.h @@ -0,0 +1,112 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Imran Zaman <imran.zaman@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_CREDENTIALS_H__ +#define __GSIGNOND_CREDENTIALS_H__ + +#include <glib.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_CREDENTIALS \ + (gsignond_credentials_get_type ()) +#define GSIGNOND_CREDENTIALS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GSIGNOND_TYPE_CREDENTIALS, \ + GSignondCredentials)) +#define GSIGNOND_IS_CREDENTIALS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + GSIGNOND_TYPE_CREDENTIALS)) +#define GSIGNOND_CREDENTIALS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + GSIGNOND_TYPE_CREDENTIALS, \ + GSignondCredentialsClass)) +#define GSIGNOND_IS_CREDENTIALS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + GSIGNOND_TYPE_CREDENTIALS)) +#define GSIGNOND_CREDENTIALS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + GSIGNOND_TYPE_CREDENTIALS, \ + GSignondCredentialsClass)) + +typedef struct _GSignondCredentialsPrivate GSignondCredentialsPrivate; + +typedef struct { + GObject parent_instance; + + /*< private >*/ + GSignondCredentialsPrivate *priv; +} GSignondCredentials; + +typedef struct { + GObjectClass parent_class; + +} GSignondCredentialsClass; + +/* used by GSIGNOND_TYPE_CREDENTIALS */ +GType +gsignond_credentials_get_type (void); + +GSignondCredentials * +gsignond_credentials_new (); + +gboolean +gsignond_credentials_set_data( + GSignondCredentials *self, + const guint32 id, + const gchar* username, + const gchar* password); + +gboolean +gsignond_credentials_set_id( + GSignondCredentials *self, + const guint32 id); + +guint32 +gsignond_credentials_get_id(GSignondCredentials *self); + +gboolean +gsignond_credentials_set_username( + GSignondCredentials *self, + const gchar* username); + +const gchar* +gsignond_credentials_get_username(GSignondCredentials *self); + +gboolean +gsignond_credentials_set_password( + GSignondCredentials *self, + const gchar* password); + +const gchar* +gsignond_credentials_get_password(GSignondCredentials *self); + +gboolean +gsignond_credentials_equal ( + GSignondCredentials *one, + GSignondCredentials *two); + +G_END_DECLS + +#endif /* __GSIGNOND_CREDENTIALS_H__ */ diff --git a/include/gsignond/gsignond-dictionary.h b/include/gsignond/gsignond-dictionary.h new file mode 100644 index 0000000..e5f951b --- /dev/null +++ b/include/gsignond/gsignond-dictionary.h @@ -0,0 +1,124 @@ +/* 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 gsignond + * + * Copyright (C) 2012-2013 Intel Corporation. + * + * Contact: Alexander Kanavin <alex.kanavin@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_DICTIONARY_H__ +#define __GSIGNOND_DICTIONARY_H__ + +#include <glib.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_DICTIONARY (G_TYPE_HASH_TABLE) + +#define GSIGNOND_DICTIONARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GSIGNOND_TYPE_DICTIONARY, \ + GSignondDictionary)) +#define GSIGNOND_IS_DICTIONARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\ + GSIGNOND_TYPE_DICTIONARY)) + +typedef GHashTable GSignondDictionary; + +GType +gsignond_dictionary_get_type (void); + +GSignondDictionary * +gsignond_dictionary_new (void); + +void +gsignond_dictionary_ref (GSignondDictionary *dict); + +void +gsignond_dictionary_unref (GSignondDictionary *dict); + +GSignondDictionary * +gsignond_dictionary_copy (GSignondDictionary *other); + +GSignondDictionary * +gsignond_dictionary_new_from_variant (GVariant *variant); + +GVariant * +gsignond_dictionary_to_variant (GSignondDictionary *self); + +GVariant * +gsignond_dictionary_get (GSignondDictionary *dict, const gchar *key); + +gboolean +gsignond_dictionary_set (GSignondDictionary *dict, + const gchar *key, GVariant *value); + +gboolean +gsignond_dictionary_get_boolean (GSignondDictionary *dict, const gchar *key, + gboolean *value); + +gboolean +gsignond_dictionary_set_boolean (GSignondDictionary *dict, const gchar *key, + gboolean value); + +gboolean +gsignond_dictionary_get_int32 (GSignondDictionary *dict, const gchar *key, + gint *value); + +gboolean +gsignond_dictionary_set_int32 (GSignondDictionary *dict, const gchar *key, + gint value); + +gboolean +gsignond_dictionary_get_uint32 (GSignondDictionary *dict, const gchar *key, + guint *value); + +gboolean +gsignond_dictionary_set_uint32 (GSignondDictionary *dict, const gchar *key, + guint32 value); + +gboolean +gsignond_dictionary_get_int64 (GSignondDictionary *dict, const gchar *key, + gint64 *value); + +gboolean +gsignond_dictionary_set_int64 (GSignondDictionary *dict, const gchar *key, + gint64 value); + +gboolean +gsignond_dictionary_get_uint64 (GSignondDictionary *dict, const gchar *key, + guint64 *value); + +gboolean +gsignond_dictionary_set_uint64 (GSignondDictionary *dict, const gchar *key, + guint64 value); + +const gchar * +gsignond_dictionary_get_string (GSignondDictionary *dict, const gchar *key); + +gboolean +gsignond_dictionary_set_string (GSignondDictionary *dict, const gchar *key, + const gchar *value); + +gboolean +gsignond_dictionary_remove (GSignondDictionary *dict, const gchar *key); + +G_END_DECLS + +#endif /* __GSIGNOND_DICTIONARY_H__ */ diff --git a/include/gsignond/gsignond-error.h b/include/gsignond/gsignond-error.h new file mode 100644 index 0000000..aa94b29 --- /dev/null +++ b/include/gsignond/gsignond-error.h @@ -0,0 +1,133 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Imran Zaman <imran.zaman@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 + */ + +/* inclusion guard */ +#ifndef __GSIGNOND_ERROR_H__ +#define __GSIGNOND_ERROR_H__ + +#include <glib.h> + +G_BEGIN_DECLS + +#define GSIGNOND_ERROR_DOMAIN "gsignond" + +/** + * GSIGNOND_ERROR: + * + */ +#define GSIGNOND_ERROR (gsignond_error_quark()) + +typedef enum { + GSIGNOND_ERROR_NONE, + + GSIGNOND_ERROR_UNKNOWN = 1, /**< Catch-all for errors not distinguished by another code. */ + GSIGNOND_ERROR_INTERNAL_SERVER = 2, /**< Signon Daemon internal error. */ + GSIGNOND_ERROR_INTERNAL_COMMUNICATION = 3, /**< Communication with Signon Daemon error. */ + GSIGNOND_ERROR_PERMISSION_DENIED = 4, /**< The operation cannot be performed due to insufficient client permissions. */ + GSIGNOND_ERROR_ENCRYPTION_FAILURE, /**< Failure during data encryption/decryption. */ + + GSIGNOND_ERROR_AUTH_SERVICE_ERR = 100, /* Placeholder to rearrange enumeration - AuthService specific */ + GSIGNOND_ERROR_METHOD_NOT_KNOWN, /**< The method with this name is not found. */ + GSIGNOND_ERROR_SERVICE_NOT_AVAILABLE, /**< The service is temporarily unavailable. */ + GSIGNOND_ERROR_INVALID_QUERY, /**< Parameters for the query are invalid. */ + + GSIGNOND_ERROR_IDENTITY_ERR = 200, /* Placeholder to rearrange enumeration - Identity specific */ + GSIGNOND_ERROR_METHOD_NOT_AVAILABLE, /**< The requested method is not available. */ + GSIGNOND_ERROR_IDENTITY_NOT_FOUND, /**< The identity matching this Identity object was not found on the service. */ + GSIGNOND_ERROR_STORE_FAILED, /**< Storing credentials failed. */ + GSIGNOND_ERROR_REMOVE_FAILED, /**< Removing credentials failed. */ + GSIGNOND_ERROR_SIGN_OUT_FAILED, /**< SignOut failed. */ + GSIGNOND_ERROR_IDENTITY_OPERATION_CANCELED, /**< Identity operation was canceled by user. */ + GSIGNOND_ERROR_CREDENTIALS_NOT_AVAILABLE, /**< Query failed. */ + GSIGNOND_ERROR_REFERENCE_NOT_FOUND, /**< Trying to remove nonexistent reference. */ + + GSIGNOND_ERROR_AUTH_SESSION_ERR = 300, /* Placeholder to rearrange enumeration - AuthSession/PluginInterface specific */ + GSIGNOND_ERROR_MECHANISM_NOT_AVAILABLE, /**< The requested mechanism is not available. */ + GSIGNOND_ERROR_MISSING_DATA, /**< The SessionData object does not contain necessary information. */ + GSIGNOND_ERROR_INVALID_CREDENTIALS, /**< The supplied credentials are invalid for the mechanism implementation. */ + GSIGNOND_ERROR_NOT_AUTHORIZED, /**< Authorization failed. */ + GSIGNOND_ERROR_WRONG_STATE, /**< An operation method has been called in a wrong state. */ + GSIGNOND_ERROR_OPERATION_NOT_SUPPORTED, /**< The operation is not supported by the mechanism implementation. */ + GSIGNOND_ERROR_NO_CONNECTION, /**< No Network connetion. */ + GSIGNOND_ERROR_NETWORK, /**< Network connetion failed. */ + GSIGNOND_ERROR_SSL, /**< Ssl connection failed. */ + GSIGNOND_ERROR_RUNTIME, /**< Casting SessionData into subclass failed */ + GSIGNOND_ERROR_SESSION_CANCELED, /**< Challenge was cancelled. */ + GSIGNOND_ERROR_TIMED_OUT, /**< Challenge was timed out. */ + GSIGNOND_ERROR_USER_INTERACTION, /**< User interaction dialog failed */ + GSIGNOND_ERROR_OPERATION_FAILED, /**< Temporary failure in authentication. */ + GSIGNOND_ERROR_ENCRYPTION_FAILED, /**< @deprecated Failure during data encryption/decryption. */ + GSIGNOND_ERROR_TOS_NOT_ACCEPTED, /**< User declined Terms of Service. */ + GSIGNOND_ERROR_FORGOT_PASSWORD, /**< User requested reset password sequence. */ + GSIGNOND_ERROR_METHOD_OR_MECHANISM_NOT_ALLOWED, /**< Method or mechanism not allowed for this identity. */ + GSIGNOND_ERROR_INCORRECT_DATE, /**< Date time incorrect on device. */ + + GSIGNOND_ERROR_USER_ERR = 400 /* Placeholder to rearrange enumeration - User space specific */ + +} GSignondError; + +#define gsignond_gerr(error, handler) \ + G_STMT_START { \ + GString* msg = gsignond_prepend_domain_to_error_msg(error); \ + handler(msg->str); \ + g_string_free(msg, TRUE); \ + } G_STMT_END\ + +#define gsignond_error_gerr(err) gsignond_gerr(err, g_error) + +#define gsignond_critical_gerr(err) gsignond_gerr(err, g_critical) + +#define gsignond_warning_gerr(err) gsignond_gerr(err, g_warning) + +#define gsignond_message_gerr(err) gsignond_gerr(err, g_message) + +#define gsignond_debug_gerr(err) gsignond_gerr(err, g_debug) + +GQuark +gsignond_error_quark (void); + +GString* +gsignond_concat_domain_and_error ( + const gchar *str1, + const gchar *str2); + +GString* +gsignond_prepend_domain_to_error_msg ( + const GError *err); + +GError * +gsignond_error_new_from_variant ( + GVariant *var); + +GVariant * +gsignond_error_to_variant ( + GError *error); + +#define gsignond_get_gerror_for_id(err, message, args...) \ + g_error_new (gsignond_error_quark(), err, message, ##args); + +G_END_DECLS + +#endif /* __GSIGNOND_ERROR_H__ */ diff --git a/include/gsignond/gsignond-extension-interface.h b/include/gsignond/gsignond-extension-interface.h new file mode 100644 index 0000000..1299093 --- /dev/null +++ b/include/gsignond/gsignond-extension-interface.h @@ -0,0 +1,148 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 _GSIGNOND_EXTENSION_INTERFACE_H_ +#define _GSIGNOND_EXTENSION_INTERFACE_H_ + +#include <glib-object.h> + +#include <gsignond/gsignond-config.h> +#include <gsignond/gsignond-storage-manager.h> +#include <gsignond/gsignond-secret-storage.h> +#include <gsignond/gsignond-access-control-manager.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_EXTENSION \ + (gsignond_extension_get_type ()) +#define GSIGNOND_EXTENSION(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSIGNOND_TYPE_EXTENSION, \ + GSignondExtension)) +#define GSIGNOND_IS_EXTENSION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSIGNOND_TYPE_EXTENSION)) +#define GSIGNOND_EXTENSION_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GSIGNOND_TYPE_EXTENSION, \ + GSignondExtensionClass)) +#define GSIGNOND_IS_EXTENSION_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GSIGNOND_TYPE_EXTENSION)) +#define GSIGNOND_EXTENSION_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GSIGNOND_TYPE_EXTENSION, \ + GSignondExtensionClass)) + +typedef struct _GSignondExtension GSignondExtension; +typedef struct _GSignondExtensionClass GSignondExtensionClass; +typedef struct _GSignondExtensionPrivate GSignondExtensionPrivate; +typedef GSignondExtension * (*GSignondExtensionInit) (void); + +struct _GSignondExtension +{ + GObject parent_instance; + GSignondExtensionPrivate *priv; +}; + +struct _GSignondExtensionClass +{ + GObjectClass parent_class; + + /** + * get_extension_name: + * @self: object instance. + * + * Get human readable name of the extension. + * + * Returns: (transfer none) name of the extension. + */ + const gchar * (*get_extension_name) (GSignondExtension *self); + /** + * get_extension_version: + * @self: object instance. + * + * Get version of the extension, split into four bytes in order from MSB + * to LSB; major, minor, patchlevel, build. + */ + guint32 (*get_extension_version) (GSignondExtension *self); + /** + * get_storage_manager: + * @self: object instance. + * @config: configuration object instance. + * + * Factory method to get a singleton storage manager object. + * + * Returns: storage manager object instance. + */ + GSignondStorageManager * (*get_storage_manager) (GSignondExtension *self, + GSignondConfig *config); + /** + * get_secret_storage: + * @self: object instance. + * @config: configuration object instance. + * + * Factory method to get a singleton secret storage object. + * + * Returns: secret storage object instance. + */ + GSignondSecretStorage * (*get_secret_storage) (GSignondExtension *self, + GSignondConfig *config); + /** + * get_access_control_manager: + * @self: object instance. + * @config: configuration object instance. + * + * Factory method to get a singleton access control manager object. + * + * Returns: access control manager object instance. + */ + GSignondAccessControlManager * (*get_access_control_manager) ( + GSignondExtension *self, + GSignondConfig *config); +}; + +GType gsignond_extension_get_type (); + +const gchar * +gsignond_extension_get_name (GSignondExtension *self); + +guint32 +gsignond_extension_get_version (GSignondExtension *self); + +GSignondStorageManager * +gsignond_extension_get_storage_manager (GSignondExtension *self, + GSignondConfig *config); + +GSignondSecretStorage * +gsignond_extension_get_secret_storage (GSignondExtension *self, + GSignondConfig *config); + +GSignondAccessControlManager * +gsignond_extension_get_access_control_manager (GSignondExtension *self, + GSignondConfig *config); + +GSignondExtension * +default_extension_init (); + +G_END_DECLS + +#endif /* _GSIGNOND_EXTENSION_INTERFACE_H_ */ + diff --git a/include/gsignond/gsignond-identity-info.h b/include/gsignond/gsignond-identity-info.h new file mode 100644 index 0000000..be6d318 --- /dev/null +++ b/include/gsignond/gsignond-identity-info.h @@ -0,0 +1,187 @@ +/* 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 gsignond + * + * Copyright (C) 2012-2013 Intel Corporation. + * + * Contact: Imran Zaman <imran.zaman@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_IDENTITY_INFO_H__ +#define __GSIGNOND_IDENTITY_INFO_H__ + +#include <glib.h> +#include <glib-object.h> +#include <gsignond/gsignond-security-context.h> +#include <gsignond/gsignond-dictionary.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_IDENTITY_INFO (GSIGNOND_TYPE_DICTIONARY) + +#define GSIGNOND_IDENTITY_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GSIGNOND_TYPE_IDENTITY_INFO, \ + GSignondIdentityInfo)) +#define GSIGNOND_IS_IDENTITY_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\ + GSIGNOND_TYPE_IDENTITY_INFO)) + +typedef GSignondDictionary GSignondIdentityInfo; +typedef GList GSignondIdentityInfoList; + +GSignondIdentityInfo * +gsignond_identity_info_new (void); + +GSignondIdentityInfo * +gsignond_identity_info_copy (GSignondIdentityInfo *info); + +void +gsignond_identity_info_ref (GSignondIdentityInfo *info); + +void +gsignond_identity_info_unref (GSignondIdentityInfo *info); + +guint32 +gsignond_identity_info_get_id (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_id ( + GSignondIdentityInfo *info, + guint32 id); + +gboolean +gsignond_identity_info_get_is_identity_new (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_identity_new (GSignondIdentityInfo *info); + +const gchar * +gsignond_identity_info_get_username (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_username ( + GSignondIdentityInfo *info, + const gchar *username); + +void +gsignond_identity_info_remove_username (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_get_is_username_secret (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_username_secret ( + GSignondIdentityInfo *info, + gboolean username_secret); + +const gchar * +gsignond_identity_info_get_secret (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_secret ( + GSignondIdentityInfo *info, + const gchar *secret); + +void +gsignond_identity_info_remove_secret (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_get_store_secret (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_store_secret ( + GSignondIdentityInfo *info, + gboolean store_secret); + +const gchar * +gsignond_identity_info_get_caption (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_caption ( + GSignondIdentityInfo *info, + const gchar *caption); + +GSequence * +gsignond_identity_info_get_realms (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_realms ( + GSignondIdentityInfo *info, + GSequence *realms); + +GHashTable * +gsignond_identity_info_get_methods (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_methods ( + GSignondIdentityInfo *info, + GHashTable *methods); + +GSequence * +gsignond_identity_info_get_mechanisms ( + GSignondIdentityInfo *info, + const gchar *method); + +gboolean +gsignond_identity_info_remove_method ( + GSignondIdentityInfo *info, + const gchar *method); + +GSignondSecurityContextList * +gsignond_identity_info_get_access_control_list (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_access_control_list ( + GSignondIdentityInfo *info, + const GSignondSecurityContextList *acl); + +GSignondSecurityContext * +gsignond_identity_info_get_owner (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_owner ( + GSignondIdentityInfo *info, + const GSignondSecurityContext *owner); + +gboolean +gsignond_identity_info_get_validated (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_validated ( + GSignondIdentityInfo *info, + gboolean validated); + +guint32 +gsignond_identity_info_get_identity_type (GSignondIdentityInfo *info); + +gboolean +gsignond_identity_info_set_identity_type ( + GSignondIdentityInfo *info, + guint32 type); + +gboolean +gsignond_identity_info_compare ( + GSignondIdentityInfo *info, + GSignondIdentityInfo *other); + +void +gsignond_identity_info_list_free (GSignondIdentityInfoList *list); + +G_END_DECLS + +#endif /* __GSIGNOND_IDENTITY_INFO_H__ */ diff --git a/include/gsignond/gsignond-log.h b/include/gsignond/gsignond-log.h new file mode 100644 index 0000000..88c1452 --- /dev/null +++ b/include/gsignond/gsignond-log.h @@ -0,0 +1,43 @@ +/* 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 gsignond + * + * Copyright (C) 2012-2013 Intel Corporation. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_LOG_H_ +#define __GSIGNOND_LOG_H_ + +#include <glib.h> + +#define INFO(frmt, args...) g_message("%f %s:%d %s " frmt , \ + g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \ + __PRETTY_FUNCTION__, ##args) +#define ERR(frmt, args...) g_critical("%f %s:%d %s " frmt , \ + g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \ + __PRETTY_FUNCTION__, ##args) +#define WARN(frmt, args...) g_warning("%f %s:%d %s " frmt , \ + g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \ + __PRETTY_FUNCTION__, ##args) +#define DBG(frmt, args...) g_debug("%f %s:%d %s " frmt , \ + g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \ + __PRETTY_FUNCTION__, ##args) + +#endif /* __GSIGNOND_LOG_H_ */ diff --git a/include/gsignond/gsignond-plugin-interface.h b/include/gsignond/gsignond-plugin-interface.h new file mode 100644 index 0000000..29bcdf2 --- /dev/null +++ b/include/gsignond/gsignond-plugin-interface.h @@ -0,0 +1,135 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Alexander Kanavin <alex.kanavin@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 _GSIGNOND_PLUGIN_H_ +#define _GSIGNOND_PLUGIN_H_ + +#include <glib.h> +#include <glib-object.h> +#include <gsignond/gsignond-session-data.h> +#include <gsignond/gsignond-signonui-data.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_PLUGIN (gsignond_plugin_get_type ()) +#define GSIGNOND_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSIGNOND_TYPE_PLUGIN, GSignondPlugin)) +#define GSIGNOND_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSIGNOND_TYPE_PLUGIN)) +#define GSIGNOND_PLUGIN_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GSIGNOND_TYPE_PLUGIN, GSignondPluginInterface)) + +typedef struct _GSignondPlugin GSignondPlugin; /* dummy object */ +typedef struct _GSignondPluginInterface GSignondPluginInterface; + +/** + * GSignondPluginState: + * @GSIGNOND_PLUGIN_STATE_NONE: State unknown + * @SIGNOND_PLUGIN_STATE_RESOLVING: Resolving remote server host name + * @GSIGNOND_PLUGIN_STATE_CONNECTING: Connecting to remote server + * @GSIGNOND_PLUGIN_STATE_SENDING_DATA: Sending data to remote server + * @GSIGNOND_PLUGIN_STATE_WAITING: Waiting for reply from remote server + * @GSIGNOND_PLUGIN_STATE_USER_PENDING: Waiting for response from user + * @GSIGNOND_PLUGIN_STATE_REFRESHING: Refreshing ui request + * @GSIGNOND_PLUGIN_STATE_PROCESS_PENDING: Request has been queued + * @GSIGNOND_PLUGIN_STATE_STARTED: Request has been dequeued + * @GSIGNOND_PLUGIN_STATE_CANCELING: Canceling current process + * @GSIGNOND_PLUGIN_STATE_DONE: Process is finished + * @GSIGNOND_PLUGIN_STATE_HOLDING: Holding long non-expired token + * @GSIGNOND_PLUGIN_STATE_CUSTOM: Custom message + */ +typedef enum { + GSIGNOND_PLUGIN_STATE_NONE = 0, + GSIGNOND_PLUGIN_STATE_RESOLVING, + GSIGNOND_PLUGIN_STATE_CONNECTING, + GSIGNOND_PLUGIN_STATE_SENDING_DATA, + GSIGNOND_PLUGIN_STATE_WAITING, + GSIGNOND_PLUGIN_STATE_USER_PENDING, + GSIGNOND_PLUGIN_STATE_REFRESHING, + GSIGNOND_PLUGIN_STATE_PROCESS_PENDING, + GSIGNOND_PLUGIN_STATE_STARTED, + GSIGNOND_PLUGIN_STATE_CANCELING, + GSIGNOND_PLUGIN_STATE_DONE, + GSIGNOND_PLUGIN_STATE_HOLDING, +} PluginState; +typedef PluginState GSignondPluginState; + +struct _GSignondPluginInterface { + GTypeInterface parent; + + void (*cancel) (GSignondPlugin *self); + void (*request_initial) (GSignondPlugin *self, + GSignondSessionData *session_data, + const gchar *mechanism); + void (*request) (GSignondPlugin *self, + GSignondSessionData *session_data); + void (*user_action_finished) (GSignondPlugin *self, + GSignondSignonuiData *session_data); + void (*refresh) (GSignondPlugin *self, + GSignondSignonuiData *session_data); +}; + +GType gsignond_plugin_get_type (void); + +/* Methods */ +void +gsignond_plugin_cancel (GSignondPlugin *self); +void +gsignond_plugin_request_initial (GSignondPlugin *self, + GSignondSessionData *session_data, + const gchar *mechanism); +void +gsignond_plugin_request (GSignondPlugin *self, + GSignondSessionData *session_data); +void +gsignond_plugin_user_action_finished (GSignondPlugin *self, + GSignondSignonuiData *ui_data); +void +gsignond_plugin_refresh (GSignondPlugin *self, + GSignondSignonuiData *ui_data); + +/* Signals */ +void +gsignond_plugin_response (GSignondPlugin *self, + GSignondSessionData *session_data); +void +gsignond_plugin_response_final (GSignondPlugin *self, + GSignondSessionData *session_data); +void +gsignond_plugin_store (GSignondPlugin *self, + GSignondDictionary *token_data); +void +gsignond_plugin_error (GSignondPlugin *self, GError *error); +void +gsignond_plugin_user_action_required (GSignondPlugin *self, + GSignondSignonuiData *ui_data); +void +gsignond_plugin_refreshed (GSignondPlugin *self, + GSignondSignonuiData *ui_data); +void +gsignond_plugin_status_changed (GSignondPlugin *self, + GSignondPluginState state, + const gchar *message); + +G_END_DECLS + +#endif /* _GSIGNOND_PLUGIN_H_ */ diff --git a/include/gsignond/gsignond-secret-storage.h b/include/gsignond/gsignond-secret-storage.h new file mode 100644 index 0000000..f424b8f --- /dev/null +++ b/include/gsignond/gsignond-secret-storage.h @@ -0,0 +1,249 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Imran Zaman <imran.zaman@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_SECRET_STORAGE_H__ +#define __GSIGNOND_SECRET_STORAGE_H__ + +#include <glib.h> +#include <glib-object.h> + +#include <gsignond/gsignond-config.h> +#include <gsignond/gsignond-credentials.h> + +G_BEGIN_DECLS + +/* + * Type macros. + */ +#define GSIGNOND_TYPE_SECRET_STORAGE \ + (gsignond_secret_storage_get_type ()) +#define GSIGNOND_SECRET_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GSIGNOND_TYPE_SECRET_STORAGE, \ + GSignondSecretStorage)) +#define GSIGNOND_IS_SECRET_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + GSIGNOND_TYPE_SECRET_STORAGE)) +#define GSIGNOND_SECRET_STORAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + GSIGNOND_TYPE_SECRET_STORAGE, \ + GSignondSecretStorageClass)) +#define GSIGNOND_IS_SECRET_STORAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + GSIGNOND_TYPE_SECRET_STORAGE)) +#define GSIGNOND_SECRET_STORAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + GSIGNOND_TYPE_SECRET_STORAGE, \ + GSignondSecretStorageClass)) + +typedef struct _GSignondSecretStoragePrivate GSignondSecretStoragePrivate; + +typedef struct { + GObject parent_instance; + + /*< private >*/ + GSignondConfig *config; + GSignondSecretStoragePrivate *priv; +} GSignondSecretStorage; + +typedef struct { + GObjectClass parent_class; + + /** + * open_db: + * + * See #gsignond_secret_storage_open_db. + */ + gboolean + (*open_db) (GSignondSecretStorage *self); + + /** + * close_db: + * + * See #gsignond_secret_storage_close_db. + */ + gboolean + (*close_db) (GSignondSecretStorage *self); + + /** + * clear_db: + * + * See #gsignond_secret_storage_clear_db. + */ + gboolean + (*clear_db) (GSignondSecretStorage *self); + + /** + * is_open_db: + * + * See #gsignond_secret_storage_is_open_db. + */ + gboolean + (*is_open_db) (GSignondSecretStorage *self); + + /** + * load_credentials: + * + * See #gsignond_secret_storage_load_credentials. + */ + GSignondCredentials* + (*load_credentials) ( + GSignondSecretStorage *self, + const guint32 id); + + /** + * update_credentials: + * + * See #gsignond_secret_storage_update_credentials. + */ + gboolean + (*update_credentials) ( + GSignondSecretStorage *self, + GSignondCredentials* creds); + + /** + * remove_credentials: + * + * See #gsignond_secret_storage_remove_credentials. + */ + gboolean + (*remove_credentials) ( + GSignondSecretStorage *self, + const guint32 id); + + /** + * check_credentials: + * + * See #gsignond_secret_storage_check_credentials. + */ + gboolean + (*check_credentials) ( + GSignondSecretStorage *self, + GSignondCredentials* creds); + + /** + * load_data: + * + * See #gsignond_secret_storage_load_data. + * + */ + GHashTable* + (*load_data) ( + GSignondSecretStorage *self, + const guint32 id, + const guint32 method); + + /** + * update_data: + * + * See #gsignond_secret_storage_update_data. + */ + gboolean + (*update_data) ( + GSignondSecretStorage *self, + const guint32 id, + const guint32 method, + GHashTable *data); + + /** + * remove_data: + * + * See #gsignond_secret_storage_remove_data. + */ + gboolean + (*remove_data) ( + GSignondSecretStorage *self, + const guint32 id, + const guint32 method); + +} GSignondSecretStorageClass; + +/* used by GSIGNOND_TYPE_SECRET_STORAGE */ +GType +gsignond_secret_storage_get_type (void); + +gboolean +gsignond_secret_storage_open_db (GSignondSecretStorage *self); + +gboolean +gsignond_secret_storage_close_db (GSignondSecretStorage *self); + +gboolean +gsignond_secret_storage_clear_db (GSignondSecretStorage *self); + +gboolean +gsignond_secret_storage_is_open_db (GSignondSecretStorage *self); + +GSignondCredentials* +gsignond_secret_storage_load_credentials ( + GSignondSecretStorage *self, + const guint32 id); + +gboolean +gsignond_secret_storage_update_credentials ( + GSignondSecretStorage *self, + GSignondCredentials* creds); + +gboolean +gsignond_secret_storage_remove_credentials ( + GSignondSecretStorage *self, + const guint32 id); + +gboolean +gsignond_secret_storage_check_credentials ( + GSignondSecretStorage *self, + GSignondCredentials* creds); + +GHashTable* +gsignond_secret_storage_load_data ( + GSignondSecretStorage *self, + const guint32 id, + const guint32 method); + +gboolean +gsignond_secret_storage_update_data ( + GSignondSecretStorage *self, + const guint32 id, + const guint32 method, + GHashTable *data); + +gboolean +gsignond_secret_storage_remove_data ( + GSignondSecretStorage *self, + const guint32 id, + const guint32 method); + +void +gsignond_secret_storage_set_last_error (GSignondSecretStorage *self, + GError *error); + +const GError* +gsignond_secret_storage_get_last_error (GSignondSecretStorage *self); + +void +gsignond_secret_storage_clear_last_error (GSignondSecretStorage *self); + + +G_END_DECLS + +#endif /* __GSIGNOND_SECRET_STORAGE_H__ */ diff --git a/include/gsignond/gsignond-security-context.h b/include/gsignond/gsignond-security-context.h new file mode 100644 index 0000000..828082f --- /dev/null +++ b/include/gsignond/gsignond-security-context.h @@ -0,0 +1,120 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 _GSIGNOND_SECURITY_CONTEXT_H_ +#define _GSIGNOND_SECURITY_CONTEXT_H_ + +#include <glib.h> + +G_BEGIN_DECLS + +/** + * Security context descriptor. + * + * Practically a string tuple. + * + * @sys_ctx: system context, such as SMACK-label, MSSF token or just a + * binary path. + * @app_ctx: application context, such as a script or a web page. + */ +typedef struct _GSignondSecurityContext +{ + gchar *sys_ctx; + gchar *app_ctx; +} GSignondSecurityContext; + +/** + * GList of #GSignondSecurityContext items. + */ +typedef GList GSignondSecurityContextList; + +GSignondSecurityContext * +gsignond_security_context_new (); + +GSignondSecurityContext * +gsignond_security_context_new_from_values (const gchar *system_context, + const gchar *application_context); + +void +gsignond_security_context_free (GSignondSecurityContext *ctx); + +GSignondSecurityContext * +gsignond_security_context_copy (const GSignondSecurityContext *src_ctx); + +void +gsignond_security_context_set_system_context (GSignondSecurityContext *ctx, + const gchar *system_context); + +const gchar * +gsignond_security_context_get_system_context ( + const GSignondSecurityContext *ctx); + +void +gsignond_security_context_set_application_context ( + GSignondSecurityContext *ctx, + const gchar *application_context); + +const gchar * +gsignond_security_context_get_application_context ( + const GSignondSecurityContext *ctx); + +GVariant * +gsignond_security_context_to_variant (const GSignondSecurityContext *ctx); + +GSignondSecurityContext * +gsignond_security_context_from_variant (GVariant *variant); + +int +gsignond_security_context_compare (const GSignondSecurityContext *ctx1, + const GSignondSecurityContext *ctx2); + +gboolean +gsignond_security_context_match (const GSignondSecurityContext *ctx1, + const GSignondSecurityContext *ctx2); + +gboolean +gsignond_security_context_check (const GSignondSecurityContext *reference, + const GSignondSecurityContext *test); + +/* security context list related functions */ + +GVariant * +gsignond_security_context_list_to_variant ( + const GSignondSecurityContextList *list); + +GSignondSecurityContextList * +gsignond_security_context_list_from_variant (GVariant *variant); + +GSignondSecurityContextList * +gsignond_security_context_list_copy ( + const GSignondSecurityContextList *src_list); + +void +gsignond_security_context_list_free (GSignondSecurityContextList *seclist); + +G_END_DECLS + +#endif /* _GSIGNOND_SECURITY_CONTEXT_H_ */ + diff --git a/include/gsignond/gsignond-session-data.h b/include/gsignond/gsignond-session-data.h new file mode 100644 index 0000000..846df47 --- /dev/null +++ b/include/gsignond/gsignond-session-data.h @@ -0,0 +1,123 @@ +/* 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 gsignond + * + * Copyright (C) 2012-2013 Intel Corporation. + * + * Contact: Alexander Kanavin <alex.kanavin@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_SESSION_DATA_H__ +#define __GSIGNOND_SESSION_DATA_H__ + +#include <gsignond/gsignond-dictionary.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_SESSION_DATA (GSIGNOND_TYPE_DICTIONARY) + +#define GSIGNOND_SESSION_DATA(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GSIGNOND_TYPE_SESSION_DATA, \ + GSignondSessionData)) +#define GSIGNOND_IS_SESSION_DATA(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\ + GSIGNOND_TYPE_SESSION_DATA)) + +typedef GSignondDictionary GSignondSessionData; + +typedef enum { + GSIGNOND_UI_POLICY_DEFAULT = 0, + GSIGNOND_UI_POLICY_REQUEST_PASSWORD, + GSIGNOND_UI_POLICY_NO_USER_INTERACTION, + GSIGNOND_UI_POLICY_VALIDATION +} GSignondUiPolicy; + + +const gchar * +gsignond_session_data_get_username (GSignondSessionData *data); + +void +gsignond_session_data_set_username (GSignondSessionData *data, + const gchar *username); + +const gchar * +gsignond_session_data_get_secret (GSignondSessionData *data); + +void +gsignond_session_data_set_secret (GSignondSessionData *data, + const gchar *secret); + +const gchar * +gsignond_session_data_get_realm (GSignondSessionData *data); + +void +gsignond_session_data_set_realm (GSignondSessionData *data, + const gchar *realm); + +const gchar * +gsignond_session_data_get_caption (GSignondSessionData *data); + +void +gsignond_session_data_set_caption (GSignondSessionData *data, + const gchar *caption); + +gboolean +gsignond_session_data_get_renew_token (GSignondSessionData *data, + gboolean *renew_token); + +void +gsignond_session_data_set_renew_token (GSignondSessionData *data, + gboolean renew_token); + +gboolean +gsignond_session_data_get_ui_policy (GSignondSessionData *data, + guint32 *ui_policy); + +void +gsignond_session_data_set_ui_policy (GSignondSessionData *data, + guint32 ui_policy); + +const gchar * +gsignond_session_data_get_network_proxy (GSignondSessionData *data); + +void +gsignond_session_data_set_network_proxy (GSignondSessionData *data, + const gchar *network_proxy); + +gboolean +gsignond_session_data_get_network_timeout (GSignondSessionData *data, + guint32 *network_timeout); + +void +gsignond_session_data_set_network_timeout (GSignondSessionData *data, + guint32 network_timeout); + +gboolean +gsignond_session_data_get_window_id (GSignondSessionData *data, + guint32 *window_id); + +void +gsignond_session_data_set_window_id (GSignondSessionData *data, + guint32 window_id); + + +G_END_DECLS + +#endif /* __GSIGNOND_SESSION_DATA_H__ */ diff --git a/include/gsignond/gsignond-signonui-data.h b/include/gsignond/gsignond-signonui-data.h new file mode 100644 index 0000000..e6fc74d --- /dev/null +++ b/include/gsignond/gsignond-signonui-data.h @@ -0,0 +1,158 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Amarnath Valluri<amarnath.valluri@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 __GSIGNOND_SIGNONUI_DATA_H__ +#define __GSIGNOND_SIGNONUI_DATA_H__ + +#include <gsignond/gsignond-dictionary.h> +#include <gsignond/gsignond-signonui.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_SIGNONUI_DATA (GSIGNOND_TYPE_DICTIONARY) + +#define GSIGNOND_SIGNONUI_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GSIGNOND_TYPE_SIGNONUI_DATA, \ + GSignondSignonuiData)) +#define GSIGNOND_IS_SIGNONUI_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\ + GSIGNOND_TYPE_SIGNONUI_DATA)) + +typedef GSignondDictionary GSignondSignonuiData; + +#define gsignond_signonui_data_new() gsignond_dictionary_new() + +#define gsignond_signonui_data_new_from_variant(variantmap) gsignond_dictionary_new_from_variant(variantmap) + +#define gsignond_signonui_data_to_variant(data) gsignond_dictionary_to_variant (data) + +#define gsignond_signonui_data_ref(data) /*gsignond_dictionary_ref*/g_hash_table_ref (data) + +#define gsignond_signonui_data_unref(data) /*gsignond_dictionary_unref*/g_hash_table_unref (data); + +const gchar* +gsignond_signonui_data_get_captcha_response (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_captcha_response (GSignondSignonuiData *data, + const gchar *response); +const gchar* +gsignond_signonui_data_get_captcha_url (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_captcha_url (GSignondSignonuiData *data, + const gchar *url); +const gchar* +gsignond_signonui_data_get_caption (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_caption (GSignondSignonuiData *data, + const gchar *caption); +gboolean +gsignond_signonui_data_get_confirm (GSignondSignonuiData *data, + gboolean *confirm); +void +gsignond_signonui_data_set_confirm (GSignondSignonuiData *data, + gboolean confirm); +const gchar* +gsignond_signonui_data_get_final_url (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_final_url (GSignondSignonuiData *data, + const gchar *url); +gboolean +gsignond_signonui_data_get_forgot_password (GSignondSignonuiData *data, + gboolean *forgot_password); +void +gsignond_signonui_data_set_forgot_password (GSignondSignonuiData *data, + gboolean forgot); +const gchar* +gsignond_signonui_data_get_forgot_password_url (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_forgot_password_url (GSignondSignonuiData *data, + const gchar *url); +const gchar* +gsignond_signonui_data_get_message (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_message (GSignondSignonuiData *data, + const gchar *message); +const gchar* +gsignond_signonui_data_get_open_url (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_open_url (GSignondSignonuiData *data, + const gchar *url); +const gchar* +gsignond_signonui_data_get_password (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_password (GSignondSignonuiData *data, + const gchar *password); +gboolean +gsignond_signonui_data_get_query_error (GSignondSignonuiData *data, + GSignondSignonuiError *error); +void +gsignond_signonui_data_set_query_error (GSignondSignonuiData *data, + GSignondSignonuiError error); +gboolean +gsignond_signonui_data_get_query_password (GSignondSignonuiData *data, + gboolean *query_password); +void +gsignond_signonui_data_set_query_password (GSignondSignonuiData *data, + gboolean query); +gboolean +gsignond_signonui_data_get_query_username (GSignondSignonuiData *data, + gboolean *query_username); +void +gsignond_signonui_data_set_query_username (GSignondSignonuiData *data, + gboolean query); +gboolean +gsignond_signonui_data_get_remember_password (GSignondSignonuiData *data, + gboolean *query_password); +void +gsignond_signonui_data_set_remember_password (GSignondSignonuiData *data, + gboolean remember); +const gchar* +gsignond_signonui_data_get_request_id (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_request_id (GSignondSignonuiData *data, + const gchar *id); +const gchar* +gsignond_signonui_data_get_test_reply (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_test_reply (GSignondSignonuiData *data, + const gchar *reply); +const gchar* +gsignond_signonui_data_get_title (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_title (GSignondSignonuiData *data, + const gchar* title); +const gchar* +gsignond_signonui_data_get_url_response (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_url_response (GSignondSignonuiData *data, + const gchar *response); +const gchar* +gsignond_signonui_data_get_username (GSignondSignonuiData *data); +void +gsignond_signonui_data_set_username (GSignondSignonuiData *data, + const gchar *username); + +G_END_DECLS + +#endif /* __GSIGNOND_SIGNONUI_DATA_H__ */ diff --git a/include/gsignond/gsignond-signonui.h b/include/gsignond/gsignond-signonui.h new file mode 100644 index 0000000..72c5393 --- /dev/null +++ b/include/gsignond/gsignond-signonui.h @@ -0,0 +1,34 @@ +#ifndef _GSIGNOND_SIGNONUI_H_ +#define _GSIGNOND_SIGNONUI_H_ + +/** + * @GSignondSignonuiError: + * @SIGNONUI_ERROR_NONE: No errors + * @SIGNONUI_ERROR_GENERAL: Generic error during interaction + * @SIGNONUI_ERROR_NO_SIGNONUI: Cannot send request to signon-ui + * @SIGNONUI_ERROR_BAD_PARAMETERS:Signon-Ui cannot create dialog based on the given UiSessionData + * @SIGNONUI_ERROR_CANCELED: User canceled action. Plugin should not retry automatically after this + * @SIGNONUI_ERROR_NOT_AVAILABLE: Requested ui is not available. For example browser cannot be started + * @SIGNONUI_ERROR_BAD_URL: Given url was not valid + * @SIGNONUI_ERROR_BAD_CAPTCHA: Given captcha image was not valid + * @SIGNONUI_ERROR_BAD_CAPTCHA_URL: Given url for capctha loading was not valid + * @SIGNONUI_ERROR_REFRESH_FAILED: Refresh failed + * @SIGNONUI_ERROR_FORBIDDEN: Showing ui forbidden by ui policy + * @SIGNONUI_ERROR_FORGOT_PASSWORD: User pressed forgot password + */ +typedef enum { + SIGNONUI_ERROR_NONE = 0, + SIGNONUI_ERROR_GENERAL, + SIGNONUI_ERROR_NO_SIGNONUI, + SIGNONUI_ERROR_BAD_PARAMETERS, + SIGNONUI_ERROR_CANCELED, + SIGNONUI_ERROR_NOT_AVAILABLE, + SIGNONUI_ERROR_BAD_URL, + SIGNONUI_ERROR_BAD_CAPTCHA, + SIGNONUI_ERROR_BAD_CAPTCHA_URL, + SIGNONUI_ERROR_REFRESH_FAILED, + SIGNONUI_ERROR_FORBIDDEN, + SIGNONUI_ERROR_FORGOT_PASSWORD +} GSignondSignonuiError; + +#endif //_GSIGNOND_SIGNONUI_H_ diff --git a/include/gsignond/gsignond-storage-manager.h b/include/gsignond/gsignond-storage-manager.h new file mode 100644 index 0000000..a5b7eba --- /dev/null +++ b/include/gsignond/gsignond-storage-manager.h @@ -0,0 +1,129 @@ +/* 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 gsignond + * + * Copyright (C) 2012 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 _GSIGNOND_STORAGE_MANAGER_H_ +#define _GSIGNOND_STORAGE_MANAGER_H_ + +#include <glib.h> +#include <glib-object.h> + +#include <gsignond/gsignond-config.h> + +G_BEGIN_DECLS + +#define GSIGNOND_TYPE_STORAGE_MANAGER \ + (gsignond_storage_manager_get_type ()) +#define GSIGNOND_STORAGE_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSIGNOND_TYPE_STORAGE_MANAGER, \ + GSignondStorageManager)) +#define GSIGNOND_IS_STORAGE_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSIGNOND_TYPE_STORAGE_MANAGER)) +#define GSIGNOND_STORAGE_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GSIGNOND_TYPE_STORAGE_MANAGER, \ + GSignondStorageManagerClass)) +#define GSIGNOND_IS_STORAGE_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GSIGNOND_TYPE_STORAGE_MANAGER)) +#define GSIGNOND_STORAGE_MANAGER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GSIGNOND_TYPE_STORAGE_MANAGER, \ + GSignondStorageManagerClass)) + +typedef struct _GSignondStorageManager GSignondStorageManager; +typedef struct _GSignondStorageManagerClass GSignondStorageManagerClass; +typedef struct _GSignondStorageManagerPrivate GSignondStorageManagerPrivate; + +struct _GSignondStorageManager +{ + GObject parent_instance; + GSignondConfig *config; + gchar *location; + GSignondStorageManagerPrivate *priv; +}; + +struct _GSignondStorageManagerClass +{ + GObjectClass parent_class; + + /** + * initialize_storage: + * + * See #gsignond_storage_manager_initialize_storage. + */ + gboolean (*initialize_storage) (GSignondStorageManager *self); + /** + * delete_storage: + * + * See #gsignond_storage_manager_delete_storage. + */ + gboolean (*delete_storage) (GSignondStorageManager *self); + /** + * storage_is_initialized: + * + * See #gsignond_storage_manager_storage_is_initialized. + */ + gboolean (*storage_is_initialized) (GSignondStorageManager *self); + /** + * mount_filesystem: + * + * See #gsignond_storage_manager_mount_filesystem. + */ + const gchar * (*mount_filesystem) (GSignondStorageManager *self); + /** + * unmount_filesystem: + * + * See #gsignond_storage_manager_unmount_filesystem. + */ + gboolean (*unmount_filesystem) (GSignondStorageManager *self); + /** + * filesystem_is_mounted: + * + * See #gsignond_storage_manager_filesystem_is_mounted. + */ + gboolean (*filesystem_is_mounted) (GSignondStorageManager *self); +}; + +GType gsignond_storage_manager_get_type (); + +gboolean +gsignond_storage_manager_initialize_storage (GSignondStorageManager *self); + +gboolean +gsignond_storage_manager_delete_storage (GSignondStorageManager *self); + +gboolean +gsignond_storage_manager_storage_is_initialized (GSignondStorageManager *self); + +const gchar * +gsignond_storage_manager_mount_filesystem (GSignondStorageManager *self); + +gboolean +gsignond_storage_manager_unmount_filesystem (GSignondStorageManager *self); + +gboolean +gsignond_storage_manager_filesystem_is_mounted (GSignondStorageManager *self); + +G_END_DECLS + +#endif /* _GSIGNOND_STORAGE_MANAGER_H_ */ + diff --git a/include/gsignond/gsignond-utils.h b/include/gsignond/gsignond-utils.h new file mode 100644 index 0000000..5334732 --- /dev/null +++ b/include/gsignond/gsignond-utils.h @@ -0,0 +1,42 @@ +/* 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 gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * 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 _GSIGNOND_UTILS_H_ +#define _GSIGNOND_UTILS_H_ + +#include <glib.h> + +G_BEGIN_DECLS + +gboolean +gsignond_wipe_file (const gchar *); + +gboolean +gsignond_wipe_directory (const gchar *); + +G_END_DECLS + +#endif /* _SGINOND_UTILS_H_ */ + |