libgsignon-glib first release 2.0.0
[profile/ivi/libgsignon-glib.git] / libgsignon-glib / signon-identity-info.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of libgsignon-glib
5  *
6  * Copyright (C) 2009-2010 Nokia Corporation.
7  * Copyright (C) 2011 Canonical Ltd.
8  * Copyright (C) 2012-2013 Intel Corporation.
9  *
10  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
11  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public License
15  * version 2.1 as published by the Free Software Foundation.
16  *
17  * This library is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25  * 02110-1301 USA
26  */
27
28 #ifndef _SIGNON_IDENTITY_INFO_H_
29 #define _SIGNON_IDENTITY_INFO_H_
30
31 #include <glib-object.h>
32
33 #include "signon-security-context.h"
34
35 G_BEGIN_DECLS
36
37 /**
38  * SignonIdentityInfo:
39  *
40  * Opaque struct. Use the accessor functions below.
41  */
42 typedef struct _SignonIdentityInfo SignonIdentityInfo;
43
44 /**
45  * SignonIdentityType:
46  * @SIGNON_IDENTITY_TYPE_OTHER: an identity that is not an app, web or network
47  * @SIGNON_IDENTITY_TYPE_APP: an application identity
48  * @SIGNON_IDENTITY_TYPE_WEB: a web identity
49  * @SIGNON_IDENTITY_TYPE_NETWORK: a network server identity
50  *
51  * Types used in #SignonIdentityInfo.
52  */
53 typedef enum {
54     SIGNON_IDENTITY_TYPE_OTHER = 0,
55     SIGNON_IDENTITY_TYPE_APP = 1 << 0,
56     SIGNON_IDENTITY_TYPE_WEB = 1 << 1,
57     SIGNON_IDENTITY_TYPE_NETWORK = 1 << 2
58 } SignonIdentityType;
59
60 GType signon_identity_info_get_type (void) G_GNUC_CONST;
61
62 SignonIdentityInfo *signon_identity_info_new ();
63 void signon_identity_info_free (SignonIdentityInfo *info);
64
65 SignonIdentityInfo *signon_identity_info_copy (const SignonIdentityInfo *other);
66
67 gint signon_identity_info_get_id (const SignonIdentityInfo *info);
68 const gchar *signon_identity_info_get_username (const SignonIdentityInfo *info);
69 gboolean signon_identity_info_get_storing_secret (
70                                                 const SignonIdentityInfo *info);
71 const gchar *signon_identity_info_get_caption (const SignonIdentityInfo *info);
72 const GHashTable *signon_identity_info_get_methods (
73                                                 const SignonIdentityInfo *info);
74 const gchar* const *signon_identity_info_get_realms (
75                                                 const SignonIdentityInfo *info);
76 const SignonSecurityContext *signon_identity_info_get_owner (
77                                                 const SignonIdentityInfo *info);
78 const SignonSecurityContextList *signon_identity_info_get_access_control_list (
79                                                 const SignonIdentityInfo *info);
80 SignonIdentityType signon_identity_info_get_identity_type (
81                                                 const SignonIdentityInfo *info);
82
83 void signon_identity_info_set_username (SignonIdentityInfo *info, const gchar *username);
84 void signon_identity_info_set_secret (SignonIdentityInfo *info,
85                                       const gchar *secret,
86                                       gboolean store_secret);
87 void signon_identity_info_set_caption (SignonIdentityInfo *info,
88                                        const gchar *caption);
89 void signon_identity_info_set_methods (SignonIdentityInfo *info,
90                                        const GHashTable *methods);
91 void signon_identity_info_set_method (SignonIdentityInfo *info,
92                                       const gchar *method,
93                                       const gchar* const *mechanisms);
94 void signon_identity_info_remove_method (SignonIdentityInfo *info,
95                                          const gchar *method);
96 void signon_identity_info_set_realms (SignonIdentityInfo *info,
97                                       const gchar* const *realms);
98 void signon_identity_info_set_owner (SignonIdentityInfo *info,
99                                      const SignonSecurityContext *owner);
100 void signon_identity_info_set_owner_from_values (SignonIdentityInfo *info,
101                                             const gchar *system_context,
102                                             const gchar *application_context);
103 void signon_identity_info_set_access_control_list (SignonIdentityInfo *info,
104                         const SignonSecurityContextList *access_control_list);
105 void signon_identity_info_access_control_list_append (SignonIdentityInfo *info,
106                                     SignonSecurityContext *security_context);
107 void signon_identity_info_set_identity_type (SignonIdentityInfo *info,
108                                              SignonIdentityType type);
109
110 G_END_DECLS
111
112 #endif /* _SIGNON_IDENTITY_INFO_H_ */