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

« back to all changes in this revision

Viewing changes to lasso/xml/lib_logout_request.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_logout_request.c,v 1.6 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_logout_request.h>
 
27
 
 
28
/*
 
29
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
 
30
 
 
31
<xs:element name="LogoutRequest" type="LogoutRequestType"/>
 
32
<xs:complexType name="LogoutRequestType">
 
33
  <xs:complexContent>
 
34
    <xs:extension base="samlp:RequestAbstractType">
 
35
      <xs:sequence>
 
36
        <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
 
37
        <xs:element ref="ProviderID"/>
 
38
        <xs:element ref="saml:NameIdentifier"/>
 
39
        <xs:element name="SessionIndex" type="xs:string" minOccurs="0"/>
 
40
        <xs:element ref="RelayState" minOccurs="0"/>
 
41
      </xs:sequence>
 
42
      <xs:attribute ref="consent" use="optional"/>
 
43
    </xs:extension>
 
44
  </xs:complexContent>
 
45
</xs:complexType>
 
46
 
 
47
<xs:element name="ProviderID" type="md:entityIDType"/>
 
48
<xs:element name="RelayState" type="xs:string"/>
 
49
 
 
50
From liberty-metadata-v1.0.xsd:
 
51
<xs:simpleType name="entityIDType">
 
52
  <xs:restriction base="xs:anyURI">
 
53
    <xs:maxLength value="1024" id="maxlengthid"/>
 
54
  </xs:restriction>
 
55
</xs:simpleType>
 
56
 
 
57
*/
 
58
 
 
59
/*****************************************************************************/
 
60
/* public methods                                                            */
 
61
/*****************************************************************************/
 
62
void
 
63
lasso_lib_logout_request_set_consent(LassoLibLogoutRequest *node,
 
64
                                     const xmlChar *consent)
 
65
{
 
66
  LassoNodeClass *class;
 
67
  g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
 
68
  g_assert(consent != NULL);
 
69
 
 
70
  class = LASSO_NODE_GET_CLASS(node);
 
71
  class->set_prop(LASSO_NODE (node), "consent", consent);
 
72
}
 
73
 
 
74
void
 
75
lasso_lib_logout_request_set_nameIdentifier(LassoLibLogoutRequest *node,
 
76
                                            LassoSamlNameIdentifier *nameIdentifier)
 
77
{
 
78
  LassoNodeClass *class;
 
79
  g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
 
80
  g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
 
81
 
 
82
  class = LASSO_NODE_GET_CLASS(node);
 
83
  class->add_child(LASSO_NODE (node), LASSO_NODE (nameIdentifier), FALSE);
 
84
}
 
85
 
 
86
void
 
87
lasso_lib_logout_request_set_providerID(LassoLibLogoutRequest *node,
 
88
                                        const xmlChar *providerID)
 
89
{
 
90
  LassoNodeClass *class;
 
91
  g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
 
92
  g_assert(providerID != NULL);
 
93
  /* FIXME : providerID length SHOULD be <= 1024 */
 
94
 
 
95
  class = LASSO_NODE_GET_CLASS(node);
 
96
  class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
 
97
}
 
98
 
 
99
void
 
100
lasso_lib_logout_request_set_relayState(LassoLibLogoutRequest *node,
 
101
                                        const xmlChar *relayState)
 
102
{
 
103
  LassoNodeClass *class;
 
104
  g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
 
105
  g_assert(relayState != NULL);
 
106
 
 
107
  class = LASSO_NODE_GET_CLASS(node);
 
108
  class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE);
 
109
}
 
110
 
 
111
void
 
112
lasso_lib_logout_request_set_sessionIndex(LassoLibLogoutRequest *node,
 
113
                                          const xmlChar *sessionIndex)
 
114
{
 
115
  LassoNodeClass *class;
 
116
  g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
 
117
  g_assert(sessionIndex != NULL);
 
118
 
 
119
  class = LASSO_NODE_GET_CLASS(node);
 
120
  class->new_child(LASSO_NODE (node), "SessionIndex", sessionIndex, FALSE);
 
121
}
 
122
 
 
123
/*****************************************************************************/
 
124
/* instance and class init functions                                         */
 
125
/*****************************************************************************/
 
126
 
 
127
static void
 
128
lasso_lib_logout_request_instance_init(LassoLibLogoutRequest *node)
 
129
{
 
130
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
 
131
 
 
132
  class->set_ns(LASSO_NODE(node), lassoLibHRef, lassoLibPrefix);
 
133
  class->set_name(LASSO_NODE(node), "LogoutRequest");
 
134
}
 
135
 
 
136
static void
 
137
lasso_lib_logout_request_class_init(LassoLibLogoutRequestClass *klass)
 
138
{
 
139
}
 
140
 
 
141
GType lasso_lib_logout_request_get_type() {
 
142
  static GType this_type = 0;
 
143
 
 
144
  if (!this_type) {
 
145
    static const GTypeInfo this_info = {
 
146
      sizeof (LassoLibLogoutRequestClass),
 
147
      NULL,
 
148
      NULL,
 
149
      (GClassInitFunc) lasso_lib_logout_request_class_init,
 
150
      NULL,
 
151
      NULL,
 
152
      sizeof(LassoLibLogoutRequest),
 
153
      0,
 
154
      (GInstanceInitFunc) lasso_lib_logout_request_instance_init,
 
155
    };
 
156
    
 
157
    this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
 
158
                                       "LassoLibLogoutRequest",
 
159
                                       &this_info, 0);
 
160
  }
 
161
  return this_type;
 
162
}
 
163
 
 
164
LassoNode* lasso_lib_logout_request_new() {
 
165
  return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_LOGOUT_REQUEST,
 
166
                                 NULL));
 
167
}