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 "samlp2_name_id_policy.h"
26 
27 /**
28  * SECTION:samlp2_name_id_policy
29  * @short_description: &lt;samlp2:NameIDPolicy&gt;
30  *
31  * <figure><title>Schema fragment for samlp2:NameIDPolicy</title>
32  * <programlisting><![CDATA[
33  *
34  * <complexType name="NameIDPolicyType">
35  *   <attribute name="Format" type="anyURI" use="optional"/>
36  *   <attribute name="SPNameQualifier" type="string" use="optional"/>
37  *   <attribute name="AllowCreate" type="boolean" use="optional"/>
38  * </complexType>
39  * ]]></programlisting>
40  * </figure>
41  */
42 
43 /*****************************************************************************/
44 /* private methods                                                           */
45 /*****************************************************************************/
46 
47 
48 static struct XmlSnippet schema_snippets[] = {
49 	{ "Format", SNIPPET_ATTRIBUTE,
50 		G_STRUCT_OFFSET(LassoSamlp2NameIDPolicy, Format), NULL, NULL, NULL},
51 	{ "SPNameQualifier", SNIPPET_ATTRIBUTE,
52 		G_STRUCT_OFFSET(LassoSamlp2NameIDPolicy, SPNameQualifier), NULL, NULL, NULL},
53 	{ "AllowCreate", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN,
54 		G_STRUCT_OFFSET(LassoSamlp2NameIDPolicy, AllowCreate), NULL, NULL, NULL},
55 	{NULL, 0, 0, NULL, NULL, NULL}
56 };
57 
58 static LassoNodeClass *parent_class = NULL;
59 
60 
61 /*****************************************************************************/
62 /* instance and class init functions                                         */
63 /*****************************************************************************/
64 
65 
66 static void
class_init(LassoSamlp2NameIDPolicyClass * klass,void * unused G_GNUC_UNUSED)67 class_init(LassoSamlp2NameIDPolicyClass *klass, void *unused G_GNUC_UNUSED)
68 {
69 	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
70 
71 	parent_class = g_type_class_peek_parent(klass);
72 	nclass->node_data = g_new0(LassoNodeClassData, 1);
73 	lasso_node_class_set_nodename(nclass, "NameIDPolicy");
74 	lasso_node_class_set_ns(nclass, LASSO_SAML2_PROTOCOL_HREF, LASSO_SAML2_PROTOCOL_PREFIX);
75 	lasso_node_class_add_snippets(nclass, schema_snippets);
76 }
77 
78 GType
lasso_samlp2_name_id_policy_get_type()79 lasso_samlp2_name_id_policy_get_type()
80 {
81 	static GType this_type = 0;
82 
83 	if (!this_type) {
84 		static const GTypeInfo this_info = {
85 			sizeof (LassoSamlp2NameIDPolicyClass),
86 			NULL,
87 			NULL,
88 			(GClassInitFunc) class_init,
89 			NULL,
90 			NULL,
91 			sizeof(LassoSamlp2NameIDPolicy),
92 			0,
93 			NULL,
94 			NULL
95 		};
96 
97 		this_type = g_type_register_static(LASSO_TYPE_NODE,
98 				"LassoSamlp2NameIDPolicy", &this_info, 0);
99 	}
100 	return this_type;
101 }
102 
103 /**
104  * lasso_samlp2_name_id_policy_new:
105  *
106  * Creates a new #LassoSamlp2NameIDPolicy object.
107  *
108  * Return value: a newly created #LassoSamlp2NameIDPolicy object
109  **/
110 LassoNode*
lasso_samlp2_name_id_policy_new()111 lasso_samlp2_name_id_policy_new()
112 {
113 	return g_object_new(LASSO_TYPE_SAMLP2_NAME_ID_POLICY, NULL);
114 }
115