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 "saml_subject_confirmation.h"
26 
27 /**
28  * SECTION:saml_subject_confirmation
29  * @short_description: &lt;saml:SubjectConfirmation&gt;
30  *
31  * <figure><title>Schema fragment for saml:SubjectConfirmation</title>
32  * <programlisting><![CDATA[
33  *
34  * <element name="SubjectConfirmation" type="saml:SubjectConfirmationType"/>
35  * <complexType name="SubjectConfirmationType">
36  *   <sequence>
37  *     <element ref="saml:ConfirmationMethod" maxOccurs="unbounded"/>
38  *     <element ref="saml:SubjectConfirmationData" minOccurs="0"/>
39  *     <element ref="ds:KeyInfo" minOccurs="0"/>
40  *   </sequence>
41  * </complexType>
42  *
43  * <element name="SubjectConfirmationData" type="anyType"/>
44  * <element name="ConfirmationMethod" type="anyURI"/>
45  * ]]></programlisting>
46  * </figure>
47  */
48 
49 /*****************************************************************************/
50 /* private methods                                                           */
51 /*****************************************************************************/
52 
53 static struct XmlSnippet schema_snippets[] = {
54 	{ "ConfirmationMethod", SNIPPET_LIST_CONTENT,
55 		G_STRUCT_OFFSET(LassoSamlSubjectConfirmation, ConfirmationMethod), NULL, NULL, NULL},
56 	{ "SubjectConfirmationData", SNIPPET_CONTENT,
57 		G_STRUCT_OFFSET(LassoSamlSubjectConfirmation, SubjectConfirmationData), NULL, NULL, NULL},
58 	{ "KeyInfo", SNIPPET_NODE,
59 		G_STRUCT_OFFSET(LassoSamlSubjectConfirmation, KeyInfo), NULL, LASSO_DS_PREFIX,
60 		LASSO_DS_HREF},
61 	{NULL, 0, 0, NULL, NULL, NULL}
62 };
63 
64 /*****************************************************************************/
65 /* instance and class init functions                                         */
66 /*****************************************************************************/
67 
68 
69 static void
class_init(LassoSamlSubjectConfirmationClass * klass,void * unused G_GNUC_UNUSED)70 class_init(LassoSamlSubjectConfirmationClass *klass, void *unused G_GNUC_UNUSED)
71 {
72 	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
73 
74 	nclass->node_data = g_new0(LassoNodeClassData, 1);
75 	lasso_node_class_set_nodename(nclass, "SubjectConfirmation");
76 	lasso_node_class_set_ns(nclass, LASSO_SAML_ASSERTION_HREF, LASSO_SAML_ASSERTION_PREFIX);
77 	lasso_node_class_add_snippets(nclass, schema_snippets);
78 }
79 
80 GType
lasso_saml_subject_confirmation_get_type()81 lasso_saml_subject_confirmation_get_type()
82 {
83 	static GType this_type = 0;
84 
85 	if (!this_type) {
86 		static const GTypeInfo this_info = {
87 			sizeof (LassoSamlSubjectConfirmationClass),
88 			NULL,
89 			NULL,
90 			(GClassInitFunc) class_init,
91 			NULL,
92 			NULL,
93 			sizeof(LassoSamlSubjectConfirmation),
94 			0,
95 			NULL,
96 			NULL
97 		};
98 
99 		this_type = g_type_register_static(LASSO_TYPE_NODE,
100 				"LassoSamlSubjectConfirmation", &this_info, 0);
101 	}
102 	return this_type;
103 }
104 
105 /**
106  * lasso_saml_subject_confirmation_new:
107  *
108  * Creates a new #LassoSamlSubjectConfirmation object.
109  *
110  * Return value: a newly created #LassoSamlSubjectConfirmation object
111  **/
112 LassoSamlSubjectConfirmation*
lasso_saml_subject_confirmation_new()113 lasso_saml_subject_confirmation_new()
114 {
115 	return g_object_new(LASSO_TYPE_SAML_SUBJECT_CONFIRMATION, NULL);
116 }
117