1 /* $Id$
2 *
3 * Lasso - A free implementation of the Liberty Alliance specifications.
4 *
5 * Copyright (C) 2004-2007 Entr'ouvert
6 * http://lasso.entrouvert.org
7 *
8 * Authors: See AUTHORS file in top-level directory.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #include "private.h"
25 #include "lib_subject.h"
26
27 /**
28 * SECTION:lib_subject
29 * @short_description: <lib:Subject>
30 *
31 * <figure><title>Schema fragment for lib:Subject</title>
32 * <programlisting><![CDATA[
33 * <xs:complexType name="SubjectType">
34 * <xs:complexContent>
35 * <xs:extension base="saml:SubjectType">
36 * <xs:sequence>
37 * <xs:element ref="IDPProvidedNameIdentifier"/>
38 * </xs:sequence>
39 * </xs:extension>
40 * </xs:complexContent>
41 * </xs:complexType>
42 * <xs:element name="Subject" type="SubjectType" substitutionGroup="saml:Subject"/>
43 * ]]></programlisting>
44 * </figure>
45 */
46
47 /*****************************************************************************/
48 /* private methods */
49 /*****************************************************************************/
50
51 static struct XmlSnippet schema_snippets[] = {
52 { "IDPProvidedNameIdentifier", SNIPPET_NODE,
53 G_STRUCT_OFFSET(LassoLibSubject, IDPProvidedNameIdentifier),
54 "LassoSamlNameIdentifier", LASSO_LIB_PREFIX, LASSO_LIB_HREF},
55 {NULL, 0, 0, NULL, NULL, NULL}
56 };
57
58 /*****************************************************************************/
59 /* instance and class init functions */
60 /*****************************************************************************/
61
62
63 static void
class_init(LassoLibSubjectClass * klass,void * unused G_GNUC_UNUSED)64 class_init(LassoLibSubjectClass *klass, void *unused G_GNUC_UNUSED)
65 {
66 LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
67
68 nclass->node_data = g_new0(LassoNodeClassData, 1);
69 nclass->node_data->xsi_sub_type = TRUE;
70 lasso_node_class_set_nodename(nclass, "SubjectType");
71 lasso_node_class_set_ns(nclass, LASSO_LIB_HREF, LASSO_LIB_PREFIX);
72 lasso_node_class_add_snippets(nclass, schema_snippets);
73 }
74
75 GType
lasso_lib_subject_get_type()76 lasso_lib_subject_get_type()
77 {
78 static GType this_type = 0;
79
80 if (!this_type) {
81 static const GTypeInfo this_info = {
82 sizeof (LassoLibSubjectClass),
83 NULL,
84 NULL,
85 (GClassInitFunc) class_init,
86 NULL,
87 NULL,
88 sizeof(LassoLibSubject),
89 0,
90 NULL,
91 NULL
92 };
93
94 this_type = g_type_register_static(LASSO_TYPE_SAML_SUBJECT,
95 "LassoLibSubject", &this_info, 0);
96 }
97 return this_type;
98 }
99
100 /**
101 * lasso_lib_subject_new:
102 *
103 * Creates a new #LassoLibSubject object.
104 *
105 * Return value: a newly created #LassoLibSubject object
106 **/
107 LassoLibSubject*
lasso_lib_subject_new()108 lasso_lib_subject_new()
109 {
110 return g_object_new(LASSO_TYPE_LIB_SUBJECT, NULL);
111 }
112