1
/* $Id: saml_conditions.c,v 1.4 2004/08/13 15:16:13 fpeters Exp $
3
* Lasso - A free implementation of the Samlerty 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/saml_conditions.h>
29
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
31
<element name="Conditions" type="saml:ConditionsType"/>
32
<complexType name="ConditionsType">
33
<choice minOccurs="0" maxOccurs="unbounded">
34
<element ref="saml:AudienceRestrictionCondition"/>
35
<element ref="saml:Condition"/>
37
<attribute name="NotBefore" type="dateTime" use="optional"/>
38
<attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
42
/*****************************************************************************/
44
/*****************************************************************************/
47
* lasso_saml_conditions_add_condition:
48
* @node: the <saml:Conditions> node object
54
lasso_saml_conditions_add_condition(LassoSamlConditions *node,
55
LassoSamlConditionAbstract *condition)
57
LassoNodeClass *class;
58
g_assert(LASSO_IS_SAML_CONDITIONS(node));
59
g_assert(LASSO_IS_SAML_CONDITION_ABSTRACT(condition));
61
class = LASSO_NODE_GET_CLASS(node);
62
class->add_child(LASSO_NODE (node), LASSO_NODE(condition), TRUE);
66
* lasso_saml_conditions_add_audienceRestrictionCondition:
67
* @node: the <saml:Conditions> node object
68
* @audienceRestrictionCondition:
73
lasso_saml_conditions_add_audienceRestrictionCondition(LassoSamlConditions *node,
74
LassoSamlAudienceRestrictionCondition *audienceRestrictionCondition)
76
LassoNodeClass *class;
77
g_assert(LASSO_IS_SAML_CONDITIONS(node));
78
g_assert(LASSO_IS_SAML_AUDIENCE_RESTRICTION_CONDITION(audienceRestrictionCondition));
80
class = LASSO_NODE_GET_CLASS(node);
81
class->add_child(LASSO_NODE (node), LASSO_NODE(audienceRestrictionCondition), TRUE);
85
* lasso_saml_conditions_set_notBefore:
86
* @node: the <saml:Conditions> node object
87
* @notBefore: the value of "NotBefore" attribute
89
* Sets the "NotBefore" attribute.
91
* Specifies the earliest time instant at which the assertion is valid. The
92
* time value is encoded in UTC as described in Section 1.2.2
93
* (oasis-sstc-saml-core-1.0.pdf).
96
lasso_saml_conditions_set_notBefore(LassoSamlConditions *node,
97
const xmlChar *notBefore)
99
LassoNodeClass *class;
100
g_assert(LASSO_IS_SAML_CONDITIONS(node));
101
g_assert(notBefore != NULL);
103
class = LASSO_NODE_GET_CLASS(node);
104
class->set_prop(LASSO_NODE (node), "NotBefore", notBefore);
108
* lasso_saml_conditions_set_notOnOrAfter:
109
* @node: the <saml:Conditions> node object
110
* @notOnOrAfter: the value of "NotOnOrAfter" attribute.
112
* Sets the "NotOnOrAfter" attribute.
114
* Specifies the time instant at which the assertion has expired. The time
115
* value is encoded in UTC as described in Section 1.2.2
116
* (oasis-sstc-saml-core-1.0.pdf).
119
lasso_saml_conditions_set_notOnOrAfter(LassoSamlConditions *node,
120
const xmlChar *notOnOrAfter)
122
LassoNodeClass *class;
123
g_assert(LASSO_IS_SAML_CONDITIONS(node));
124
g_assert(notOnOrAfter != NULL);
126
class = LASSO_NODE_GET_CLASS(node);
127
class->set_prop(LASSO_NODE (node), "NotOnOrAfter", notOnOrAfter);
130
/*****************************************************************************/
131
/* instance and class init functions */
132
/*****************************************************************************/
135
lasso_saml_conditions_instance_init(LassoSamlConditions *node)
137
LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
139
class->set_ns(LASSO_NODE(node), lassoSamlAssertionHRef,
140
lassoSamlAssertionPrefix);
141
class->set_name(LASSO_NODE(node), "Conditions");
145
lasso_saml_conditions_class_init(LassoSamlConditionsClass *klass)
149
GType lasso_saml_conditions_get_type()
151
static GType this_type = 0;
154
static const GTypeInfo this_info = {
155
sizeof (LassoSamlConditionsClass),
158
(GClassInitFunc) lasso_saml_conditions_class_init,
161
sizeof(LassoSamlConditions),
163
(GInstanceInitFunc) lasso_saml_conditions_instance_init,
166
this_type = g_type_register_static(LASSO_TYPE_NODE,
167
"LassoSamlConditions",
174
* lasso_saml_conditions_new:
176
* Creates a new <saml:Conditions> node object.
178
* Return value: the new @LassoSamlConditions
180
LassoNode* lasso_saml_conditions_new()
182
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_CONDITIONS, NULL));