1
/* $Id: lib_authn_request_envelope.c,v 1.2 2004/08/13 15:16:13 fpeters Exp $
3
* Lasso - A free implementation of the Liberty Alliance specifications.
5
* Copyright (C) 2004 Entr'ouvert
6
* http://lasso.entrouvert.org
8
* Authors: Nicolas Clapies <nclapies@entrouvert.com>
9
* Valery Febvre <vfebvre@easter-eggs.com>
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
21
* You should have received a copy of the GNU General Public License
22
* along with this program; if not, write to the Free Software
23
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#include <lasso/xml/lib_authn_request_envelope.h>
28
/* <xs:element name="AuthnRequestEnvelope" type="AuthnRequestEnvelopeType"/> */
29
/* <xs:complexType name="AuthnRequestEnvelopeType"> */
30
/* <xs:complexContent> */
31
/* <xs:extension base="RequestEnvelopeType"> */
33
/* <xs:element ref="AuthnRequest"/> */
34
/* <xs:element ref="ProviderID"/> */
35
/* <xs:element name="ProviderName" type="xs:string" minOccurs="0"/> */
36
/* <xs:element name="AssertionConsumerServiceURL" type="xs:anyURI"/> */
37
/* <xs:element ref="IDPList" minOccurs="0"/> */
38
/* <xs:element name="IsPassive" type="xs:boolean" minOccurs="0"/> */
41
/* </xs:complexContent> */
42
/* </xs:complexType> */
43
/* <xs:complexType name="RequestEnvelopeType"> */
45
/* <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> */
47
/* </xs:complexType> */
48
/* <xs:element name="IDPList" type="IDPListType"/> */
49
/* <xs:complexType name="IDPListType"> */
51
/* <xs:element ref="IDPEntries"/> */
52
/* <xs:element ref="GetComplete" minOccurs="0"/> */
54
/* </xs:complexType> */
55
/* <xs:complexType name="ResponseEnvelopeType"> */
57
/* <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> */
61
/*****************************************************************************/
63
/*****************************************************************************/
66
lasso_lib_authn_request_envelope_set_extension(LassoLibAuthnRequestEnvelope *node,
69
LassoNodeClass *class;
70
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
71
g_assert(LASSO_IS_NODE(extension));
73
class = LASSO_NODE_GET_CLASS(node);
74
class->add_child(LASSO_NODE(node), extension, FALSE);
77
void lasso_lib_authn_request_envelope_set_authnRequest(LassoLibAuthnRequestEnvelope *node,
78
LassoLibAuthnRequest *request)
80
LassoNodeClass *class;
81
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
82
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(request));
84
class = LASSO_NODE_GET_CLASS(node);
85
class->add_child(LASSO_NODE(node), LASSO_NODE(request), FALSE);
89
lasso_lib_authn_request_envelope_set_assertionConsumerServiceURL(LassoLibAuthnRequestEnvelope *node,
90
const xmlChar *assertionConsumerServiceURL)
92
LassoNodeClass *class;
93
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
94
g_assert(assertionConsumerServiceURL != NULL);
96
class = LASSO_NODE_GET_CLASS(node);
97
class->new_child(LASSO_NODE(node), "AssertionConsumerServiceURL", assertionConsumerServiceURL, FALSE);
101
lasso_lib_authn_request_envelope_set_providerID(LassoLibAuthnRequestEnvelope *node,
102
const xmlChar *providerID)
104
LassoNodeClass *class;
105
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
106
g_assert(providerID != NULL);
107
/* FIXME : providerID length SHOULD be <= 1024 */
109
class = LASSO_NODE_GET_CLASS(node);
110
class->new_child(LASSO_NODE(node), "ProviderID", providerID, FALSE);
113
void lasso_lib_authn_request_envelope_set_providerName(LassoLibAuthnRequestEnvelope *node,
114
const xmlChar *providerName)
116
LassoNodeClass *class;
117
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
118
g_assert(providerName != NULL);
120
class = LASSO_NODE_GET_CLASS(node);
121
class->new_child(LASSO_NODE(node), "ProviderName", providerName, FALSE);
124
void lasso_lib_authn_request_envelope_set_idpList(LassoLibAuthnRequestEnvelope *node,
125
LassoLibIDPList *idpList)
127
LassoNodeClass *class;
128
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
129
g_assert(LASSO_IS_LIB_IDP_LIST(idpList));
131
class = LASSO_NODE_GET_CLASS(node);
132
class->add_child(LASSO_NODE(node), LASSO_NODE(idpList), FALSE);
136
lasso_lib_authn_request_envelope_set_isPassive(LassoLibAuthnRequestEnvelope *node,
139
LassoNodeClass *class;
140
g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
141
g_assert(isPassive == FALSE || isPassive == TRUE);
143
class = LASSO_NODE_GET_CLASS(node);
144
if (isPassive == FALSE) {
145
class->new_child(LASSO_NODE (node), "IsPassive", "false", FALSE);
147
if (isPassive == TRUE) {
148
class->new_child(LASSO_NODE (node), "IsPassive", "true", FALSE);
152
/*****************************************************************************/
153
/* instance and class init functions */
154
/*****************************************************************************/
157
lasso_lib_authn_request_envelope_instance_init(LassoLibAuthnRequestEnvelope *node)
159
LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
161
class->set_ns(LASSO_NODE(node), lassoLibHRef, lassoLibPrefix);
162
class->set_name(LASSO_NODE(node), "AuthnRequestEnvelope");
166
lasso_lib_authn_request_envelope_class_init(LassoLibAuthnRequestEnvelopeClass *class)
170
GType lasso_lib_authn_request_envelope_get_type() {
171
static GType this_type = 0;
174
static const GTypeInfo this_info = {
175
sizeof (LassoLibAuthnRequestEnvelopeClass),
178
(GClassInitFunc) lasso_lib_authn_request_envelope_class_init,
181
sizeof(LassoLibAuthnRequestEnvelope),
183
(GInstanceInitFunc) lasso_lib_authn_request_envelope_instance_init,
186
this_type = g_type_register_static(LASSO_TYPE_NODE,
187
"LassoLibAuthnRequestEnvelope",
193
LassoNode* lasso_lib_authn_request_envelope_new() {
194
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHN_REQUEST_ENVELOPE,