1
/* $Id: request.c,v 1.13 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: Valery Febvre <vfebvre@easter-eggs.com>
9
* Nicolas Clapies <nclapies@entrouvert.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/samlp_request.h>
27
#include <lasso/protocols/request.h>
29
/*****************************************************************************/
31
/*****************************************************************************/
33
/*****************************************************************************/
35
/*****************************************************************************/
37
/*****************************************************************************/
38
/* instance and class init functions */
39
/*****************************************************************************/
42
lasso_request_instance_init(LassoRequest *request)
47
lasso_request_class_init(LassoRequestClass *class)
51
GType lasso_request_get_type() {
52
static GType this_type = 0;
55
static const GTypeInfo this_info = {
56
sizeof (LassoRequestClass),
59
(GClassInitFunc) lasso_request_class_init,
64
(GInstanceInitFunc) lasso_request_instance_init,
67
this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST,
75
lasso_request_new(const xmlChar *assertionArtifact)
80
request = LASSO_NODE(g_object_new(LASSO_TYPE_REQUEST, NULL));
82
/* Set ONLY required elements/attributes */
84
id = lasso_build_unique_id(32);
85
lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request),
89
lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request),
90
lassoLibMajorVersion);
92
lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request),
93
lassoLibMinorVersion);
95
time = lasso_get_current_time();
96
lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request),
97
(const xmlChar *)time);
100
/* Signature template with X509
101
FIXME: signature method */
102
lasso_samlp_request_abstract_set_signature_tmpl(LASSO_SAMLP_REQUEST_ABSTRACT(request),
103
lassoSignatureTypeWithX509,
104
lassoSignatureMethodRsaSha1,
107
/* AssertionArtifact */
108
lasso_samlp_request_set_assertionArtifact(LASSO_SAMLP_REQUEST(request),
115
lasso_request_new_from_export(gchar *buffer,
116
lassoNodeExportType export_type)
118
LassoNode *request=NULL, *soap_node, *request_node;
121
g_return_val_if_fail(buffer != NULL, NULL);
123
request = LASSO_NODE(g_object_new(LASSO_TYPE_REQUEST, NULL));
125
switch (export_type) {
126
case lassoNodeExportTypeXml:
127
lasso_node_import(request, buffer);
129
case lassoNodeExportTypeQuery:
130
case lassoNodeExportTypeBase64:
132
case lassoNodeExportTypeSoap:
133
soap_node = lasso_node_new_from_dump(buffer);
134
request_node = lasso_node_get_child(soap_node, "Request",
135
lassoSamlProtocolHRef, NULL);
136
export = lasso_node_export(request_node);
137
lasso_node_import(request, export);
139
lasso_node_destroy(request_node);
140
lasso_node_destroy(soap_node);