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