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 "samlp_request.h"
26 
27 /**
28  * SECTION:samlp_request
29  * @short_description: &lt;samlp:Request&gt;
30  *
31  * <figure><title>Schema fragment for samlp:Request</title>
32  * <programlisting><![CDATA[
33  * <element name="Request" type="samlp:RequestType"/>
34  * <complexType name="RequestType">
35  *    <complexContent>
36  *      <extension base="samlp:RequestAbstractType">
37  * 	<choice>
38  * 	   <element ref="samlp:Query"/>
39  * 	   <element ref="samlp:SubjectQuery"/>
40  * 	   <element ref="samlp:AuthenticationQuery"/>
41  * 	   <element ref="samlp:AttributeQuery"/>
42  * 	   <element ref="samlp:AuthorizationDecisionQuery"/>
43  * 	   <element ref="saml:AssertionIDReference" maxOccurs="unbounded"/>
44  * 	   <element ref="samlp:AssertionArtifact" maxOccurs="unbounded"/>
45  * 	</choice>
46  *      </extension>
47  *    </complexContent>
48  * </complexType>
49  *
50  * ]]></programlisting>
51  * </figure>
52  */
53 
54 /*****************************************************************************/
55 /* private methods                                                           */
56 /*****************************************************************************/
57 
58 static struct XmlSnippet schema_snippets[] = {
59 	{ "AssertionArtifact", SNIPPET_CONTENT,
60 		G_STRUCT_OFFSET(LassoSamlpRequest, AssertionArtifact), NULL, NULL, NULL},
61 	{NULL, 0, 0, NULL, NULL, NULL}
62 };
63 
64 /*****************************************************************************/
65 /* instance and class init functions                                         */
66 /*****************************************************************************/
67 
68 
69 static void
class_init(LassoSamlpRequestClass * klass,void * unused G_GNUC_UNUSED)70 class_init(LassoSamlpRequestClass *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, "Request");
76 	lasso_node_class_set_ns(nclass, LASSO_SAML_PROTOCOL_HREF, LASSO_SAML_PROTOCOL_PREFIX);
77 	lasso_node_class_add_snippets(nclass, schema_snippets);
78 }
79 
80 GType
lasso_samlp_request_get_type()81 lasso_samlp_request_get_type()
82 {
83 	static GType this_type = 0;
84 
85 	if (!this_type) {
86 		static const GTypeInfo this_info = {
87 			sizeof (LassoSamlpRequestClass),
88 			NULL,
89 			NULL,
90 			(GClassInitFunc) class_init,
91 			NULL,
92 			NULL,
93 			sizeof(LassoSamlpRequest),
94 			0,
95 			NULL,
96 			NULL
97 		};
98 
99 		this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
100 				"LassoSamlpRequest", &this_info, 0);
101 	}
102 	return this_type;
103 }
104 
105 
106 /**
107  * lasso_samlp_request_new:
108  *
109  * Creates a new #LassoSamlpRequest object.
110  *
111  * Return value: a newly created #LassoSamlpRequest object
112  **/
113 LassoNode*
lasso_samlp_request_new()114 lasso_samlp_request_new()
115 {
116 	return g_object_new(LASSO_TYPE_SAMLP_REQUEST, NULL);
117 }
118