1
/* $Id: lib_assertion.c,v 1.6 2004/09/01 09:59:53 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_assertion.h>
29
Authentication assertions provided in an <AuthnResponse> element MUST be of
30
type AssertionType, which is an extension of saml:AssertionType, so that the
31
RequestID attribute from the original <AuthnRequest> MAY be included in the
32
InResponseTo attribute in the <Assertion> element. This is done because it is
33
not required that the <AuthnResponse> element itself be signed. Instead, the
34
individual <Assertion> elements contained MUST each be signed. Note that it is
35
optional for the InResponseTo to be present. Its absence indicates that the
36
<AuthnResponse> has been unilaterally sent by the identity provider without a
37
corresponding <AuthnRequest> message from the service provider. If the
38
attribute is present, it MUST be set to the RequestID of the original
41
The schema fragment is as follows:
43
<xs:element name="Assertion" type="AssertionType" substitutionGroup="saml:Assertion" />
44
<xs:complexType name="AssertionType">
46
<xs:extension base="saml:AssertionType">
47
<xs:attribute name="InResponseTo" type="xs:NCName" use="optional"/>
54
/*****************************************************************************/
56
/*****************************************************************************/
59
lasso_lib_assertion_set_inResponseTo(LassoLibAssertion *node,
60
const xmlChar *inResponseTo)
62
LassoNodeClass *class;
63
g_assert(LASSO_IS_LIB_ASSERTION(node));
64
g_assert(inResponseTo != NULL);
66
class = LASSO_NODE_GET_CLASS(node);
67
class->set_prop(LASSO_NODE (node), "InResponseTo", inResponseTo);
70
/*****************************************************************************/
71
/* instance and class init functions */
72
/*****************************************************************************/
75
LASSO_LIB_ASSERTION_USE_XSITYPE = 1
79
lasso_lib_assertion_set_property (GObject *object,
84
LassoLibAssertion *self = LASSO_LIB_ASSERTION(object);
85
LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(object));
87
switch (property_id) {
88
case LASSO_LIB_ASSERTION_USE_XSITYPE:
89
self->use_xsitype = g_value_get_boolean (value);
90
if (self->use_xsitype == TRUE) {
91
/* namespace and name were already set in parent class
93
class->new_ns_prop(LASSO_NODE(object),
94
"type", "lib:AssertionType",
95
lassoXsiHRef, lassoXsiPrefix);
98
/* node name was already set in parent class LassoSamlAssertion
100
class->set_ns(LASSO_NODE(object), lassoLibHRef, lassoLibPrefix);
104
/* We don't have any other property... */
111
lasso_lib_assertion_instance_init(LassoLibAssertion *node)
116
lasso_lib_assertion_class_init(LassoLibAssertionClass *g_class,
117
gpointer g_class_data)
119
GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
122
/* override parent class methods */
123
gobject_class->set_property = lasso_lib_assertion_set_property;
125
pspec = g_param_spec_boolean ("use_xsitype",
129
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
130
g_object_class_install_property (gobject_class,
131
LASSO_LIB_ASSERTION_USE_XSITYPE,
135
GType lasso_lib_assertion_get_type() {
136
static GType this_type = 0;
139
static const GTypeInfo this_info = {
140
sizeof (LassoLibAssertionClass),
143
(GClassInitFunc) lasso_lib_assertion_class_init,
146
sizeof(LassoLibAssertion),
148
(GInstanceInitFunc) lasso_lib_assertion_instance_init,
151
this_type = g_type_register_static(LASSO_TYPE_SAML_ASSERTION,
159
lasso_lib_assertion_new(gboolean use_xsitype)
163
node = LASSO_NODE(g_object_new(LASSO_TYPE_LIB_ASSERTION,
164
"use_xsitype", use_xsitype,