~ubuntu-branches/ubuntu/utopic/lasso/utopic-proposed

« back to all changes in this revision

Viewing changes to lasso/xml/lib_authn_request_envelope.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2004-09-13 09:26:34 UTC
  • Revision ID: james.westby@ubuntu.com-20040913092634-01vdfl8j9cp94exa
Tags: upstream-0.4.1
ImportĀ upstreamĀ versionĀ 0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: lib_authn_request_envelope.c,v 1.2 2004/08/13 15:16:13 fpeters Exp $ 
 
2
 *
 
3
 * Lasso - A free implementation of the Liberty Alliance specifications.
 
4
 *
 
5
 * Copyright (C) 2004 Entr'ouvert
 
6
 * http://lasso.entrouvert.org
 
7
 * 
 
8
 * Authors: Nicolas Clapies <nclapies@entrouvert.com>
 
9
 *          Valery Febvre <vfebvre@easter-eggs.com>
 
10
 *
 
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.
 
15
 * 
 
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.
 
20
 * 
 
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
 
24
 */
 
25
 
 
26
#include <lasso/xml/lib_authn_request_envelope.h>
 
27
 
 
28
/*     <xs:element name="AuthnRequestEnvelope" type="AuthnRequestEnvelopeType"/> */
 
29
/*     <xs:complexType name="AuthnRequestEnvelopeType"> */
 
30
/*         <xs:complexContent> */
 
31
/*             <xs:extension base="RequestEnvelopeType"> */
 
32
/*                 <xs:sequence> */
 
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"/> */
 
39
/*                 </xs:sequence> */
 
40
/*             </xs:extension> */
 
41
/*         </xs:complexContent> */
 
42
/*     </xs:complexType> */
 
43
/*     <xs:complexType name="RequestEnvelopeType"> */
 
44
/*         <xs:sequence> */
 
45
/*             <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> */
 
46
/*         </xs:sequence> */
 
47
/*     </xs:complexType> */
 
48
/*     <xs:element name="IDPList" type="IDPListType"/> */
 
49
/*     <xs:complexType name="IDPListType"> */
 
50
/*         <xs:sequence> */
 
51
/*             <xs:element ref="IDPEntries"/> */
 
52
/*             <xs:element ref="GetComplete" minOccurs="0"/> */
 
53
/*         </xs:sequence> */
 
54
/*     </xs:complexType> */
 
55
/*     <xs:complexType name="ResponseEnvelopeType"> */
 
56
/*         <xs:sequence> */
 
57
/*             <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> */
 
58
/*         </xs:sequence> */
 
59
 
 
60
 
 
61
/*****************************************************************************/
 
62
/* public methods                                                            */
 
63
/*****************************************************************************/
 
64
 
 
65
void
 
66
lasso_lib_authn_request_envelope_set_extension(LassoLibAuthnRequestEnvelope *node,
 
67
                                               LassoNode                    *extension)
 
68
{
 
69
  LassoNodeClass *class;
 
70
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
 
71
  g_assert(LASSO_IS_NODE(extension));
 
72
 
 
73
  class = LASSO_NODE_GET_CLASS(node);
 
74
  class->add_child(LASSO_NODE(node), extension, FALSE);
 
75
}
 
76
 
 
77
void lasso_lib_authn_request_envelope_set_authnRequest(LassoLibAuthnRequestEnvelope *node,
 
78
                                                       LassoLibAuthnRequest         *request)
 
79
{
 
80
  LassoNodeClass *class;
 
81
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
 
82
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST(request));
 
83
 
 
84
  class = LASSO_NODE_GET_CLASS(node);
 
85
  class->add_child(LASSO_NODE(node), LASSO_NODE(request), FALSE);
 
86
}
 
87
 
 
88
void
 
89
lasso_lib_authn_request_envelope_set_assertionConsumerServiceURL(LassoLibAuthnRequestEnvelope *node,
 
90
                                                                 const xmlChar                *assertionConsumerServiceURL)
 
91
{
 
92
  LassoNodeClass *class;
 
93
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
 
94
  g_assert(assertionConsumerServiceURL != NULL);
 
95
 
 
96
  class = LASSO_NODE_GET_CLASS(node);
 
97
  class->new_child(LASSO_NODE(node), "AssertionConsumerServiceURL", assertionConsumerServiceURL, FALSE);
 
98
}
 
99
 
 
100
void
 
101
lasso_lib_authn_request_envelope_set_providerID(LassoLibAuthnRequestEnvelope *node,
 
102
                                                const xmlChar                *providerID)
 
103
{
 
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 */
 
108
 
 
109
  class = LASSO_NODE_GET_CLASS(node);
 
110
  class->new_child(LASSO_NODE(node), "ProviderID", providerID, FALSE);
 
111
}
 
112
 
 
113
void lasso_lib_authn_request_envelope_set_providerName(LassoLibAuthnRequestEnvelope *node,
 
114
                                                       const xmlChar                *providerName)
 
115
{
 
116
  LassoNodeClass *class;
 
117
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
 
118
  g_assert(providerName != NULL);
 
119
 
 
120
  class = LASSO_NODE_GET_CLASS(node);
 
121
  class->new_child(LASSO_NODE(node), "ProviderName", providerName, FALSE);
 
122
}
 
123
 
 
124
void lasso_lib_authn_request_envelope_set_idpList(LassoLibAuthnRequestEnvelope *node,
 
125
                                                  LassoLibIDPList              *idpList)
 
126
{
 
127
  LassoNodeClass *class;
 
128
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
 
129
  g_assert(LASSO_IS_LIB_IDP_LIST(idpList));
 
130
 
 
131
  class = LASSO_NODE_GET_CLASS(node);
 
132
  class->add_child(LASSO_NODE(node), LASSO_NODE(idpList), FALSE);
 
133
}
 
134
 
 
135
void
 
136
lasso_lib_authn_request_envelope_set_isPassive(LassoLibAuthnRequestEnvelope *node,
 
137
                                               gboolean                      isPassive)
 
138
{
 
139
  LassoNodeClass *class;
 
140
  g_assert(LASSO_IS_LIB_AUTHN_REQUEST_ENVELOPE(node));
 
141
  g_assert(isPassive == FALSE || isPassive == TRUE);
 
142
 
 
143
  class = LASSO_NODE_GET_CLASS(node);
 
144
  if (isPassive == FALSE) {
 
145
    class->new_child(LASSO_NODE (node), "IsPassive", "false", FALSE);
 
146
  }
 
147
  if (isPassive == TRUE) {
 
148
    class->new_child(LASSO_NODE (node), "IsPassive", "true", FALSE);
 
149
  }
 
150
}
 
151
 
 
152
/*****************************************************************************/
 
153
/* instance and class init functions                                         */
 
154
/*****************************************************************************/
 
155
 
 
156
static void
 
157
lasso_lib_authn_request_envelope_instance_init(LassoLibAuthnRequestEnvelope *node)
 
158
{
 
159
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
 
160
 
 
161
  class->set_ns(LASSO_NODE(node), lassoLibHRef, lassoLibPrefix);
 
162
  class->set_name(LASSO_NODE(node), "AuthnRequestEnvelope");
 
163
}
 
164
 
 
165
static void
 
166
lasso_lib_authn_request_envelope_class_init(LassoLibAuthnRequestEnvelopeClass *class)
 
167
{
 
168
}
 
169
 
 
170
GType lasso_lib_authn_request_envelope_get_type() {
 
171
  static GType this_type = 0;
 
172
 
 
173
  if (!this_type) {
 
174
    static const GTypeInfo this_info = {
 
175
      sizeof (LassoLibAuthnRequestEnvelopeClass),
 
176
      NULL,
 
177
      NULL,
 
178
      (GClassInitFunc) lasso_lib_authn_request_envelope_class_init,
 
179
      NULL,
 
180
      NULL,
 
181
      sizeof(LassoLibAuthnRequestEnvelope),
 
182
      0,
 
183
      (GInstanceInitFunc) lasso_lib_authn_request_envelope_instance_init,
 
184
    };
 
185
    
 
186
    this_type = g_type_register_static(LASSO_TYPE_NODE,
 
187
                                       "LassoLibAuthnRequestEnvelope",
 
188
                                       &this_info, 0);
 
189
  }
 
190
  return this_type;
 
191
}
 
192
 
 
193
LassoNode* lasso_lib_authn_request_envelope_new() {
 
194
  return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHN_REQUEST_ENVELOPE,
 
195
                                 NULL));
 
196
}