Files moved. Initialy located in lasso/schema/ directory

This commit is contained in:
Valery Febvre 2004-04-05 22:25:48 +00:00
parent 80960808a8
commit caa62ddc7a
92 changed files with 9843 additions and 0 deletions

7
lasso/xml/.cvsignore Normal file
View File

@ -0,0 +1,7 @@
Makefile
Makefile.in
*.lo
*.loT
*.la
.libs
.deps

105
lasso/xml/Makefile.am Normal file
View File

@ -0,0 +1,105 @@
liblassoincludedir = $(includedir)/lasso/xml
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/lasso \
$(LASSO_DEFINES) \
$(GLIB_CFLAGS) \
$(LIBXSLT_CFLAGS) \
$(LIBXML_CFLAGS) \
$(XMLSEC1_CFLAGS) \
-DG_LOG_DOMAIN=\"lasso\"
noinst_LTLIBRARIES = liblasso-xml.la
liblasso_xml_la_SOURCES = \
xml.c \
strings.c \
tools.c \
ds_signature.c \
lib_assertion.c \
lib_authentication_statement.c \
lib_authn_context.c \
lib_authn_request.c \
lib_authn_response.c \
lib_federation_termination_notification.c \
lib_idp_entries.c \
lib_idp_entry.c \
lib_idp_list.c \
lib_idp_provided_name_identifier.c \
lib_logout_request.c \
lib_logout_response.c \
lib_name_identifier_mapping_request.c \
lib_name_identifier_mapping_response.c \
lib_old_provided_name_identifier.c \
lib_register_name_identifier_request.c \
lib_register_name_identifier_response.c \
lib_request_authn_context.c \
lib_scoping.c \
lib_sp_provided_name_identifier.c \
lib_status_response.c \
lib_subject.c \
saml_advice.c \
saml_assertion.c \
saml_audience_restriction_condition.c \
saml_authentication_statement.c \
saml_authority_binding.c \
saml_condition_abstract.c \
saml_conditions.c \
saml_name_identifier.c \
saml_statement_abstract.c \
saml_subject.c \
saml_subject_confirmation.c \
saml_subject_locality.c \
saml_subject_statement_abstract.c \
samlp_request_abstract.c \
samlp_response.c \
samlp_response_abstract.c \
samlp_status.c \
samlp_status_code.c
liblassoinclude_HEADERS = \
xml.h \
strings.h \
tools.h \
ds_signature.h \
lib_assertion.h \
lib_authentication_statement.h \
lib_authn_context.h \
lib_authn_request.h \
lib_authn_response.h \
lib_federation_termination_notification.h \
lib_idp_entries.h \
lib_idp_entry.h \
lib_idp_list.h \
lib_idp_provided_name_identifier.h \
lib_logout_request.h \
lib_logout_response.h \
lib_name_identifier_mapping_request.h \
lib_name_identifier_mapping_response.h \
lib_old_provided_name_identifier.h \
lib_register_name_identifier_request.h \
lib_register_name_identifier_response.h \
lib_request_authn_context.h \
lib_scoping.h \
lib_sp_provided_name_identifier.h \
lib_status_response.h \
lib_subject.h \
saml_advice.h \
saml_assertion.h \
saml_audience_restriction_condition.h \
saml_authentication_statement.h \
saml_authority_binding.h \
saml_condition_abstract.h \
saml_conditions.h \
saml_name_identifier.h \
saml_statement_abstract.h \
saml_subject.h \
saml_subject_confirmation.h \
saml_subject_locality.h \
saml_subject_statement_abstract.h \
samlp_request_abstract.h \
samlp_response.h \
samlp_response_abstract.h \
samlp_status.h \
samlp_status_code.h

153
lasso/xml/ds_signature.c Normal file
View File

@ -0,0 +1,153 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/ds_signature.h>
/*
The schema fragment ():
*/
void lasso_ds_signature_sign(LassoDsSignature *node,
const xmlChar *key_file,
const xmlChar *cert_file)
{
xmlNodePtr signature = LASSO_NODE_GET_CLASS(node)->get_xmlNode(node);
xmlSecDSigCtxPtr dsig_ctx = NULL;
/* create signature context */
dsig_ctx = xmlSecDSigCtxCreate(NULL);
if(dsig_ctx == NULL) {
printf("Error: failed to create signature context\n");
}
/* load private key, assuming that there is not password */
dsig_ctx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem,
NULL, NULL, NULL);
if(dsig_ctx->signKey == NULL) {
printf("Error: failed to load private pem key from \"%s\"\n", key_file);
}
/* load certificate and add to the key */
if(xmlSecCryptoAppKeyCertLoad(dsig_ctx->signKey, cert_file, xmlSecKeyDataFormatPem) < 0) {
printf("Error: failed to load pem certificate \"%s\"\n", cert_file);
}
/* sign the template */
if(xmlSecDSigCtxSign(dsig_ctx, signature) < 0) {
printf("Error: signature failed\n");
}
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_ds_signature_instance_init(LassoDsSignature *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
//class->new_ns(node, "http: //www.w3.org/2000/09/xmldsig#", "ds");
//class->set_name(node, "Signature");
}
static void
lasso_ds_signature_class_init(LassoDsSignatureClass *klass)
{
}
GType lasso_ds_signature_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoDsSignatureClass),
NULL,
NULL,
(GClassInitFunc) lasso_ds_signature_class_init,
NULL,
NULL,
sizeof(LassoDsSignature),
0,
(GInstanceInitFunc) lasso_ds_signature_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoDsSignature",
&this_info, 0);
}
return this_type;
}
/**
* lasso_ds_signature_new:
*
* Creates a new <ds:Signature> node object.
*
* Return value: the new @LassoDsDignature
**/
LassoNode* lasso_ds_signature_new(xmlDocPtr doc,
xmlSecTransformId signMethodId)
{
LassoNode *node;
xmlNodePtr signature = NULL;
xmlNodePtr reference = NULL;
xmlNodePtr key_info = NULL;
node = LASSO_NODE(g_object_new(LASSO_TYPE_DS_SIGNATURE, NULL));
//signature = xmlSecTmplSignatureCreate(NULL, xmlSecTransformExclC14NId,
signature = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
signMethodId, NULL);
if (signature == NULL) {
printf("Error: failed to create signature template\n");
}
reference = xmlSecTmplSignatureAddReference(signature,
xmlSecTransformSha1Id,
NULL, NULL, NULL);
if (reference == NULL) {
printf("Error: failed to add reference to signature template\n");
}
// add enveloped transform
if (xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId) == NULL) {
printf("Error: failed to add enveloped transform to reference\n");
}
/* add <dsig:KeyInfo/> and <dsig:X509Data/> */
key_info = xmlSecTmplSignatureEnsureKeyInfo(signature, NULL);
if(key_info == NULL) {
printf("Error: failed to add key info\n");
}
if(xmlSecTmplKeyInfoAddX509Data(key_info) == NULL) {
printf("Error: failed to add X509Data node\n");
}
LASSO_NODE_GET_CLASS(node)->set_node(node, signature);
return (node);
}

65
lasso/xml/ds_signature.h Normal file
View File

@ -0,0 +1,65 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_DS_SIGNATURE_H__
#define __LASSO_DS_SIGNATURE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_DS_SIGNATURE (lasso_ds_signature_get_type())
#define LASSO_DS_SIGNATURE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DS_SIGNATURE, LassoDsSignature))
#define LASSO_DS_SIGNATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DS_SIGNATURE, LassoDsSignatureClass))
#define LASSO_IS_DS_SIGNATURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DS_SIGNATURE))
#define LASSO_IS_DS_SIGNATURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DS_SIGNATURE))
#define LASSO_DS_SIGNATURE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DS_SIGNATURE, LassoDsSignatureClass))
typedef struct _LassoDsSignature LassoDsSignature;
typedef struct _LassoDsSignatureClass LassoDsSignatureClass;
struct _LassoDsSignature {
LassoNode parent;
/*< private >*/
};
struct _LassoDsSignatureClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_ds_signature_get_type(void);
LASSO_EXPORT LassoNode* lasso_ds_signature_new(xmlDocPtr doc,
xmlSecTransformId signMethodId);
LASSO_EXPORT void lasso_ds_signature_sign (LassoDsSignature *node,
const xmlChar* key_file,
const xmlChar* cert_file);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_DS_SIGNATURE_H__ */

59
lasso/xml/lib.h Normal file
View File

@ -0,0 +1,59 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_H__
#define __LASSO_LIB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/lib_assertion.h>
#include <lasso/xml/lib_authentication_statement.h>
#include <lasso/xml/lib_authn_context.h>
#include <lasso/xml/lib_authn_response.h>
#include <lasso/xml/lib_authn_request.h>
#include <lasso/xml/lib_federation_termination_notification.h>
#include <lasso/xml/lib_idp_entries.h>
#include <lasso/xml/lib_idp_entry.h>
#include <lasso/xml/lib_idp_list.h>
#include <lasso/xml/lib_idp_provided_name_identifier.h>
#include <lasso/xml/lib_logout_request.h>
#include <lasso/xml/lib_logout_response.h>
#include <lasso/xml/lib_name_identifier_mapping_request.h>
#include <lasso/xml/lib_name_identifier_mapping_response.h>
#include <lasso/xml/lib_old_provided_name_identifier.h>
#include <lasso/xml/lib_register_name_identifier_request.h>
#include <lasso/xml/lib_register_name_identifier_response.h>
#include <lasso/xml/lib_request_authn_context.h>
#include <lasso/xml/lib_scoping.h>
#include <lasso/xml/lib_sp_provided_name_identifier.h>
#include <lasso/xml/lib_status_response.h>
#include <lasso/xml/lib_subject.h>
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_H__ */

111
lasso/xml/lib_assertion.c Normal file
View File

@ -0,0 +1,111 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_assertion.h>
/*
Authentication assertions provided in an <AuthnResponse> element MUST be of
type AssertionType, which is an extension of saml:AssertionType, so that the
RequestID attribute from the original <AuthnRequest> MAY be included in the
InResponseTo attribute in the <Assertion> element. This is done because it is
not required that the <AuthnResponse> element itself be signed. Instead, the
individual <Assertion> elements contained MUST each be signed. Note that it is
optional for the InResponseTo to be present. Its absence indicates that the
<AuthnResponse> has been unilaterally sent by the identity provider without a
corresponding <AuthnRequest> message from the service provider. If the
attribute is present, it MUST be set to the RequestID of the original
<AuthnRequest>.
The schema fragment is as follows:
<xs:element name="Assertion" type="AssertionType" substitutionGroup="saml:Assertion" />
<xs:complexType name="AssertionType">
<xs:complexContent>
<xs:extension base="saml:AssertionType">
<xs:attribute name="InResponseTo" type="xs:NCName" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_assertion_set_inResponseTo(LassoLibAssertion *node,
const xmlChar *inResponseTo)
{
g_assert(LASSO_IS_LIB_ASSERTION(node));
g_assert(inResponseTo != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "InResponseTo", inResponseTo);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_assertion_instance_init(LassoLibAssertion *instance,
LassoLibAssertionClass *klass) {
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "Assertion");
}
static void
lasso_lib_assertion_class_init(LassoLibAssertionClass *klass) {
}
GType lasso_lib_assertion_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibAssertionClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_assertion_class_init,
NULL,
NULL,
sizeof(LassoLibAssertion),
0,
(GInstanceInitFunc) lasso_lib_assertion_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_ASSERTION,
"LassoLibAssertion",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_assertion_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_ASSERTION, NULL));
}

63
lasso/xml/lib_assertion.h Normal file
View File

@ -0,0 +1,63 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_ASSERTION_H__
#define __LASSO_LIB_ASSERTION_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_assertion.h>
#define LASSO_TYPE_LIB_ASSERTION (lasso_lib_assertion_get_type())
#define LASSO_LIB_ASSERTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_ASSERTION, LassoLibAssertion))
#define LASSO_LIB_ASSERTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_ASSERTION, LassoLibAssertionClass))
#define LASSO_IS_LIB_ASSERTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_ASSERTION))
#define LASSP_IS_LIB_ASSERTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_ASSERTION))
#define LASSO_LIB_ASSERTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_ASSERTION, LassoLibAssertionClass))
typedef struct _LassoLibAssertion LassoLibAssertion;
typedef struct _LassoLibAssertionClass LassoLibAssertionClass;
struct _LassoLibAssertion {
LassoSamlAssertion parent;
/*< private >*/
};
struct _LassoLibAssertionClass {
LassoSamlAssertionClass parent;
};
LASSO_EXPORT GType lasso_lib_assertion_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_assertion_new(void);
LASSO_EXPORT void lasso_lib_assertion_set_inResponseTo (LassoLibAssertion *,
const xmlChar *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_ASSERTION_H__ */

View File

@ -0,0 +1,133 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_authentication_statement.h>
/*
The schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="AuthenticationStatement" type="AuthenticationStatementType" substitutionGroup="saml:Statement"/>
<xs:complexType name="AuthenticationStatementType">
<xs:complexContent>
<xs:extension base="saml:AuthenticationStatementType">
<xs:sequence>
<xs:element ref="AuthnContext" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="ReauthenticateOnOrAfter" type="xs:dateTime" use="optional"/>
<xs:attribute name="SessionIndex" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_authentication_statement_set_authnContext(LassoLibAuthenticationStatement *node,
LassoLibAuthnContext *authnContext)
{
g_assert(LASSO_IS_LIB_AUTHENTICATION_STATEMENT(node));
g_assert(LASSO_IS_LIB_AUTHN_CONTEXT(authnContext));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(authnContext), FALSE);
}
void
lasso_lib_authentication_statement_set_reauthenticateOnOrAfter(LassoLibAuthenticationStatement *node,
const xmlChar *reauthenticateOnOrAfter)
{
g_assert(LASSO_IS_LIB_AUTHENTICATION_STATEMENT(node));
g_assert(reauthenticateOnOrAfter != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "ReauthenticateOnOrAfter", reauthenticateOnOrAfter);
}
void
lasso_lib_authentication_statement_set_sessionIndex(LassoLibAuthenticationStatement *node,
const xmlChar *sessionIndex)
{
g_assert(LASSO_IS_LIB_AUTHENTICATION_STATEMENT(node));
g_assert(sessionIndex != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "SessionIndex", sessionIndex);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_authentication_statement_instance_init(LassoLibAuthenticationStatement *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_name(node, "AuthenticationStatement");
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
}
static void
lasso_lib_authentication_statement_class_init(LassoLibAuthenticationStatementClass *klass)
{
}
GType lasso_lib_authentication_statement_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibAuthenticationStatementClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_authentication_statement_class_init,
NULL,
NULL,
sizeof(LassoLibAuthenticationStatement),
0,
(GInstanceInitFunc) lasso_lib_authentication_statement_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT,
"LassoLibAuthenticationStatement",
&this_info, 0);
}
return this_type;
}
/**
* lasso_lib_authentication_statement_new:
*
* Creates a new <lib:AuthenticationStatement> node object.
*
* Return value: the new @LassoLibAuthenticationStatement
**/
LassoNode* lasso_lib_authentication_statement_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT, NULL));
}

View File

@ -0,0 +1,72 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_AUTHENTICATION_STATEMENT_H__
#define __LASSO_LIB_AUTHENTICATION_STATEMENT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/lasso.h>
#include <lasso/xml/saml_authentication_statement.h>
#include <lasso/xml/lib_authn_context.h>
#define LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT (lasso_lib_authentication_statement_get_type())
#define LASSO_LIB_AUTHENTICATION_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT, LassoLibAuthenticationStatement))
#define LASSO_LIB_AUTHENTICATION_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT, LassoLibAuthenticationStatementClass))
#define LASSO_IS_LIB_AUTHENTICATION_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT))
#define LASSO_IS_LIB_AUTHENTICATION_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT))
#define LASSO_LIB_AUTHENTICATION_STATEMENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT, LassoLibAuthenticationStatementClass))
typedef struct _LassoLibAuthenticationStatement LassoLibAuthenticationStatement;
typedef struct _LassoLibAuthenticationStatementClass LassoLibAuthenticationStatementClass;
struct _LassoLibAuthenticationStatement {
LassoSamlAuthenticationStatement parent;
/*< private >*/
};
struct _LassoLibAuthenticationStatementClass {
LassoSamlAuthenticationStatementClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_lib_authentication_statement_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_authentication_statement_new(void);
LASSO_EXPORT void lasso_lib_authentication_statement_set_authnContext (LassoLibAuthenticationStatement *node,
LassoLibAuthnContext *authnContext);
LASSO_EXPORT void lasso_lib_authentication_statement_set_reauthenticateOnOrAfter (LassoLibAuthenticationStatement *node,
const xmlChar *reauthenticateOnOrAfter);
LASSO_EXPORT void lasso_lib_authentication_statement_set_sessionIndex (LassoLibAuthenticationStatement *node,
const xmlChar *sessionIndex);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_AUTHENTICATION_STATEMENT_H__ */

View File

@ -0,0 +1,124 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_authn_context.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="AuthnContext">
<xs:complexType>
<xs:sequence>
<xs:element name="AuthnContextClassRef" type="xs:anyURI" minOccurs="0"/>
<xs:choice>
<xs:element ref="ac:AuthenticationContextStatement"/>
<xs:element name="AuthnContextStatementRef" type="xs:anyURI"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
From schema liberty-authentication-context-v1.2.xsd:
<xs:element name="AuthenticationContextStatement" type="AuthenticationContextStatementType">
<xs:annotation>
<xs:documentation>
A particular assertion on an identity
provider's part with respect to the authentication
context associated with an authentication assertion.
</xs:documentation>
</xs:annotation>
</xs:element>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_authn_context_set_authnContextClassRef(LassoLibAuthnContext *node,
const xmlChar *authnContextClassRef) {
g_assert(LASSO_IS_LIB_AUTHN_CONTEXT(node));
g_assert(authnContextClassRef != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AuthnContextClassRef",
authnContextClassRef, FALSE);
}
void
lasso_lib_authn_context_set_authnContextStatementRef(LassoLibAuthnContext *node,
const xmlChar *authnContextStatementRef) {
g_assert(LASSO_IS_LIB_AUTHN_CONTEXT(node));
g_assert(authnContextStatementRef != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AuthnContextStatementRef",
authnContextStatementRef, FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_authn_context_instance_init(LassoLibAuthnContext *authnContext)
{
LassoNodeClass *object_class = LASSO_NODE_GET_CLASS(authnContext);
object_class->new_ns(LASSO_NODE(authnContext), "urn:liberty:iff:2003-08", "lib");
object_class->set_name(LASSO_NODE(authnContext), "AuthnContext");
}
static void
lasso_lib_authn_context_class_init(LassoLibAuthnContextClass *klass)
{
}
GType lasso_lib_authn_context_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibAuthnContextClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_authn_context_class_init,
NULL,
NULL,
sizeof(LassoLibAuthnContext),
0,
(GInstanceInitFunc) lasso_lib_authn_context_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoLibAuthnContext",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_authn_context_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHN_CONTEXT,
NULL));
}

View File

@ -0,0 +1,66 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_AUTHN_CONTEXT_H__
#define __LASSO_LIB_AUTHN_CONTEXT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_LIB_AUTHN_CONTEXT (lasso_lib_authn_context_get_type())
#define LASSO_LIB_AUTHN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_AUTHN_CONTEXT, LassoLibAuthnContext))
#define LASSO_LIB_AUTHN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_AUTHN_CONTEXT, LassoLibAuthnContextClass))
#define LASSO_IS_LIB_AUTHN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_AUTHN_CONTEXT))
#define LASSO_IS_LIB_AUTHN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_AUTHN_CONTEXT))
#define LASSO_LIB_AUTHN_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_AUTHN_CONTEXT, LassoLibAuthnContextClass))
typedef struct _LassoLibAuthnContext LassoLibAuthnContext;
typedef struct _LassoLibAuthnContextClass LassoLibAuthnContextClass;
struct _LassoLibAuthnContext {
LassoNode parent;
/*< private >*/
};
struct _LassoLibAuthnContextClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_lib_authn_context_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_authn_context_new(void);
LASSO_EXPORT void lasso_lib_authn_context_set_authnContextClassRef (LassoLibAuthnContext *node,
const xmlChar *authnContextClassRef);
LASSO_EXPORT void lasso_lib_authn_context_set_authnContextStatementRef (LassoLibAuthnContext *node,
const xmlChar *authnContextStatementRef);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_AUTHN_CONTEXT_H__ */

View File

@ -0,0 +1,266 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_authn_request.h>
/*
The <AuthnRequest> is defined as an extension of samlp:RequestAbstractType.
The RequestID attribute in samlp:RequestAbstractType has uniqueness
requirements placed on it by [SAMLCore11], which require it to have the
properties of a nonce.
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="AuthnRequest" type="AuthnRequestType" />
<xs:complexType name="AuthnRequestType">
<xs:complexContent>
<xs:extension base="samlp:RequestAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="AffiliationID" minOccurs="0"/>
<xs:element ref="NameIDPolicy" minOccurs="0"/>
<xs:element name="ForceAuthn" type="xs:boolean" minOccurs="0"/>
<xs:element name="IsPassive" type="xs:boolean "minOccurs="0"/>
<xs:element ref="ProtocolProfile" minOccurs="0"/>
<xs:element name="AssertionConsumerServiceID" type="xs:string" minOccurs="0"/>
<xs:element ref="RequestAuthnContext" minOccurs="0"/>
<xs:element ref="RelayState" minOccurs="0"/>
<xs:element ref="Scoping" minOccurs="0 "/>
</xs:sequence>
<xs:attribute ref="consent" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProviderID" type="md:entityIDType"/>
<xs:element name="AffiliationID" type="md:entityIDType"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="NameIDPolicy" type="NameIDPolicyType"/>
<xs:simpleType name="NameIDPolicyType">
<xs:restriction base="xs:string">
<xs:enumeration value="none"/>
<xs:enumeration value="onetime"/>
<xs:enumeration value="federated"/>
<xs:enumeration value="any"/ >
</xs:restriction>
</xs:simpleType>
<xs:element name="ProtocolProfile" type="xs:anyURI"/>
<xs:element name="RelayState" type="xs:string"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_authn_request_set_affiliationID(LassoLibAuthnRequest *node,
const xmlChar *affiliationID) {
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(affiliationID != NULL);
// FIXME : affiliationID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AffiliationID", affiliationID, FALSE);
}
void
lasso_lib_authn_request_set_assertionConsumerServiceID(LassoLibAuthnRequest *node,
const xmlChar *assertionConsumerServiceID) {
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(assertionConsumerServiceID != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AssertionConsumerServiceID",
assertionConsumerServiceID, FALSE);
}
void
lasso_lib_authn_request_set_consent(LassoLibAuthnRequest *node,
const xmlChar *consent)
{
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(consent != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "consent", consent);
}
void
lasso_lib_authn_request_set_forceAuthn(LassoLibAuthnRequest *node,
const xmlChar *forceAuthn) {
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(forceAuthn != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ForceAuthn", forceAuthn, FALSE);
}
void
lasso_lib_authn_request_set_isPassive(LassoLibAuthnRequest *node,
const xmlChar *isPassive) {
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(isPassive != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "IsPassive", isPassive, FALSE);
}
/**
* lasso_lib_authn_request_set_nameIDPolicy:
* @node: the pointer to <lib:AuthnRequest> node
* @nameIDPolicy: the value of "NameIDPolicy" attribut.
*
* Sets the "NameIDPolicy" attribut. It's an enumeration permitting requester
* influence over name identifier policy at the identity provider.
**/
void
lasso_lib_authn_request_set_nameIDPolicy(LassoLibAuthnRequest *node,
const xmlChar *nameIDPolicy)
{
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(nameIDPolicy != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "NameIDPolicy", nameIDPolicy, FALSE);
}
void
lasso_lib_authn_request_set_protocolProfile(LassoLibAuthnRequest *node,
const xmlChar *protocolProfile)
{
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(protocolProfile != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProtocolProfile", protocolProfile, FALSE);
}
void
lasso_lib_authn_request_set_providerID(LassoLibAuthnRequest *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(providerID != NULL);
// FIXME : providerID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_authn_request_set_relayState(LassoLibAuthnRequest *node,
const xmlChar *relayState) {
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(relayState != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE);
}
void
lasso_lib_authn_request_set_requestAuthnContext(LassoLibAuthnRequest *node,
LassoLibRequestAuthnContext *requestAuthnContext) {
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT(requestAuthnContext));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node),
LASSO_NODE (requestAuthnContext),
FALSE);
}
/**
* lasso_lib_authn_request_set_scoping:
* @node: the pointer to <lib:AuthnRequest/> node object
* @scoping: the pointer to <lib:Scoping/> node object
*
* Sets the "Scoping" element.
**/
void
lasso_lib_authn_request_set_scoping(LassoLibAuthnRequest *node,
LassoLibScoping *scoping)
{
g_assert(LASSO_IS_LIB_AUTHN_REQUEST(node));
g_assert(LASSO_IS_LIB_SCOPING(scoping));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node),
LASSO_NODE (scoping),
FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_authn_request_instance_init(LassoLibAuthnRequest *authnRequest)
{
LassoNodeClass *object_class = LASSO_NODE_GET_CLASS(authnRequest);
object_class->new_ns(LASSO_NODE(authnRequest), "urn:liberty:iff:2003-08", "lib");
object_class->set_name(LASSO_NODE(authnRequest), "AuthnRequest");
}
static void
lasso_lib_authn_request_class_init(LassoLibAuthnRequestClass *klass)
{
}
GType lasso_lib_authn_request_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibAuthnRequestClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_authn_request_class_init,
NULL,
NULL,
sizeof(LassoLibAuthnRequest),
0,
(GInstanceInitFunc) lasso_lib_authn_request_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
"LassoLibAuthnRequest",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_authn_request_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHN_REQUEST,
NULL));
}

View File

@ -0,0 +1,95 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_AUTHN_REQUEST_H__
#define __LASSO_LIB_AUTHN_REQUEST_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/samlp_request_abstract.h>
#include <lasso/xml/lib_request_authn_context.h>
#include <lasso/xml/lib_scoping.h>
#define LASSO_TYPE_LIB_AUTHN_REQUEST (lasso_lib_authn_request_get_type())
#define LASSO_LIB_AUTHN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_AUTHN_REQUEST, LassoLibAuthnRequest))
#define LASSO_LIB_AUTHN_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_AUTHN_REQUEST, LassoLibAuthnRequestClass))
#define LASSO_IS_LIB_AUTHN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_AUTHN_REQUEST))
#define LASSO_IS_LIB_AUTHN_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_AUTHN_REQUEST))
#define LASSO_LIB_AUTHN_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_AUTHN_REQUEST, LassoLibAuthnRequestClass))
typedef struct _LassoLibAuthnRequest LassoLibAuthnRequest;
typedef struct _LassoLibAuthnRequestClass LassoLibAuthnRequestClass;
struct _LassoLibAuthnRequest {
LassoSamlpRequestAbstract parent;
/*< private >*/
};
struct _LassoLibAuthnRequestClass {
LassoSamlpRequestAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_authn_request_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_authn_request_new(void);
LASSO_EXPORT void lasso_lib_authn_request_set_affiliationID (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_assertionConsumerServiceID (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_consent (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_forceAuthn (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_isPassive (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_nameIDPolicy (LassoLibAuthnRequest *node,
const xmlChar *nameIDPolicy);
LASSO_EXPORT void lasso_lib_authn_request_set_protocolProfile (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_providerID (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_relayState (LassoLibAuthnRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_request_set_requestAuthnContext (LassoLibAuthnRequest *,
LassoLibRequestAuthnContext *);
LASSO_EXPORT void lasso_lib_authn_request_set_scoping (LassoLibAuthnRequest *node,
LassoLibScoping *scoping);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_AUTHN_REQUEST_H__ */

View File

@ -0,0 +1,138 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_authn_response.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="AuthnResponse" type="AuthnResponseType"/>
<xs:complexType name="AuthnResponseType">
<xs:complexContent>
<xs:extension base="samlp:ResponseType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="RelayState" minOccurs="0"/>
</xs:sequence>
<xs:attribute ref="consent" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProviderID" type="md:entityIDType"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="RelayState" type="xs:string"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_authn_response_set_consent(LassoLibAuthnResponse *node,
const xmlChar *consent)
{
g_assert(LASSO_IS_LIB_AUTHN_RESPONSE(node));
g_assert(consent != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "consent", consent);
}
void
lasso_lib_authn_response_set_providerID(LassoLibAuthnResponse *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_AUTHN_RESPONSE(node));
g_assert(providerID != NULL);
// FIXME : providerID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_authn_response_set_relayState(LassoLibAuthnResponse *node,
const xmlChar *relayState)
{
g_assert(LASSO_IS_LIB_AUTHN_RESPONSE(node));
g_assert(relayState != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_authn_response_instance_init(LassoLibAuthnResponse *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "AuthnResponse");
}
static void
lasso_lib_authn_response_class_init(LassoLibAuthnResponseClass *klass)
{
}
GType lasso_lib_authn_response_get_type() {
static GType authn_response_type = 0;
if (!authn_response_type) {
static const GTypeInfo authn_response_info = {
sizeof (LassoLibAuthnResponseClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_authn_response_class_init,
NULL,
NULL,
sizeof(LassoLibAuthnResponse),
0,
(GInstanceInitFunc) lasso_lib_authn_response_instance_init,
};
authn_response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE,
"LassoLibAuthnResponse",
&authn_response_info, 0);
}
return authn_response_type;
}
LassoNode* lasso_lib_authn_response_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_AUTHN_RESPONSE, NULL));
}

View File

@ -0,0 +1,69 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_AUTHN_RESPONSE_H__
#define __LASSO_LIB_AUTHN_RESPONSE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/samlp_response.h>
#define LASSO_TYPE_LIB_AUTHN_RESPONSE (lasso_lib_authn_response_get_type())
#define LASSO_LIB_AUTHN_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_AUTHN_RESPONSE, LassoLibAuthnResponse))
#define LASSO_LIB_AUTHN_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_AUTHN_RESPONSE, LassoLibAuthnResponseClass))
#define LASSO_IS_LIB_AUTHN_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_AUTHN_RESPONSE))
#define LASSO_IS_LIB_AUTHN_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_AUTHN_RESPONSE))
#define LASSO_LIB_AUTHN_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_AUTHN_RESPONSE, LassoLibAuthnResponseClass))
typedef struct _LassoLibAuthnResponse LassoLibAuthnResponse;
typedef struct _LassoLibAuthnResponseClass LassoLibAuthnResponseClass;
struct _LassoLibAuthnResponse {
LassoSamlpResponse parent;
/*< private >*/
};
struct _LassoLibAuthnResponseClass {
LassoSamlpResponseClass parent;
};
LASSO_EXPORT GType lasso_lib_authn_response_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_authn_response_new(void);
LASSO_EXPORT void lasso_lib_authn_response_set_consent (LassoLibAuthnResponse *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_response_set_providerID (LassoLibAuthnResponse *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_authn_response_set_relayState (LassoLibAuthnResponse *,
const xmlChar *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_AUTHN_RESPONSE_H__ */

View File

@ -0,0 +1,140 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Valery Febvre <vfebvre@easter-eggs.com>
* Nicolas Clapies <nclapies@entrouvert.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_federation_termination_notification.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="FederationTerminationNotification" type="FederationTerminationNotificationType"/>
<xs:complexType name="FederationTerminationNotificationType">
<xs:complexContent>
<xs:extension base="samlp:RequestAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="saml:NameIdentifier"/>
</xs:sequence>
<xs:attribute ref="consent" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProviderID" type="md:entityIDType"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_federation_termination_notification_set_consent(LassoLibFederationTerminationNotification *node,
const xmlChar *consent)
{
g_assert(LASSO_IS_LIB_FEDERATION_TERMINATION_NOTIFICATION(node));
g_assert(consent != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "consent", consent);
}
void
lasso_lib_federation_termination_notification_set_providerID(LassoLibFederationTerminationNotification *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_FEDERATION_TERMINATION_NOTIFICATION(node));
g_assert(providerID != NULL);
// FIXME : providerId lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_federation_termination_notification_set_nameIdentifier(LassoLibFederationTerminationNotification *node,
LassoSamlNameIdentifier *nameIdentifier)
{
g_assert(LASSO_IS_LIB_FEDERATION_TERMINATION_NOTIFICATION(node));
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (nameIdentifier), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_federation_termination_notification_instance_init(LassoLibFederationTerminationNotification *federationTerminationNotification)
{
LassoNodeClass *object_class = LASSO_NODE_GET_CLASS(federationTerminationNotification);
object_class->new_ns(LASSO_NODE(federationTerminationNotification),
"urn:liberty:iff:2003-08", "lib");
object_class->set_name(LASSO_NODE(federationTerminationNotification),
"FederationTerminationNotification");
}
static void
lasso_lib_federation_termination_notification_class_init(LassoLibFederationTerminationNotificationClass *klass)
{
}
GType lasso_lib_federation_termination_notification_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibFederationTerminationNotificationClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_federation_termination_notification_class_init,
NULL,
NULL,
sizeof(LassoLibFederationTerminationNotification),
0,
(GInstanceInitFunc) lasso_lib_federation_termination_notification_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
"LassoLibFederationTerminationNotification",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_federation_termination_notification_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION,
NULL));
}

View File

@ -0,0 +1,70 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION_H__
#define __LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_name_identifier.h>
#include <lasso/xml/samlp_request_abstract.h>
#define LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION (lasso_lib_federation_termination_notification_get_type())
#define LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION, LassoLibFederationTerminationNotification))
#define LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION, LassoLibFederationTerminationNotificationClass))
#define LASSO_IS_LIB_FEDERATION_TERMINATION_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION))
#define LASSO_IS_LIB_FEDERATION_TERMINATION_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION))
#define LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION, LassoLibFederationTerminationNotificationClass))
typedef struct _LassoLibFederationTerminationNotification LassoLibFederationTerminationNotification;
typedef struct _LassoLibFederationTerminationNotificationClass LassoLibFederationTerminationNotificationClass;
struct _LassoLibFederationTerminationNotification {
LassoSamlpRequestAbstract parent;
/*< private >*/
};
struct _LassoLibFederationTerminationNotificationClass {
LassoSamlpRequestAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_federation_termination_notification_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_federation_termination_notification_new(void);
LASSO_EXPORT void lasso_lib_federation_termination_notification_set_consent (LassoLibFederationTerminationNotification *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_federation_termination_notification_set_providerID (LassoLibFederationTerminationNotification *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_federation_termination_notification_set_nameIdentifier (LassoLibFederationTerminationNotification *,
LassoSamlNameIdentifier *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION_H__ */

115
lasso/xml/lib_idp_entries.c Normal file
View File

@ -0,0 +1,115 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_idp_entries.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="IDPEntries">
<xs:complexType>
<xs:sequence>
<xs:element ref="IDPEntry" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
/**
* lasso_lib_idp_entries_add_idpEntry:
* @node: the pointer to <lib:IDPEntries/> node object
* @idpEntry: the pointer to <lib:IDPEntry/> node object
*
* Adds an "IDPEntry" element [required].
*
* It describes an identity provider that the service provider supports.
**/
void
lasso_lib_idp_entries_add_idpEntry(LassoLibIDPEntries *node,
LassoLibIDPEntry *idpEntry)
{
g_assert(LASSO_IS_LIB_IDP_ENTRIES(node));
g_assert(LASSO_IS_LIB_IDP_ENTRY(idpEntry));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(idpEntry), TRUE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_idp_entries_instance_init(LassoLibIDPEntries *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "IDPEntries");
}
static void
lasso_lib_idp_entries_class_init(LassoLibIDPEntriesClass *klass)
{
}
GType lasso_lib_idp_entries_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibIDPEntriesClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_idp_entries_class_init,
NULL,
NULL,
sizeof(LassoLibIDPEntries),
0,
(GInstanceInitFunc) lasso_lib_idp_entries_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoLibIDPEntries",
&this_info, 0);
}
return this_type;
}
/**
* lasso_lib_idp_entries_new:
*
* Creates a new "<lib:IDPEntries/>" node object.
*
* Return value: the new @LassoLibIDPEntries
**/
LassoNode* lasso_lib_idp_entries_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_IDP_ENTRIES, NULL));
}

View File

@ -0,0 +1,64 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_IDP_ENTRIES_H__
#define __LASSO_LIB_IDP_ENTRIES_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/lib_idp_entry.h>
#define LASSO_TYPE_LIB_IDP_ENTRIES (lasso_lib_idp_entries_get_type())
#define LASSO_LIB_IDP_ENTRIES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_IDP_ENTRIES, LassoLibIDPEntries))
#define LASSO_LIB_IDP_ENTRIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_IDP_ENTRIES, LassoLibIDPEntriesClass))
#define LASSO_IS_LIB_IDP_ENTRIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_IDP_ENTRIES))
#define LASSO_IS_LIB_IDP_ENTRIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_IDP_ENTRIES))
#define LASSO_LIB_IDP_ENTRIES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_IDP_ENTRIES, LassoLibIDPEntriesClass))
typedef struct _LassoLibIDPEntries LassoLibIDPEntries;
typedef struct _LassoLibIDPEntriesClass LassoLibIDPEntriesClass;
struct _LassoLibIDPEntries{
LassoNode parent;
/*< private >*/
};
struct _LassoLibIDPEntriesClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_lib_idp_entries_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_idp_entries_new(void);
LASSO_EXPORT void lasso_lib_idp_entries_add_idpEntry (LassoLibIDPEntries *node,
LassoLibIDPEntry *idpEntry);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_IDP_ENTRIES_H__ */

160
lasso/xml/lib_idp_entry.c Normal file
View File

@ -0,0 +1,160 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_idp_entry.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="IDPEntry">
<xs:complexType>
<xs:sequence>
<xs:element ref="ProviderID"/>
<xs:element name="ProviderName" type="xs:string" minOccurs="0"/>
<xs:element name="Loc" type="xs:anyURI"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
/**
* lasso_lib_idp_entry_set_providerID:
* @node: the pointer to <lib:IDPEntry/> node object
* @providerID: the value of "ProviderID" element
*
* Sets the "ProviderID" element [required].
*
* It's the identity provider's unique identifier.
**/
void
lasso_lib_idp_entry_set_providerID(LassoLibIDPEntry *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_IDP_ENTRY(node));
g_assert(providerID != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
/**
* lasso_lib_idp_entry_set_providerName:
* @node: the pointer to <lib:IDPEntry/> node object
* @providerName: the value of "ProviderName" element
*
* Sets the "ProviderName" element [optional].
*
* It's the identity provider's human-readable name.
**/
void
lasso_lib_idp_entry_set_providerName(LassoLibIDPEntry *node,
const xmlChar *providerName)
{
g_assert(LASSO_IS_LIB_IDP_ENTRY(node));
g_assert(providerName != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderName", providerName, FALSE);
}
/**
* lasso_lib_idp_entry_set_loc:
* @node: the pointer to <lib:IDPEntry/> node object
* @loc: the value of "Loc" element
*
* Sets the "Loc" element [optional].
*
* It's the identity provider's URI, to which authentication requests may be
* sent. If present, this MUST be set to the value of the identity provider's
* <SingleSignOnService> element, obtained from their metadata
* ([LibertyMetadata]).
**/
void
lasso_lib_idp_entry_set_loc(LassoLibIDPEntry *node,
const xmlChar *loc)
{
g_assert(LASSO_IS_LIB_IDP_ENTRY(node));
g_assert(loc != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "Loc", loc, FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_idp_entry_instance_init(LassoLibIDPEntry *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "IDPEntry");
}
static void
lasso_lib_idp_entry_class_init(LassoLibIDPEntryClass *klass)
{
}
GType lasso_lib_idp_entry_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibIDPEntryClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_idp_entry_class_init,
NULL,
NULL,
sizeof(LassoLibIDPEntry),
0,
(GInstanceInitFunc) lasso_lib_idp_entry_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoLibIDPEntry",
&this_info, 0);
}
return this_type;
}
/**
* lasso_lib_idp_entry_new:
*
* Creates a new <lib:IDPEntry/> node object.
*
* Return value: the new @LassoLibIDPEntry
**/
LassoNode* lasso_lib_idp_entry_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_IDP_ENTRY, NULL));
}

69
lasso/xml/lib_idp_entry.h Normal file
View File

@ -0,0 +1,69 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_IDP_ENTRY_H__
#define __LASSO_LIB_IDP_ENTRY_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_LIB_IDP_ENTRY (lasso_lib_idp_entry_get_type())
#define LASSO_LIB_IDP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_IDP_ENTRY, LassoLibIDPEntry))
#define LASSO_LIB_IDP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_IDP_ENTRY, LassoLibIDPEntryClass))
#define LASSO_IS_LIB_IDP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_IDP_ENTRY))
#define LASSO_IS_LIB_IDP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_IDP_ENTRY))
#define LASSO_LIB_IDP_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_IDP_ENTRY, LassoLibIDPEntryClass))
typedef struct _LassoLibIDPEntry LassoLibIDPEntry;
typedef struct _LassoLibIDPEntryClass LassoLibIDPEntryClass;
struct _LassoLibIDPEntry{
LassoNode parent;
/*< private >*/
};
struct _LassoLibIDPEntryClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_lib_idp_entry_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_idp_entry_new(void);
LASSO_EXPORT void lasso_lib_idp_entry_set_providerID (LassoLibIDPEntry *node,
const xmlChar *providerID);
LASSO_EXPORT void lasso_lib_idp_entry_set_providerName (LassoLibIDPEntry *node,
const xmlChar *providerName);
LASSO_EXPORT void lasso_lib_idp_entry_set_loc (LassoLibIDPEntry *node,
const xmlChar *loc);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_IDP_ENTRY_H__ */

142
lasso/xml/lib_idp_list.c Normal file
View File

@ -0,0 +1,142 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_idp_list.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="IDPList" type="IDPListType"/>
<xs:complexType name="IDPListType">
<xs:sequence>
<xs:element ref="IDPEntries"/>
<xs:element ref="GetComplete" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="GetComplete" type="xs:anyURI"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
/**
* lasso_lib_idp_list_set_getComplete:
* @node: the pointer to <lib:IDPList/> node object
* @getComplete: the value of "GetComplete" element.
*
* Sets the "GetComplete" element [optional].
*
* If the identity provider list is not complete, this element may be included
* with a URI that points to where the complete list can be retrieved.
**/
void
lasso_lib_idp_list_set_getComplete(LassoLibIDPList *node,
const xmlChar *getComplete)
{
g_assert(LASSO_IS_LIB_IDP_LIST(node));
g_assert(getComplete != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "GetComplete", getComplete, FALSE);
}
/**
* lasso_lib_idp_list_set_idpEntries:
* @node: the pointer to <lib:IDPList/> node object
* @idpEntries: the pointer to <lib:IDPEntries/> node object
*
* Set the "IDPEntries" element [required].
*
* It contains a list of identity provider entries.
**/
void
lasso_lib_idp_list_set_idpEntries(LassoLibIDPList *node,
LassoLibIDPEntries *idpEntries)
{
g_assert(LASSO_IS_LIB_IDP_LIST(node));
g_assert(LASSO_IS_LIB_IDP_ENTRIES(idpEntries));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(idpEntries), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_idp_list_instance_init(LassoLibIDPList *instance)
{
LassoNode *node = (LassoNode *)instance;
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "IDPList");
}
static void
lasso_lib_idp_list_class_init(LassoLibIDPListClass *klass)
{
}
GType lasso_lib_idp_list_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibIDPListClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_idp_list_class_init,
NULL,
NULL,
sizeof(LassoLibIDPList),
0,
(GInstanceInitFunc) lasso_lib_idp_list_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoLibIDPList",
&this_info, 0);
}
return this_type;
}
/**
* lasso_lib_idp_list_new:
*
* Creates a new <lib:IDPList/> node object.
*
* In the request envelope, some profiles may wish to allow the service
* provider to transport a list of identity providers to the user agent. This
* specification provides a schema that profiles SHOULD use for this purpose.
*
* Return value: the new @LassoLibIDPList
**/
LassoNode* lasso_lib_idp_list_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_IDP_LIST, NULL));
}

67
lasso/xml/lib_idp_list.h Normal file
View File

@ -0,0 +1,67 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_IDP_LIST_H__
#define __LASSO_LIB_IDP_LIST_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/lib_idp_entries.h>
#define LASSO_TYPE_LIB_IDP_LIST (lasso_lib_idp_list_get_type())
#define LASSO_LIB_IDP_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_IDP_LIST, LassoLibIDPList))
#define LASSO_LIB_IDP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_IDP_LIST, LassoLibIDPListClass))
#define LASSO_IS_LIB_IDP_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_IDP_LIST))
#define LASSO_IS_LIB_IDP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_IDP_LIST))
#define LASSO_LIB_IDP_LIST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_IDP_LIST, LassoLibIDPListClass))
typedef struct _LassoLibIDPList LassoLibIDPList;
typedef struct _LassoLibIDPListClass LassoLibIDPListClass;
struct _LassoLibIDPList {
LassoNode parent;
/*< private >*/
};
struct _LassoLibIDPListClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_lib_idp_list_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_idp_list_new(void);
LASSO_EXPORT void lasso_lib_idp_list_set_getComplete (LassoLibIDPList *node,
const xmlChar *getComplete);
LASSO_EXPORT void lasso_lib_idp_list_set_idpEntries (LassoLibIDPList *node,
LassoLibIDPEntries *idpEntries);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_IDP_LIST_H__ */

View File

@ -0,0 +1,78 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_idp_provided_name_identifier.h>
/*
<xs:element name="IDPProvidedNameIdentifier" type="saml:NameIdentifierType"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_idp_provided_name_identifier_instance_init(LassoLibIDPProvidedNameIdentifier *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "IDPProvidedNameIdentifier");
}
static void
lasso_lib_idp_provided_name_identifier_class_init(LassoLibIDPProvidedNameIdentifierClass *klass)
{
}
GType lasso_lib_idp_provided_name_identifier_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibIDPProvidedNameIdentifierClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_idp_provided_name_identifier_class_init,
NULL,
NULL,
sizeof(LassoLibIDPProvidedNameIdentifierClass),
0,
(GInstanceInitFunc) lasso_lib_idp_provided_name_identifier_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_NAME_IDENTIFIER,
"LassoLibIDPProvidedNameIdentifier",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_idp_provided_name_identifier_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER,
NULL));
}

View File

@ -0,0 +1,60 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER_H__
#define __LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_name_identifier.h>
#define LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER (lasso_lib_idp_provided_name_identifier_get_type())
#define LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER, LassoLibIDPProvidedNameIdentifier))
#define LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER, LassoLibIDPProvidedNameIdentifierClass))
#define LASSO_IS_LIB_IDP_PROVIDED_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER))
#define LASSO_IS_LIB_IDP_PROVIDED_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER))
#define LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_IDP_PROVIDED_NAME_IDENTIFIER, LassoLibIDPProvidedNameIdentifierClass))
typedef struct _LassoLibIDPProvidedNameIdentifier LassoLibIDPProvidedNameIdentifier;
typedef struct _LassoLibIDPProvidedNameIdentifierClass LassoLibIDPProvidedNameIdentifierClass;
struct _LassoLibIDPProvidedNameIdentifier {
LassoSamlNameIdentifier parent;
/*< private >*/
};
struct _LassoLibIDPProvidedNameIdentifierClass {
LassoSamlNameIdentifierClass parent;
};
LASSO_EXPORT GType lasso_lib_idp_provided_name_identifier_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_idp_provided_name_identifier_new(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER_H__ */

View File

@ -0,0 +1,158 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_logout_request.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="LogoutRequest" type="LogoutRequestType"/>
<xs:complexType name="LogoutRequestType">
<xs:complexContent>
<xs:extension base="samlp:RequestAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="saml:NameIdentifier"/>
<xs:element name="SessionIndex" type="xs:string" minOccurs="0"/>
<xs:element ref="RelayState" minOccurs="0"/>
</xs:sequence>
<xs:attribute ref="consent" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProviderID" type="md:entityIDType"/>
<xs:element name="RelayState" type="xs:string"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_logout_request_set_consent(LassoLibLogoutRequest *node,
const xmlChar *consent)
{
g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
g_assert(consent != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "consent", consent);
}
void
lasso_lib_logout_request_set_providerID(LassoLibLogoutRequest *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
g_assert(providerID != NULL);
// FIXME : providerID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_logout_request_set_relayState(LassoLibLogoutRequest *node,
const xmlChar *relayState) {
g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
g_assert(relayState != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE);
}
void
lasso_lib_logout_request_set_sessionIndex(LassoLibLogoutRequest *node,
const xmlChar *sessionIndex) {
g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
g_assert(sessionIndex != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "SessionIndex", sessionIndex, FALSE);
}
void
lasso_lib_logout_request_set_nameIdentifier(LassoLibLogoutRequest *node,
LassoSamlNameIdentifier *nameIdentifier) {
g_assert(LASSO_IS_LIB_LOGOUT_REQUEST(node));
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (nameIdentifier), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_logout_request_instance_init(LassoLibLogoutRequest *logoutRequest)
{
LassoNodeClass *object_class = LASSO_NODE_GET_CLASS(logoutRequest);
object_class->new_ns(LASSO_NODE(logoutRequest), "urn:liberty:iff:2003-08", "lib");
object_class->set_name(LASSO_NODE(logoutRequest), "LogoutRequest");
}
static void
lasso_lib_logout_request_class_init(LassoLibLogoutRequestClass *klass)
{
}
GType lasso_lib_logout_request_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibLogoutRequestClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_logout_request_class_init,
NULL,
NULL,
sizeof(LassoLibLogoutRequest),
0,
(GInstanceInitFunc) lasso_lib_logout_request_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
"LassoLibLogoutRequest",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_logout_request_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_LOGOUT_REQUEST,
NULL));
}

View File

@ -0,0 +1,76 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_LOGOUT_REQUEST_H__
#define __LASSO_LIB_LOGOUT_REQUEST_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_name_identifier.h>
#include <lasso/xml/samlp_request_abstract.h>
#define LASSO_TYPE_LIB_LOGOUT_REQUEST (lasso_lib_logout_request_get_type())
#define LASSO_LIB_LOGOUT_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_LOGOUT_REQUEST, LassoLibLogoutRequest))
#define LASSO_LIB_LOGOUT_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_LOGOUT_REQUEST, LassoLibLogoutRequestClass))
#define LASSO_IS_LIB_LOGOUT_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_LOGOUT_REQUEST))
#define LASSO_IS_LIB_LOGOUT_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_LOGOUT_REQUEST))
#define LASSO_LIB_LOGOUT_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_LOGOUT_REQUEST, LassoLibLogoutRequestClass))
typedef struct _LassoLibLogoutRequest LassoLibLogoutRequest;
typedef struct _LassoLibLogoutRequestClass LassoLibLogoutRequestClass;
struct _LassoLibLogoutRequest {
LassoSamlpRequestAbstract parent;
/*< private >*/
};
struct _LassoLibLogoutRequestClass {
LassoSamlpRequestAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_logout_request_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_logout_request_new(void);
LASSO_EXPORT void lasso_lib_logout_request_set_consent (LassoLibLogoutRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_logout_request_set_providerId (LassoLibLogoutRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_logout_request_set_relayState (LassoLibLogoutRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_logout_request_set_sessionIndex (LassoLibLogoutRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_logout_request_set_nameIdentifier (LassoLibLogoutRequest *,
LassoSamlNameIdentifier *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_LOGOUT_REQUEST_H__ */

View File

@ -0,0 +1,79 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_logout_response.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="LogoutResponse" type="StatusResponseType"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_logout_response_instance_init(LassoLibLogoutResponse *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "LogoutResponse");
}
static void
lasso_lib_logout_response_class_init(LassoLibLogoutResponseClass *klass)
{
}
GType lasso_lib_logout_response_get_type() {
static GType logout_response_type = 0;
if (!logout_response_type) {
static const GTypeInfo logout_response_info = {
sizeof (LassoLibLogoutResponseClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_logout_response_class_init,
NULL,
NULL,
sizeof(LassoLibLogoutResponse),
0,
(GInstanceInitFunc) lasso_lib_logout_response_instance_init,
};
logout_response_type = g_type_register_static(LASSO_TYPE_LIB_STATUS_RESPONSE,
"LassoLibLogoutResponse",
&logout_response_info, 0);
}
return logout_response_type;
}
LassoNode* lasso_lib_logout_response_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_LOGOUT_RESPONSE, NULL));
}

View File

@ -0,0 +1,60 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_LOGOUT_RESPONSE_H__
#define __LASSO_LIB_LOGOUT_RESPONSE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/lib_status_response.h>
#define LASSO_TYPE_LIB_LOGOUT_RESPONSE (lasso_lib_logout_response_get_type())
#define LASSO_LIB_LOGOUT_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_LOGOUT_RESPONSE, LassoLibLogoutResponse))
#define LASSO_LIB_LOGOUT_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_LOGOUT_RESPONSE, LassoLibLogoutResponseClass))
#define LASSO_IS_LIB_LOGOUT_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_LOGOUT_RESPONSE))
#define LASSO_IS_LIB_LOGOUT_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_LOGOUT_RESPONSE))
#define LASSO_LIB_LOGOUT_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_LOGOUT_RESPONSE, LassoLibLogoutResponseClass))
typedef struct _LassoLibLogoutResponse LassoLibLogoutResponse;
typedef struct _LassoLibLogoutResponseClass LassoLibLogoutResponseClass;
struct _LassoLibLogoutResponse {
LassoLibStatusResponse parent;
/*< private >*/
};
struct _LassoLibLogoutResponseClass {
LassoLibStatusResponseClass parent;
};
LASSO_EXPORT GType lasso_lib_logout_response_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_logout_response_new(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_LOGOUT_RESPONSE_H__ */

View File

@ -0,0 +1,136 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_name_identifier_mapping_request.h>
/*
The schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
<xs:element name="NameIdentifierMappingRequest" type="NameIdentifierMappingRequestType"/>
<xs:complexType name="NameIdentifierMappingRequestType">
<xs:complexContent>
<xs:extension base="samlp:RequestAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="saml:NameIdentifier"/>
<xs:element name="TargetNamespace" type="md:entityIDType"/>
</xs:sequence>
<xs:attribute ref="consent" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProviderID" type="md:entityIDType"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_name_identifier_mapping_request_set_consent(LassoLibNameIdentifierMappingRequest *node,
const xmlChar *consent)
{
g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(node));
g_assert(consent != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "consent", consent);
}
void
lasso_lib_name_identifier_mapping_request_set_providerID(LassoLibNameIdentifierMappingRequest *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(node));
g_assert(providerID != NULL);
// FIXME : providerId lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_name_identifier_mapping_request_set_nameIdentifier(LassoLibNameIdentifierMappingRequest *node,
LassoSamlNameIdentifier *nameIdentifier) {
g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(node));
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (nameIdentifier), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_name_identifier_mapping_request_instance_init(LassoLibNameIdentifierMappingRequest *nameIdentifierMappingRequest)
{
LassoNodeClass *object_class = LASSO_NODE_GET_CLASS(nameIdentifierMappingRequest);
object_class->new_ns(LASSO_NODE(nameIdentifierMappingRequest), "urn:liberty:iff:2003-08", "lib");
object_class->set_name(LASSO_NODE(nameIdentifierMappingRequest), "NameIdentifierMappingRequest");
}
static void
lasso_lib_name_identifier_mapping_request_class_init(LassoLibNameIdentifierMappingRequestClass *klass)
{
}
GType lasso_lib_name_identifier_mapping_request_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibNameIdentifierMappingRequestClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_name_identifier_mapping_request_class_init,
NULL,
NULL,
sizeof(LassoLibNameIdentifierMappingRequest),
0,
(GInstanceInitFunc) lasso_lib_name_identifier_mapping_request_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
"LassoLibNameIdentifierMappingRequest",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_name_identifier_mapping_request_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST,
NULL));
}

View File

@ -0,0 +1,70 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST_H__
#define __LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_name_identifier.h>
#include <lasso/xml/samlp_request_abstract.h>
#define LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST (lasso_lib_name_identifier_mapping_request_get_type())
#define LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST, LassoLibNameIdentifierMappingRequest))
#define LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST, LassoLibNameIdentifierMappingRequestClass))
#define LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST))
#define LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST))
#define LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST, LassoLibNameIdentifierMappingRequestClass))
typedef struct _LassoLibNameIdentifierMappingRequest LassoLibNameIdentifierMappingRequest;
typedef struct _LassoLibNameIdentifierMappingRequestClass LassoLibNameIdentifierMappingRequestClass;
struct _LassoLibNameIdentifierMappingRequest {
LassoSamlpRequestAbstract parent;
/*< private >*/
};
struct _LassoLibNameIdentifierMappingRequestClass {
LassoSamlpRequestAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_name_identifier_mapping_request_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_name_identifier_mapping_request_new(void);
LASSO_EXPORT void lasso_lib_name_identifier_mapping_request_set_consent (LassoLibNameIdentifierMappingRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_name_identifier_mapping_request_set_providerID (LassoLibNameIdentifierMappingRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_name_identifier_mapping_request_set_nameIdentifier (LassoLibNameIdentifierMappingRequest *,
LassoSamlNameIdentifier *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST_H__ */

View File

@ -0,0 +1,129 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_name_identifier_mapping_response.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="NameIdentifierMappingResponse" type="NameIdentifierMappingResponseType"/>
<xs:complexType name="NameIdentifierMappingResponseType">
<xs:complexContent>
<xs:extension base="samlp:ResponseAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="samlp:Status"/>
<xs:element ref="saml:NameIdentifier" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void lasso_lib_name_identifier_mapping_response_set_nameIdentifier(LassoLibNameIdentifierMappingResponse *node,
LassoSamlNameIdentifier *nameIdentifier)
{
g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node),
LASSO_NODE (nameIdentifier),
FALSE);
}
void
lasso_lib_name_identifier_mapping_response_set_providerID(LassoLibNameIdentifierMappingResponse *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
g_assert(providerID != NULL);
// FIXME : providerID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void lasso_lib_name_identifier_mapping_response_set_status(LassoLibNameIdentifierMappingResponse *node,
LassoSamlpStatus *status)
{
g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
g_assert(LASSO_IS_SAMLP_STATUS(status));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(status), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_name_identifier_mapping_response_instance_init(LassoLibNameIdentifierMappingResponse *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "NameIdentifierMappingResponse");
}
static void
lasso_lib_name_identifier_mapping_response_class_init(LassoLibNameIdentifierMappingResponseClass *klass)
{
}
GType lasso_lib_name_identifier_mapping_response_get_type() {
static GType name_identifier_mapping_response_type = 0;
if (!name_identifier_mapping_response_type) {
static const GTypeInfo name_identifier_mapping_response_info = {
sizeof (LassoLibNameIdentifierMappingResponseClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_name_identifier_mapping_response_class_init,
NULL,
NULL,
sizeof(LassoLibNameIdentifierMappingResponse),
0,
(GInstanceInitFunc) lasso_lib_name_identifier_mapping_response_instance_init,
};
name_identifier_mapping_response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT,
"LassoLibNameIdentifierMappingResponse",
&name_identifier_mapping_response_info, 0);
}
return name_identifier_mapping_response_type;
}
LassoNode* lasso_lib_name_identifier_mapping_response_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL));
}

View File

@ -0,0 +1,71 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE_H__
#define __LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/samlp_response_abstract.h>
#include <lasso/xml/saml_name_identifier.h>
#include <lasso/xml/samlp_status.h>
#define LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE (lasso_lib_name_identifier_mapping_response_get_type())
#define LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, LassoLibNameIdentifierMappingResponse))
#define LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, LassoLibNameIdentifierMappingResponseClass))
#define LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE))
#define LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE))
#define LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, LassoLibNameIdentifierMappingResponseClass))
typedef struct _LassoLibNameIdentifierMappingResponse LassoLibNameIdentifierMappingResponse;
typedef struct _LassoLibNameIdentifierMappingResponseClass LassoLibNameIdentifierMappingResponseClass;
struct _LassoLibNameIdentifierMappingResponse {
LassoSamlpResponseAbstract parent;
/*< private >*/
};
struct _LassoLibNameIdentifierMappingResponseClass {
LassoSamlpResponseAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_name_identifier_mapping_response_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_name_identifier_mapping_response_new(void);
LASSO_EXPORT void lasso_lib_name_identifier_mapping_response_set_nameIdentifier (LassoLibNameIdentifierMappingResponse *node,
LassoSamlNameIdentifier *nameIdentifier);
LASSO_EXPORT void lasso_lib_name_identifier_mapping_response_set_providerID (LassoLibNameIdentifierMappingResponse *node,
const xmlChar *providerID);
LASSO_EXPORT void lasso_lib_name_identifier_mapping_response_set_status (LassoLibNameIdentifierMappingResponse *node,
LassoSamlpStatus *status);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ */

View File

@ -0,0 +1,79 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_old_provided_name_identifier.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="OldProvidedNameIdentifier" type="saml:NameIdentifierType"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_old_provided_name_identifier_instance_init(LassoLibOLDProvidedNameIdentifier *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "OldProvidedNameIdentifier");
}
static void
lasso_lib_old_provided_name_identifier_class_init(LassoLibOLDProvidedNameIdentifierClass *klass)
{
}
GType lasso_lib_old_provided_name_identifier_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibOLDProvidedNameIdentifierClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_old_provided_name_identifier_class_init,
NULL,
NULL,
sizeof(LassoLibOLDProvidedNameIdentifierClass),
0,
(GInstanceInitFunc) lasso_lib_old_provided_name_identifier_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_NAME_IDENTIFIER,
"LassoLibOLDProvidedNameIdentifier",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_old_provided_name_identifier_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER,
NULL));
}

View File

@ -0,0 +1,60 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER_H__
#define __LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_name_identifier.h>
#define LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER (lasso_lib_old_provided_name_identifier_get_type())
#define LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER, LassoLibOLDProvidedNameIdentifier))
#define LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER, LassoLibOLDProvidedNameIdentifierClass))
#define LASSO_IS_LIB_OLD_PROVIDED_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER))
#define LASSO_IS_LIB_OLD_PROVIDED_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER))
#define LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_OLD_PROVIDED_NAME_IDENTIFIER, LassoLibOLDProvidedNameIdentifierClass))
typedef struct _LassoLibOLDProvidedNameIdentifier LassoLibOLDProvidedNameIdentifier;
typedef struct _LassoLibOLDProvidedNameIdentifierClass LassoLibOLDProvidedNameIdentifierClass;
struct _LassoLibOLDProvidedNameIdentifier {
LassoSamlNameIdentifier parent;
/*< private >*/
};
struct _LassoLibOLDProvidedNameIdentifierClass {
LassoSamlNameIdentifierClass parent;
};
LASSO_EXPORT GType lasso_lib_old_provided_name_identifier_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_old_provided_name_identifier_new(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER_H__ */

View File

@ -0,0 +1,199 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_register_name_identifier_request.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="RegisterNameIdentifierRequest" type="RegisterNameIdentifierRequestType"/>
<xs:complexType name="RegisterNameIdentifierRequestType">
<xs:complexContent>
<xs:extension base="samlp:RequestAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="IDPProvidedNameIdentifier"/>
<xs:element ref="SPProvidedNameIdentifier"/>
<xs:element ref="OldProvidedNameIdentifier"/>
<xs:element ref="RelayState" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="IDPProvidedNameIdentifier" type="saml:NameIdentifierType"/>
<xs:element name="SPProvidedNameIdentifier" type="saml:NameIdentifierType"/>
<xs:element name="OldProvidedNameIdentifier" type="saml:NameIdentifierType"/>
<xs:element name="ProviderID" type="md:entityIDType"/>
<xs:element name="RelayState" type="xs:string"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_register_name_identifier_request_set_idp_provided_name_identifier(LassoLibRegisterNameIdentifierRequest *node,
LassoLibIDPProvidedNameIdentifier *idpProvidedNameIdentifier) {
g_assert(LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(node));
g_assert(LASSO_IS_LIB_IDP_PROVIDED_NAME_IDENTIFIER(idpProvidedNameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node),
LASSO_NODE (idpProvidedNameIdentifier),
FALSE);
}
void
lasso_lib_register_name_identifier_request_set_old_provided_name_identifier(LassoLibRegisterNameIdentifierRequest *node,
LassoLibOLDProvidedNameIdentifier *oldProvidedNameIdentifier) {
g_assert(LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(node));
g_assert(LASSO_IS_LIB_OLD_PROVIDED_NAME_IDENTIFIER(oldProvidedNameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node),
LASSO_NODE (oldProvidedNameIdentifier),
FALSE);
}
void
lasso_lib_register_name_identifier_request_update_nameIdentifiers(LassoLibRegisterNameIdentifierRequest *node)
{
xmlNodePtr identifier;
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
// IDPProvidedNameIdentifier
lasso_node_rename_prop(class->get_child(node, "IDPProvidedNameIdentifier"), "NameQualifier", "IDPNameQualifier");
lasso_node_rename_prop(class->get_child(node, "IDPProvidedNameIdentifier"), "Format", "IDPFormat");
// SPProvidedNameIdentifier
lasso_node_rename_prop(class->get_child(node, "SPProvidedNameIdentifier"), "NameQualifier", "SPNameQualifier");
lasso_node_rename_prop(class->get_child(node, "SPProvidedNameIdentifier"), "Format", "SPFormat");
// OldProvidedNameIdentifier
lasso_node_rename_prop(class->get_child(node, "OldProvidedNameIdentifier"), "NameQualifier", "OldNameQualifier");
lasso_node_rename_prop(class->get_child(node, "OldProvidedNameIdentifier"), "Format", "OldFormat");
}
void
lasso_lib_register_name_identifier_request_restore_nameIdentidiers(LassoLibRegisterNameIdentifierRequest *node)
{
xmlNodePtr identifier;
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
// IDPProvidedNameIdentifier
identifier = class->get_child(node, "IDPProvidedNameIdentifier");
lasso_node_rename_prop(identifier, "NameQualifier", "IDPNameQualifier");
}
void
lasso_lib_register_name_identifier_request_set_providerID(LassoLibRegisterNameIdentifierRequest *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(node));
g_assert(providerID != NULL);
// FIXME : providerID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_register_name_identifier_request_set_relayState(LassoLibRegisterNameIdentifierRequest *node,
const xmlChar *relayState) {
g_assert(LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(node));
g_assert(relayState != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE);
}
void
lasso_lib_register_name_identifier_request_set_sp_provided_name_identifier(LassoLibRegisterNameIdentifierRequest *node,
LassoLibSPProvidedNameIdentifier *spProvidedNameIdentifier) {
g_assert(LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(node));
g_assert(LASSO_IS_LIB_SP_PROVIDED_NAME_IDENTIFIER(spProvidedNameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node),
LASSO_NODE (spProvidedNameIdentifier),
FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_register_name_identifier_request_instance_init(LassoLibRegisterNameIdentifierRequest *registerNameIdentifierRequest)
{
LassoNodeClass *object_class = LASSO_NODE_GET_CLASS(registerNameIdentifierRequest);
object_class->new_ns(LASSO_NODE(registerNameIdentifierRequest), "urn:liberty:iff:2003-08", "lib");
object_class->set_name(LASSO_NODE(registerNameIdentifierRequest), "RegisterNameIdentifierRequest");
}
static void
lasso_lib_register_name_identifier_request_class_init(LassoLibRegisterNameIdentifierRequestClass *klass)
{
}
GType lasso_lib_register_name_identifier_request_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibRegisterNameIdentifierRequestClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_register_name_identifier_request_class_init,
NULL,
NULL,
sizeof(LassoLibRegisterNameIdentifierRequest),
0,
(GInstanceInitFunc) lasso_lib_register_name_identifier_request_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
"LassoLibRegisterNameIdentifierRequest",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_register_name_identifier_request_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST,
NULL));
}

View File

@ -0,0 +1,81 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST_H__
#define __LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/samlp_request_abstract.h>
#include <lasso/xml/lib_idp_provided_name_identifier.h>
#include <lasso/xml/lib_old_provided_name_identifier.h>
#include <lasso/xml/lib_sp_provided_name_identifier.h>
#define LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST (lasso_lib_register_name_identifier_request_get_type())
#define LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST, LassoLibRegisterNameIdentifierRequest))
#define LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST, LassoLibRegisterNameIdentifierRequestClass))
#define LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST))
#define LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST))
#define LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST, LassoLibRegisterNameIdentifierRequestClass))
typedef struct _LassoLibRegisterNameIdentifierRequest LassoLibRegisterNameIdentifierRequest;
typedef struct _LassoLibRegisterNameIdentifierRequestClass LassoLibRegisterNameIdentifierRequestClass;
struct _LassoLibRegisterNameIdentifierRequest {
LassoSamlpRequestAbstract parent;
/*< private >*/
};
struct _LassoLibRegisterNameIdentifierRequestClass {
LassoSamlpRequestAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_register_name_identifier_request_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_register_name_identifier_request_new(void);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_set_relayState (LassoLibRegisterNameIdentifierRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_set_providerID (LassoLibRegisterNameIdentifierRequest *,
const xmlChar *);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_update_nameIdentifiers(LassoLibRegisterNameIdentifierRequest *);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_restore_nameIdentifiers(LassoLibRegisterNameIdentifierRequest *);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_set_idpProvidedNameIdentifier (LassoLibRegisterNameIdentifierRequest *,
LassoLibIDPProvidedNameIdentifier *);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_set_oldProvidedNameIdentifier (LassoLibRegisterNameIdentifierRequest *,
LassoLibOLDProvidedNameIdentifier *);
LASSO_EXPORT void lasso_lib_register_name_identifier_request_set_spProvidedNameIdentifier (LassoLibRegisterNameIdentifierRequest *,
LassoLibSPProvidedNameIdentifier *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST_H__ */

View File

@ -0,0 +1,79 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_register_name_identifier_response.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="RegisterNameIdentifierResponse" type="StatusResponseType"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_register_name_identifier_response_instance_init(LassoLibRegisterNameIdentifierResponse *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "RegisterNameIdentifierResponse");
}
static void
lasso_lib_register_name_identifier_response_class_init(LassoLibRegisterNameIdentifierResponseClass *klass)
{
}
GType lasso_lib_register_name_identifier_response_get_type() {
static GType register_name_identifier_response_type = 0;
if (!register_name_identifier_response_type) {
static const GTypeInfo register_name_identifier_response_info = {
sizeof (LassoLibRegisterNameIdentifierResponseClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_register_name_identifier_response_class_init,
NULL,
NULL,
sizeof(LassoLibRegisterNameIdentifierResponse),
0,
(GInstanceInitFunc) lasso_lib_register_name_identifier_response_instance_init,
};
register_name_identifier_response_type = g_type_register_static(LASSO_TYPE_LIB_STATUS_RESPONSE,
"LassoLibRegisterNameIdentifierResponse",
&register_name_identifier_response_info, 0);
}
return register_name_identifier_response_type;
}
LassoNode* lasso_lib_register_name_identifier_response_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE, NULL));
}

View File

@ -0,0 +1,60 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE_H__
#define __LASSO_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/lib_status_response.h>
#define LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE (lasso_lib_register_name_identifier_response_get_type())
#define LASSO_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE, LassoLibRegisterNameIdentifierResponse))
#define LASSO_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE, LassoLibRegisterNameIdentifierResponseClass))
#define LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE))
#define LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE))
#define LASSO_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE, LassoLibRegisterNameIdentifierResponseClass))
typedef struct _LassoLibRegisterNameIdentifierResponse LassoLibRegisterNameIdentifierResponse;
typedef struct _LassoLibRegisterNameIdentifierResponseClass LassoLibRegisterNameIdentifierResponseClass;
struct _LassoLibRegisterNameIdentifierResponse {
LassoLibStatusResponse parent;
/*< private >*/
};
struct _LassoLibRegisterNameIdentifierResponseClass {
LassoLibStatusResponseClass parent;
};
LASSO_EXPORT GType lasso_lib_register_name_identifier_response_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_register_name_identifier_response_new(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE_H__ */

View File

@ -0,0 +1,127 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_request_authn_context.h>
/*
Information describing which authentication context the requester desires the
identity provider to use in authenticating the Principal.
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="RequestAuthnContext">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="AuthnContextClassRef" type="xs:anyURI" maxOccurs="unbounded"/>
<xs:element name="AuthnContextStatementRef" type="xs:anyURI" maxOccurs="unbounded"/>
</xs:choice>
<xs:element name="AuthnContextComparison" type="AuthnContextComparisonType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_request_authn_context_add_authnContextClassRef(LassoLibRequestAuthnContext *node,
const xmlChar *authnContextClassRef) {
g_assert(LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT(node));
g_assert(authnContextClassRef != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AuthnContextClassRef",
authnContextClassRef, TRUE);
}
void
lasso_lib_request_authn_context_add_authnContextStatementRef(LassoLibRequestAuthnContext *node,
const xmlChar *authnContextStatementRef) {
g_assert(LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT(node));
g_assert(authnContextStatementRef != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AuthnContextStatementRef",
authnContextStatementRef, TRUE);
}
void
lasso_lib_request_authn_context_set_authnContextComparison(LassoLibRequestAuthnContext *node,
const xmlChar *authnContextComparison) {
g_assert(LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT(node));
g_assert(authnContextComparison != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "AuthnContextComparison",
authnContextComparison, FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_request_authn_context_instance_init(LassoLibRequestAuthnContext *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "RequestAuthnContext");
}
static void
lasso_lib_request_authn_context_class_init(LassoLibRequestAuthnContextClass *klass)
{
}
GType lasso_lib_request_authn_context_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibRequestAuthnContextClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_request_authn_context_class_init,
NULL,
NULL,
sizeof(LassoLibRequestAuthnContext),
0,
(GInstanceInitFunc) lasso_lib_request_authn_context_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoLibRequestAuthnContext",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_request_authn_context_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT, NULL));
}

View File

@ -0,0 +1,69 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_REQUEST_AUTHN_CONTEXT_H__
#define __LASSO_LIB_REQUEST_AUTHN_CONTEXT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT (lasso_lib_request_authn_context_get_type())
#define LASSO_LIB_REQUEST_AUTHN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT, LassoLibRequestAuthnContext))
#define LASSO_LIB_REQUEST_AUTHN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT, LassoLibRequestAuthnContextClass))
#define LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT))
#define LASSO_IS_LIB_REQUEST_AUTHN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT))
#define LASSO_LIB_REQUEST_AUTHN_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_REQUEST_AUTHN_CONTEXT, LassoLibRequestAuthnContextClass))
typedef struct _LassoLibRequestAuthnContext LassoLibRequestAuthnContext;
typedef struct _LassoLibRequestAuthnContextClass LassoLibRequestAuthnContextClass;
struct _LassoLibRequestAuthnContext {
LassoNode parent;
/*< private >*/
};
struct _LassoLibRequestAuthnContextClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_lib_request_authn_context_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_request_authn_context_new(void);
LASSO_EXPORT void lasso_lib_request_authn_context_add_authnContextClassRef (LassoLibRequestAuthnContext *node,
const xmlChar *authnContextClassRef);
LASSO_EXPORT void lasso_lib_request_authn_context_add_authnContextStatementRef (LassoLibRequestAuthnContext *node,
const xmlChar *authnContextStatementRef);
LASSO_EXPORT void lasso_lib_request_authn_context_set_authnContextComparison (LassoLibRequestAuthnContext *node,
const xmlChar *authnContextComparison);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_REQUEST_AUTHN_CONTEXT_H__ */

147
lasso/xml/lib_scoping.c Normal file
View File

@ -0,0 +1,147 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_scoping.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:complexType name="ScopingType">
<xs:sequence>
<xs:element name="ProxyCount" type="xs:nonNegativeInteger" minOccurs="0"/>
<xs:element ref="IDPList" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Scoping" type="ScopingType"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
/**
* lasso_lib_scoping_set_proxyCount:
* @node : the pointer to <lib:Scoping/> node object
* @proxyCount: the value of "ProxyCount" element (should be superior or equal
* to 0).
*
* Sets the "ProxyCount" element [optional].
*
* It's the upper limit on the number of proxying steps the requester wishes to
* specify for the authentication request.
**/
void
lasso_lib_scoping_set_proxyCount(LassoLibScoping *node,
gint proxyCount)
{
gchar str[6];
g_assert(LASSO_IS_LIB_SCOPING(node));
g_assert(proxyCount >= 0);
g_sprintf(str, "%d", proxyCount);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProxyCount", str, FALSE);
}
/**
* lasso_lib_scoping_set_idpList:
* @node : the pointer to <lib:Scoping/> node object
* @idpList: the value of "IDPList" element
*
* Sets the "IDPList" element [optional].
*
* It's an ordered list of identity providers which the requester prefers to
* use in authenticating the Principal. This list is a suggestion only, and may
* be ignored or added to by the recipient of the message.
**/
void
lasso_lib_scoping_set_idpList(LassoLibScoping *node,
LassoLibIDPList *idpList)
{
g_assert(LASSO_IS_LIB_SCOPING(node));
g_assert(LASSO_IS_LIB_IDP_LIST(idpList));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(idpList), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_scoping_instance_init(LassoLibScoping *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "Scoping");
}
static void
lasso_lib_scoping_class_init(LassoLibScopingClass *klass)
{
}
GType lasso_lib_scoping_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibScopingClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_scoping_class_init,
NULL,
NULL,
sizeof(LassoLibScoping),
0,
(GInstanceInitFunc) lasso_lib_scoping_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoLibScoping",
&this_info, 0);
}
return this_type;
}
/**
* lasso_lib_scoping_new:
*
* Creates a new <lib:Scoping/> node object.
*
* Specifies any preferences on the number and specific identifiers of
* additional identity providers through which the authentication request may
* be proxied. The requester may also choose not to include this element, in
* which case, the recipient of the message MAY act as a proxy.
*
* Return value: a new @LassoLibScoping
**/
LassoNode* lasso_lib_scoping_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_SCOPING, NULL));
}

67
lasso/xml/lib_scoping.h Normal file
View File

@ -0,0 +1,67 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_SCOPING_H__
#define __LASSO_LIB_SCOPING_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/lib_idp_list.h>
#define LASSO_TYPE_LIB_SCOPING (lasso_lib_scoping_get_type())
#define LASSO_LIB_SCOPING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_SCOPING, LassoLibScoping))
#define LASSO_LIB_SCOPING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_SCOPING, LassoLibScopingClass))
#define LASSO_IS_LIB_SCOPING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_SCOPING))
#define LASSO_IS_LIB_SCOPING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_SCOPING))
#define LASSO_LIB_SCOPING_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_SCOPING, LassoLibScopingClass))
typedef struct _LassoLibScoping LassoLibScoping;
typedef struct _LassoLibScopingClass LassoLibScopingClass;
struct _LassoLibScoping {
LassoNode parent;
/*< private >*/
};
struct _LassoLibScopingClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_lib_scoping_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_scoping_new(void);
LASSO_EXPORT void lasso_lib_scoping_set_proxyCount (LassoLibScoping *node,
gint proxyCount);
LASSO_EXPORT void lasso_lib_scoping_set_idpList (LassoLibScoping *node,
LassoLibIDPList *idpList);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_SCOPING_H__ */

View File

@ -0,0 +1,79 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_sp_provided_name_identifier.h>
/*
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:element name="SPProvidedNameIdentifier" type="saml:NameIdentifierType"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_sp_provided_name_identifier_instance_init(LassoLibSPProvidedNameIdentifier *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "SPProvidedNameIdentifier");
}
static void
lasso_lib_sp_provided_name_identifier_class_init(LassoLibSPProvidedNameIdentifierClass *klass)
{
}
GType lasso_lib_sp_provided_name_identifier_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibSPProvidedNameIdentifierClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_sp_provided_name_identifier_class_init,
NULL,
NULL,
sizeof(LassoLibSPProvidedNameIdentifierClass),
0,
(GInstanceInitFunc) lasso_lib_sp_provided_name_identifier_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_NAME_IDENTIFIER,
"LassoLibSPProvidedNameIdentifier",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_lib_sp_provided_name_identifier_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER,
NULL));
}

View File

@ -0,0 +1,60 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER_H__
#define __LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_name_identifier.h>
#define LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER (lasso_lib_sp_provided_name_identifier_get_type())
#define LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER, LassoLibSPProvidedNameIdentifier))
#define LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER, LassoLibSPProvidedNameIdentifierClass))
#define LASSO_IS_LIB_SP_PROVIDED_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER))
#define LASSO_IS_LIB_SP_PROVIDED_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER))
#define LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_SP_PROVIDED_NAME_IDENTIFIER, LassoLibSPProvidedNameIdentifierClass))
typedef struct _LassoLibSPProvidedNameIdentifier LassoLibSPProvidedNameIdentifier;
typedef struct _LassoLibSPProvidedNameIdentifierClass LassoLibSPProvidedNameIdentifierClass;
struct _LassoLibSPProvidedNameIdentifier {
LassoSamlNameIdentifier parent;
/*< private >*/
};
struct _LassoLibSPProvidedNameIdentifierClass {
LassoSamlNameIdentifierClass parent;
};
LASSO_EXPORT GType lasso_lib_sp_provided_name_identifier_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_sp_provided_name_identifier_new(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER_H__ */

View File

@ -0,0 +1,138 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_status_response.h>
/*
Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:complexType name="StatusResponseType">
<xs:complexContent>
<xs:extension base="samlp:ResponseAbstractType">
<xs:sequence>
<xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ProviderID"/>
<xs:element ref="samlp:Status"/>
<xs:element ref="RelayState" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="ProviderID" type="md:entityIDType"/>
<xs:element name="RelayState" type="xs:string"/>
From liberty-metadata-v1.0.xsd:
<xs:simpleType name="entityIDType">
<xs:restriction base="xs:anyURI">
<xs:maxLength value="1024" id="maxlengthid"/>
</xs:restriction>
</xs:simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_status_response_set_providerID(LassoLibStatusResponse *node,
const xmlChar *providerID)
{
g_assert(LASSO_IS_LIB_STATUS_RESPONSE(node));
g_assert(providerID != NULL);
// FIXME : providerID lenght SHOULD be <= 1024
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
}
void
lasso_lib_status_response_set_relayState(LassoLibStatusResponse *node,
const xmlChar *relayState)
{
g_assert(LASSO_IS_LIB_STATUS_RESPONSE(node));
g_assert(relayState != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "RelayState", relayState, FALSE);
}
void
lasso_lib_status_response_set_status(LassoLibStatusResponse *node,
LassoSamlpStatus *status)
{
g_assert(LASSO_IS_LIB_STATUS_RESPONSE(node));
g_assert(LASSO_IS_SAMLP_STATUS(status));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (status), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_status_response_instance_init(LassoLibStatusResponse *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "StatusResponse");
}
static void
lasso_lib_status_response_class_init(LassoLibStatusResponseClass *klass)
{
}
GType lasso_lib_status_response_get_type() {
static GType status_response_type = 0;
if (!status_response_type) {
static const GTypeInfo status_response_info = {
sizeof (LassoLibStatusResponseClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_status_response_class_init,
NULL,
NULL,
sizeof(LassoLibStatusResponse),
0,
(GInstanceInitFunc) lasso_lib_status_response_instance_init,
};
status_response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT,
"LassoLibStatusResponse",
&status_response_info, 0);
}
return status_response_type;
}
LassoNode* lasso_lib_status_response_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_STATUS_RESPONSE, NULL));
}

View File

@ -0,0 +1,70 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_STATUS_RESPONSE_H__
#define __LASSO_LIB_STATUS_RESPONSE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/samlp_response_abstract.h>
#include <lasso/xml/samlp_status.h>
#define LASSO_TYPE_LIB_STATUS_RESPONSE (lasso_lib_status_response_get_type())
#define LASSO_LIB_STATUS_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_STATUS_RESPONSE, LassoLibStatusResponse))
#define LASSO_LIB_STATUS_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_STATUS_RESPONSE, LassoLibStatusResponseClass))
#define LASSO_IS_LIB_STATUS_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_STATUS_RESPONSE))
#define LASSO_IS_LIB_STATUS_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_STATUS_RESPONSE))
#define LASSO_LIB_STATUS_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_STATUS_RESPONSE, LassoLibStatusResponseClass))
typedef struct _LassoLibStatusResponse LassoLibStatusResponse;
typedef struct _LassoLibStatusResponseClass LassoLibStatusResponseClass;
struct _LassoLibStatusResponse {
LassoSamlpResponseAbstract parent;
/*< private >*/
};
struct _LassoLibStatusResponseClass {
LassoSamlpResponseAbstractClass parent;
};
LASSO_EXPORT GType lasso_lib_status_response_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_status_response_new(void);
LASSO_EXPORT void lasso_lib_status_response_set_providerID (LassoLibStatusResponse *node,
const xmlChar *providerID);
LASSO_EXPORT void lasso_lib_status_response_set_relayState (LassoLibStatusResponse *node,
const xmlChar *relayState);
LASSO_EXPORT void lasso_lib_status_response_set_status (LassoLibStatusResponse *node,
LassoSamlpStatus *status);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_STATUS_RESPONSE_H__ */

109
lasso/xml/lib_subject.c Normal file
View File

@ -0,0 +1,109 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/lib_subject.h>
/*
The schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
<xs:complexType name="SubjectType">
<xs:complexContent>
<xs:extension base="saml:SubjectType">
<xs:sequence>
<xs:element ref="IDPProvidedNameIdentifier"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Subject" type="SubjectType" substitutionGroup="saml:Subject"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_lib_subject_set_idpProvidedNameIdentifier(LassoLibSubject *node,
LassoLibIDPProvidedNameIdentifier *idpProvidedNameIdentifier)
{
g_assert(LASSO_IS_LIB_SUBJECT(node));
g_assert(LASSO_IS_LIB_IDP_PROVIDED_NAME_IDENTIFIER(idpProvidedNameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(idpProvidedNameIdentifier), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_lib_subject_instance_init(LassoLibSubject *instance,
LassoLibSubjectClass *klass) {
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:liberty:iff:2003-08", "lib");
class->set_name(node, "Subject");
}
static void
lasso_lib_subject_class_init(LassoLibSubjectClass *klass) {
}
GType lasso_lib_subject_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoLibSubjectClass),
NULL,
NULL,
(GClassInitFunc) lasso_lib_subject_class_init,
NULL,
NULL,
sizeof(LassoLibSubject),
0,
(GInstanceInitFunc) lasso_lib_subject_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_SUBJECT,
"LassoLibSubject",
&this_info, 0);
}
return this_type;
}
/**
* lasso_lib_subject_new:
*
* Creates a new <saml:Subject> node object.
*
* Return value: the new @LassoLibSubject
**/
LassoNode* lasso_lib_subject_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_SUBJECT, NULL));
}

64
lasso/xml/lib_subject.h Normal file
View File

@ -0,0 +1,64 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_LIB_SUBJECT_H__
#define __LASSO_LIB_SUBJECT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/lasso.h>
#include <lasso/xml/saml_subject.h>
#define LASSO_TYPE_LIB_SUBJECT (lasso_lib_subject_get_type())
#define LASSO_LIB_SUBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LIB_SUBJECT, LassoLibSubject))
#define LASSO_LIB_SUBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LIB_SUBJECT, LassoLibSubjectClass))
#define LASSO_IS_LIB_SUBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LIB_SUBJECT))
#define LASSO_IS_LIB_SUBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LIB_SUBJECT))
#define LASSO_LIB_SUBJECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LIB_SUBJECT, LassoLibSubjectClass))
typedef struct _LassoLibSubject LassoLibSubject;
typedef struct _LassoLibSubjectClass LassoLibSubjectClass;
struct _LassoLibSubject {
LassoSamlSubject parent;
/*< private >*/
};
struct _LassoLibSubjectClass {
LassoSamlSubjectClass parent;
};
LASSO_EXPORT GType lasso_lib_subject_get_type(void);
LASSO_EXPORT LassoNode* lasso_lib_subject_new(void);
LASSO_EXPORT void lasso_lib_subject_set_idpProvidedNameIdentifier(LassoLibSubject *node,
LassoLibIDPProvidedNameIdentifier *idpProvidedNameIdentifier);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_LIB_SUBJECT_H__ */

56
lasso/xml/saml.h Normal file
View File

@ -0,0 +1,56 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_H__
#define __LASSO_SAML_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_advice.h>
#include <lasso/xml/saml_assertion.h>
#include <lasso/xml/saml_audience_restriction_condition.h>
#include <lasso/xml/saml_authentication_statement.h>
#include <lasso/xml/saml_authority_binding.h>
#include <lasso/xml/saml_condition_abstract.h>
#include <lasso/xml/saml_conditions.h>
#include <lasso/xml/saml_name_identifier.h>
#include <lasso/xml/saml_statement_abstract.h>
#include <lasso/xml/saml_subject.h>
#include <lasso/xml/saml_subject_confirmation.h>
#include <lasso/xml/saml_subject_locality.h>
#include <lasso/xml/saml_subject_statement_abstract.h>
#include <lasso/xml/samlp_response_abstract.h>
#include <lasso/xml/samlp_response.h>
#include <lasso/xml/samlp_request_abstract.h>
#include <lasso/xml/samlp_status.h>
#include <lasso/xml/samlp_status_code.h>
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_H__ */

141
lasso/xml/saml_advice.c Normal file
View File

@ -0,0 +1,141 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_advice.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="Advice" type="saml:AdviceType"/>
<complexType name="AdviceType">
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="saml:AssertionIDReference"/>
<element ref="saml:Assertion"/>
<any namespace="##other" processContents="lax"/>
</choice>
</complexType>
<element name="AssertionIDReference" type="saml:IDReferenceType"/>
<simpleType name="IDReferenceType">
<restriction base="string"/>
</simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_advice_add_assertionIDReference(LassoSamlAdvice *node,
const xmlChar *assertionIDReference)
{
g_assert(LASSO_IS_SAML_ADVICE(node));
g_assert(assertionIDReference != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node),
"AssertionIDReference",
assertionIDReference,
TRUE);
}
void
lasso_saml_advice_add_assertion(LassoSamlAdvice *node,
gpointer *assertion)
{
g_assert(LASSO_IS_SAML_ADVICE(node));
//g_assert(LASSO_IS_SAML_ASSERTION(assertion));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (assertion), TRUE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_advice_instance_init(LassoSamlAdvice *instance,
LassoSamlAdviceClass *klass) {
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, NULL, "saml");
class->set_name(node, "Advice");
}
static void
lasso_saml_advice_class_init(LassoSamlAdviceClass *klass) {
}
GType lasso_saml_advice_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlAdviceClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_advice_class_init,
NULL,
NULL,
sizeof(LassoSamlAdvice),
0,
(GInstanceInitFunc) lasso_saml_advice_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlAdvice",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_advice_new:
*
* Creates a new <saml:Advice> node object.
*
* The <Advice> element contains any additional information that the issuer
* wishes to provide. This information MAY be ignored by applications without
* affecting either the semantics or the validity of the assertion.
* The <Advice> element contains a mixture of zero or more <Assertion>
* elements, <AssertionIDReference> elements and elements in other namespaces,
* with lax schema validation in effect for these other elements.
* Following are some potential uses of the <Advice> element:
*
* - Include evidence supporting the assertion claims to be cited, either
* directly (through incorporating the claims) or indirectly (by reference to
* the supporting assertions).
*
* - State a proof of the assertion claims.
*
* - Specify the timing and distribution points for updates to the assertion.
*
* Return value: the new @LassoSamlAdvice
**/
LassoNode* lasso_saml_advice_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_ADVICE, NULL));
}

66
lasso/xml/saml_advice.h Normal file
View File

@ -0,0 +1,66 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_ADVICE_H__
#define __LASSO_SAML_ADVICE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_ADVICE (lasso_saml_advice_get_type())
#define LASSO_SAML_ADVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_ADVICE, LassoSamlAdvice))
#define LASSO_SAML_ADVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_ADVICE, LassoSamlAdviceClass))
#define LASSO_IS_SAML_ADVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_ADVICE))
#define LASSO_IS_SAML_ADVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_ADVICE))
#define LASSO_SAML_ADVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_ADVICE, LassoSamlAdviceClass))
typedef struct _LassoSamlAdvice LassoSamlAdvice;
typedef struct _LassoSamlAdviceClass LassoSamlAdviceClass;
struct _LassoSamlAdvice {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlAdviceClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_saml_advice_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_advice_new(void);
LASSO_EXPORT void lasso_saml_advice_add_assertionIDReference (LassoSamlAdvice *node,
const xmlChar *assertionIDReference);
LASSO_EXPORT void lasso_saml_advice_add_assertion (LassoSamlAdvice *node,
gpointer *assertion);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_ADVICE_H__ */

309
lasso/xml/saml_assertion.c Normal file
View File

@ -0,0 +1,309 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_assertion.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="Assertion" type="saml:AssertionType"/>
<complexType name="AssertionType">
<sequence>
<element ref="saml:Conditions" minOccurs="0"/>
<element ref="saml:Advice" minOccurs="0"/>
<choice maxOccurs="unbounded">
<element ref="saml:Statement"/>
<element ref="saml:SubjectStatement"/>
<element ref="saml:AuthenticationStatement"/>
<element ref="saml:AuthorizationDecisionStatement"/>
<element ref="saml:AttributeStatement"/>
</choice>
<element ref="ds:Signature" minOccurs="0"/>
</sequence>
<attribute name="MajorVersion" type="integer" use="required"/>
<attribute name="MinorVersion" type="integer" use="required"/>
<attribute name="AssertionID" type="saml:IDType" use="required"/>
<attribute name="Issuer" type="string" use="required"/>
<attribute name="IssueInstant" type="dateTime" use="required"/>
</complexType>
From oasis-sstc-saml-schema-assertion-1.0.xsd:
<simpleType name="IDType">
<restriction base="string"/>
</simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_assertion_add_authenticationStatement(LassoSamlAssertion *node,
LassoSamlAuthenticationStatement *authenticationStatement)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(authenticationStatement));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(authenticationStatement), TRUE);
}
void
lasso_saml_assertion_add_statement(LassoSamlAssertion *node,
LassoSamlStatementAbstract *statement)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(LASSO_IS_SAML_STATEMENT_ABSTRACT(statement));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(statement), TRUE);
}
void
lasso_saml_assertion_add_subjectStatement(LassoSamlAssertion *node,
LassoSamlSubjectStatementAbstract *subjectStatement)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(LASSO_IS_SAML_SUBJECT_STATEMENT_ABSTRACT(subjectStatement));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(subjectStatement), TRUE);
}
/**
* lasso_saml_assertion_set_advice:
* @node: the <saml:Assertion> node object
* @advice: the <saml:Advice> node object
*
* Sets the <Advice> element [optional].
*
* Additional information related to the assertion that assists processing in
* certain situations but which MAY be ignored by applications that do not
* support its use.
**/
void
lasso_saml_assertion_set_advice(LassoSamlAssertion *node,
LassoSamlAdvice *advice)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(LASSO_IS_SAML_ADVICE(advice));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(advice), FALSE);
}
/**
* lasso_saml_assertion_set_assertionID:
* @node: the <saml:Assertion> node object
* @assertionID: the value of "AssertionID" attribut
*
* Sets the "AssertionID" attribut [required].
*
* The identifier for this assertion. It is of type IDType, and MUST follow the
* requirements specified by that type for identifier uniqueness.
**/
void
lasso_saml_assertion_set_assertionID(LassoSamlAssertion *node,
const xmlChar *assertionID)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(assertionID != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "AssertionID", assertionID);
}
/**
* lasso_saml_assertion_set_conditions:
* @node: the <saml:Assertion> node object
* @conditions: the <saml:Conditions> node object
*
* Sets the <Conditions> element [optional].
*
* Conditions that MUST be taken into account in assessing the validity of the
* assertion.
**/
void
lasso_saml_assertion_set_conditions(LassoSamlAssertion *node,
LassoSamlConditions *conditions)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(LASSO_IS_SAML_CONDITIONS(conditions));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(conditions), FALSE);
}
/**
* lasso_saml_assertion_set_issueInstance:
* @node: the <saml:Assertion> node object
* @issueInstance: the value of "IssueInstance" attribut
*
* Sets the "IssueInstance" attribut [required].
*
* The time instant of issue in UTC as described in Section 1.2.2
* (oasis-sstc-saml-core-1.0.pdf).
**/
void
lasso_saml_assertion_set_issueInstance(LassoSamlAssertion *node,
const xmlChar *issueInstance)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(issueInstance != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "IssueInstance", issueInstance);
}
/**
* lasso_saml_assertion_set_issuer:
* @node: the <saml:Assertion> node object
* @issuer: the value of "Issuer" attribut
*
* Sets the "Issuer" attribut [required].
*
* The issuer of the assertion. The name of the issuer is provided as a string.
* The issuer name SHOULD be unambiguous to the intended relying parties. SAML
* authorities may use an identifier such as a URI reference that is designed
* to be unambiguous regardless of context.
**/
void
lasso_saml_assertion_set_issuer(LassoSamlAssertion *node,
const xmlChar *issuer)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(issuer != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "Issuer", issuer);
}
/**
* lasso_saml_assertion_set_majorVersion:
* @node: the <saml:Assertion> node object
* @majorVersion: the value of "MajorVersion" attribut
*
* Sets the "MajorVersion" attribut [required].
*
* The major version of the assertion. The identifier for the version of SAML
* defined in this specification is 1. Processing of this attribute is
* specified in Section 3.4.4 (oasis-sstc-saml-core-1.0.pdf).
**/
void
lasso_saml_assertion_set_majorVersion(LassoSamlAssertion *node,
const xmlChar *majorVersion)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(majorVersion != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "MajorVersion", majorVersion);
}
/**
* lasso_saml_assertion_set_minorVersion:
* @node: the <saml:Assertion> node object
* @minorVersion: the value of "MinorVersion" attribut
*
* Sets the "MinorVersion" attribut [required].
*
* The minor version of the assertion. The identifier for the version of SAML
* defined in this specification is 0. Processing of this attribute is
* specified in Section 3.4.4 (oasis-sstc-saml-core-1.0.pdf).
**/
void
lasso_saml_assertion_set_minorVersion(LassoSamlAssertion *node,
const xmlChar *minorVersion)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(minorVersion != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "MinorVersion", minorVersion);
}
void
lasso_saml_assertion_set_signature(LassoSamlAssertion *node,
LassoDsSignature *signature)
{
g_assert(LASSO_IS_SAML_ASSERTION(node));
g_assert(LASSO_IS_DS_SIGNATURE(signature));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(signature), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_assertion_instance_init(LassoSamlAssertion *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "Assertion");
}
static void
lasso_saml_assertion_class_init(LassoSamlAssertionClass *klass)
{
}
GType lasso_saml_assertion_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlAssertionClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_assertion_class_init,
NULL,
NULL,
sizeof(LassoSamlAssertion),
0,
(GInstanceInitFunc) lasso_saml_assertion_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlAssertion",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_assertion_new:
*
* Creates a new <saml:Assertion> node object.
*
* Return value: the new @LassoSamlAssertion
**/
LassoNode* lasso_saml_assertion_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_ASSERTION, NULL));
}

View File

@ -0,0 +1,99 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_ASSERTION_H__
#define __LASSO_SAML_ASSERTION_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/ds_signature.h>
#include <lasso/xml/saml_advice.h>
#include <lasso/xml/saml_authentication_statement.h>
#include <lasso/xml/saml_conditions.h>
#include <lasso/xml/saml_statement_abstract.h>
#include <lasso/xml/saml_subject_statement_abstract.h>
#define LASSO_TYPE_SAML_ASSERTION (lasso_saml_assertion_get_type())
#define LASSO_SAML_ASSERTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_ASSERTION, LassoSamlAssertion))
#define LASSO_SAML_ASSERTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_ASSERTION, LassoSamlAssertionClass))
#define LASSO_IS_SAML_ASSERTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_ASSERTION))
#define LASSO_IS_SAML_ASSERTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_ASSERTION))
#define LASSO_SAML_ASSERTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_ASSERTION, LassoSamlAssertionClass))
typedef struct _LassoSamlAssertion LassoSamlAssertion;
typedef struct _LassoSamlAssertionClass LassoSamlAssertionClass;
struct _LassoSamlAssertion {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlAssertionClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_saml_assertion_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_assertion_new(void);
LASSO_EXPORT void lasso_saml_assertion_add_authenticationStatement (LassoSamlAssertion *node,
LassoSamlAuthenticationStatement *authenticationStatement);
LASSO_EXPORT void lasso_saml_assertion_add_statement (LassoSamlAssertion *node,
LassoSamlStatementAbstract *statement);
LASSO_EXPORT void lasso_saml_assertion_add_subjectStatement (LassoSamlAssertion *node,
LassoSamlSubjectStatementAbstract *subjectStatement);
LASSO_EXPORT void lasso_saml_assertion_set_advice (LassoSamlAssertion *node,
LassoSamlAdvice *advice);
LASSO_EXPORT void lasso_saml_assertion_set_assertionID (LassoSamlAssertion *node,
const xmlChar *assertionID);
LASSO_EXPORT void lasso_saml_assertion_set_conditions (LassoSamlAssertion *node,
LassoSamlConditions *conditions);
LASSO_EXPORT void lasso_saml_assertion_set_issueInstance (LassoSamlAssertion *node,
const xmlChar *issueInstance);
LASSO_EXPORT void lasso_saml_assertion_set_issuer (LassoSamlAssertion *node,
const xmlChar *issuer);
LASSO_EXPORT void lasso_saml_assertion_set_majorVersion (LassoSamlAssertion *node,
const xmlChar *majorVersion);
LASSO_EXPORT void lasso_saml_assertion_set_minorVersion (LassoSamlAssertion *node,
const xmlChar *minorVersion);
LASSO_EXPORT void lasso_saml_assertion_set_signature (LassoSamlAssertion *node,
LassoDsSignature *signature);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_ASSERTION_H__ */

View File

@ -0,0 +1,138 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_audience_restriction_condition.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="AudienceRestrictionCondition" type="saml:AudienceRestrictionConditionType"/>
<complexType name="AudienceRestrictionConditionType">
<complexContent>
<extension base="saml:ConditionAbstractType">
<sequence>
<element ref="saml:Audience" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="Audience" type="anyURI"/>
*/
/*****************************************************************************/
/* publics methods */
/*****************************************************************************/
/**
* lasso_saml_audience_restriction_condition_add_audience:
* @node: the <saml:AudienceRestrictionCondition> node object
* @audience: the value of "Audience" element
*
* Adds an "Audience" element.
*
* A URI reference that identifies an intended audience. The URI reference MAY
* identify a document that describes the terms and conditions of audience
* membership.
**/
void
lasso_saml_audience_restriction_condition_add_audience(LassoSamlAudienceRestrictionCondition *node,
const xmlChar *audience)
{
g_assert(LASSO_IS_SAML_AUDIENCE_RESTRICTION_CONDITION(node));
g_assert(audience != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "Audience", audience, TRUE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_audience_restriction_condition_instance_init(LassoSamlAudienceRestrictionCondition *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "AudienceRestrictionCondition");
}
static void
lasso_saml_audience_restriction_condition_class_init(LassoSamlAudienceRestrictionConditionClass *klass)
{
}
GType lasso_saml_audience_restriction_condition_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlAudienceRestrictionConditionClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_audience_restriction_condition_class_init,
NULL,
NULL,
sizeof(LassoSamlAudienceRestrictionCondition),
0,
(GInstanceInitFunc) lasso_saml_audience_restriction_condition_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_CONDITION_ABSTRACT,
"LassoSamlAudienceRestrictionCondition",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_audience_restriction_condition_new:
*
* Creates a new <saml:AudienceRestrictionCondition> node object.
*
* The <AudienceRestrictionCondition> element specifies that the assertion is
* addressed to one or more specific audiences identified by <Audience>
* elements. Although a party that is outside the audiences specified is
* capable of drawing conclusions from an assertion, the issuer explicitly
* makes no representation as to accuracy or trustworthiness to such a party.
*
* The AudienceRestrictionCondition evaluates to Valid if and only if the
* relying party is a member of one or more of the audiences specified. The
* issuer of an assertion cannot prevent a party to whom it is disclosed from
* making a decision on the basis of the information provided. However, the
* <AudienceRestrictionCondition> element allows the issuer to state explicitly
* that no warranty is provided to such a party in a machine- and
* human-readable form. While there can be no guarantee that a court would
* uphold such a warranty exclusion in every circumstance, the probability of
* upholding the warranty exclusion is considerably improved.
*
* Return value: the new @LassoSamlAudienceRestrictionCondition
**/
LassoNode* lasso_saml_audience_restriction_condition_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION, NULL));
}

View File

@ -0,0 +1,64 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_AUDIENCE_RESTRICTION_CONDITION_H__
#define __LASSO_SAML_AUDIENCE_RESTRICTION_CONDITION_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_condition_abstract.h>
#define LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION (lasso_saml_audience_restriction_condition_get_type())
#define LASSO_SAML_AUDIENCE_RESTRICTION_CONDITION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION, LassoSamlAudienceRestrictionCondition))
#define LASSO_SAML_AUDIENCE_RESTRICTION_CONDITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION, LassoSamlAudienceRestrictionConditionClass))
#define LASSO_IS_SAML_AUDIENCE_RESTRICTION_CONDITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION))
#define LASSO_IS_SAML_AUDIENCE_RESTRICTION_CONDITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION))
#define LASSO_SAML_AUDIENCE_RESTRICTION_CONDITION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_AUDIENCE_RESTRICTION_CONDITION, LassoSamlAudienceRestrictionConditionClass))
typedef struct _LassoSamlAudienceRestrictionCondition LassoSamlAudienceRestrictionCondition;
typedef struct _LassoSamlAudienceRestrictionConditionClass LassoSamlAudienceRestrictionConditionClass;
struct _LassoSamlAudienceRestrictionCondition {
LassoSamlConditionAbstract parent;
/*< private >*/
};
struct _LassoSamlAudienceRestrictionConditionClass {
LassoSamlConditionAbstractClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_audience_restriction_condition_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_audience_restriction_condition_new(void);
LASSO_EXPORT void lasso_saml_audience_restriction_condition_add_audience (LassoSamlAudienceRestrictionCondition *node,
const xmlChar *audience);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_AUDIENCE_RESTRICTION_CONDITION_H__ */

View File

@ -0,0 +1,146 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_authentication_statement.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="AuthenticationStatement" type="saml:AuthenticationStatementType"/>
<complexType name="AuthenticationStatementType">
<complexContent>
<extension base="saml:SubjectStatementAbstractType">
<sequence>
<element ref="saml:SubjectLocality" minOccurs="0"/>
<element ref="saml:AuthorityBinding" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="AuthenticationMethod" type="anyURI" use="required"/>
<attribute name="AuthenticationInstant" type="dateTime" use="required"/>
</extension>
</complexContent>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_authentication_statement_add_authorityBinding(LassoSamlAuthenticationStatement *node,
LassoSamlAuthorityBinding *authorityBinding)
{
g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
g_assert(LASSO_IS_SAML_AUTHORITY_BINDING(authorityBinding));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(authorityBinding), TRUE);
}
void
lasso_saml_authentication_statement_set_authenticationInstant(LassoSamlAuthenticationStatement *node,
const xmlChar *authenticationInstant)
{
g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
g_assert(authenticationInstant != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "AuthenticationInstant", authenticationInstant);
}
void
lasso_saml_authentication_statement_set_authenticationMethod(LassoSamlAuthenticationStatement *node,
const xmlChar *authenticationMethod)
{
g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
g_assert(authenticationMethod != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "AuthenticationMethod", authenticationMethod);
}
void
lasso_saml_authentication_statement_set_subjectLocality(LassoSamlAuthenticationStatement *node,
LassoSamlSubjectLocality *subjectLocality)
{
g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
g_assert(LASSO_IS_SAML_SUBJECT_LOCALITY(subjectLocality));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(subjectLocality), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_authentication_statement_instance_init(LassoSamlAuthenticationStatement *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
// namespace is herited from SubjectStatementAbstract -> StatementAbstract
//class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "AuthenticationStatement");
}
static void
lasso_saml_authentication_statement_class_init(LassoSamlAuthenticationStatementClass *klass)
{
}
GType lasso_saml_authentication_statement_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlAuthenticationStatementClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_authentication_statement_class_init,
NULL,
NULL,
sizeof(LassoSamlAuthenticationStatement),
0,
(GInstanceInitFunc) lasso_saml_authentication_statement_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT,
"LassoSamlAuthenticationStatement",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_authentication_statement_new:
*
* Creates a new <saml:AuthenticationStatement> node object.
*
* Return value: the new @LassoSamlAuthenticationStatement
**/
LassoNode* lasso_saml_authentication_statement_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT, NULL));
}

View File

@ -0,0 +1,75 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_AUTHENTICATION_STATEMENT_H__
#define __LASSO_SAML_AUTHENTICATION_STATEMENT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_subject_statement_abstract.h>
#include <lasso/xml/saml_authority_binding.h>
#include <lasso/xml/saml_subject_locality.h>
#define LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT (lasso_saml_authentication_statement_get_type())
#define LASSO_SAML_AUTHENTICATION_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT, LassoSamlAuthenticationStatement))
#define LASSO_SAML_AUTHENTICATION_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT, LassoSamlAuthenticationStatementClass))
#define LASSO_IS_SAML_AUTHENTICATION_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT))
#define LASSO_IS_SAML_AUTHENTICATION_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT))
#define LASSO_SAML_AUTHENTICATION_STATEMENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT, LassoSamlAuthenticationStatementClass))
typedef struct _LassoSamlAuthenticationStatement LassoSamlAuthenticationStatement;
typedef struct _LassoSamlAuthenticationStatementClass LassoSamlAuthenticationStatementClass;
struct _LassoSamlAuthenticationStatement {
LassoSamlSubjectStatementAbstract parent;
/*< private >*/
};
struct _LassoSamlAuthenticationStatementClass {
LassoSamlSubjectStatementAbstractClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_authentication_statement_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_authentication_statement_new(void);
LASSO_EXPORT void lasso_saml_authentication_statement_add_authorityBinding (LassoSamlAuthenticationStatement *node,
LassoSamlAuthorityBinding *authorityBinding);
LASSO_EXPORT void lasso_saml_authentication_statement_set_authenticationInstant (LassoSamlAuthenticationStatement *node,
const xmlChar *authenticationInstant);
LASSO_EXPORT void lasso_saml_authentication_statement_set_authenticationMethod (LassoSamlAuthenticationStatement *node,
const xmlChar *authenticationMethod);
LASSO_EXPORT void lasso_saml_authentication_statement_set_subjectLocality (LassoSamlAuthenticationStatement *node,
LassoSamlSubjectLocality *subjectLocality);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_AUTHENTICATION_STATEMENT_H__ */

View File

@ -0,0 +1,128 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_authority_binding.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="AuthorityBinding" type="saml:AuthorityBindingType"/>
<complexType name="AuthorityBindingType">
<attribute name="AuthorityKind" type="QName" use="required"/>
<attribute name="Location" type="anyURI" use="required"/>
<attribute name="Binding" type="anyURI" use="required"/>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_authority_binding_set_authorityKind(LassoSamlAuthorityBinding *node,
const xmlChar *authorityKind)
{
g_assert(LASSO_IS_SAML_AUTHORITY_BINDING(node));
g_assert(authorityKind != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "AuthorityKind", authorityKind);
}
void
lasso_saml_authority_binding_set_binding(LassoSamlAuthorityBinding *node,
const xmlChar *binding)
{
g_assert(LASSO_IS_SAML_AUTHORITY_BINDING(node));
g_assert(binding != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "Binding", binding);
}
void
lasso_saml_authority_binding_set_location(LassoSamlAuthorityBinding *node,
const xmlChar *location)
{
g_assert(LASSO_IS_SAML_AUTHORITY_BINDING(node));
g_assert(location != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "Location", location);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_authority_binding_instance_init(LassoSamlAuthorityBinding *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "AuthorityBinding");
}
static void
lasso_saml_authority_binding_class_init(LassoSamlAuthorityBindingClass *klass)
{
}
GType lasso_saml_authority_binding_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlAuthorityBindingClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_authority_binding_class_init,
NULL,
NULL,
sizeof(LassoSamlAuthorityBinding),
0,
(GInstanceInitFunc) lasso_saml_authority_binding_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlAuthorityBinding",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_authority_binding_new:
*
* Creates a new <saml:AuthorityBinding> node object.
*
* Return value: the new @LassoSamlAuthorityBinding
**/
LassoNode* lasso_saml_authority_binding_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_AUTHORITY_BINDING, NULL));
}

View File

@ -0,0 +1,70 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_AUTHORITY_BINDING_H__
#define __LASSO_SAML_AUTHORITY_BINDING_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_AUTHORITY_BINDING (lasso_saml_authority_binding_get_type())
#define LASSO_SAML_AUTHORITY_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_AUTHORITY_BINDING, LassoSamlAuthorityBinding))
#define LASSO_SAML_AUTHORITY_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_AUTHORITY_BINDING, LassoSamlAuthorityBindingClass))
#define LASSO_IS_SAML_AUTHORITY_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_AUTHORITY_BINDING))
#define LASSO_IS_SAML_AUTHORITY_BINDING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_AUTHORITY_BINDING))
#define LASSO_SAML_AUTHORITY_BINDING_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_AUTHORITY_BINDING, LassoSamlAuthorityBindingClass))
typedef struct _LassoSamlAuthorityBinding LassoSamlAuthorityBinding;
typedef struct _LassoSamlAuthorityBindingClass LassoSamlAuthorityBindingClass;
struct _LassoSamlAuthorityBinding {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlAuthorityBindingClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_authority_binding_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_authority_binding_new(void);
LASSO_EXPORT void lasso_saml_authority_binding_set_authorityKind (LassoSamlAuthorityBinding *node,
const xmlChar *authorityKind);
LASSO_EXPORT void lasso_saml_authority_binding_set_binding (LassoSamlAuthorityBinding *node,
const xmlChar *binding);
LASSO_EXPORT void lasso_saml_authority_binding_set_location (LassoSamlAuthorityBinding *node,
const xmlChar *location);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_AUTHORITY_BINDING_H__ */

View File

@ -0,0 +1,95 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_condition_abstract.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="Condition" type="saml:ConditionAbstractType"/>
<complexType name="ConditionAbstractType" abstract="true"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_condition_abstract_instance_init(LassoSamlConditionAbstract *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "ConditionAbstract");
}
static void
lasso_saml_condition_abstract_class_init(LassoSamlConditionAbstractClass *klass)
{
}
GType lasso_saml_condition_abstract_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlConditionAbstractClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_condition_abstract_class_init,
NULL,
NULL,
sizeof(LassoSamlConditionAbstract),
0,
(GInstanceInitFunc) lasso_saml_condition_abstract_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlConditionAbstract",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_condition_abstract_new:
* @name: the node's name. If @name is NULL or an empty string, default value
* "ConditionAbstract" will be used.
*
* Creates a new <saml:ConditionAbstract> node object.
*
* Return value: the new @LassoSamlConditionAbstract
**/
LassoNode* lasso_saml_condition_abstract_new(const xmlChar *name)
{
LassoNode *node;
node = LASSO_NODE(g_object_new(LASSO_TYPE_SAML_CONDITION_ABSTRACT, NULL));
if (name && *name)
LASSO_NODE_GET_CLASS(node)->set_name(node, name);
return (node);
}

View File

@ -0,0 +1,61 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_CONDITION_ABSTRACT_H__
#define __LASSO_SAML_CONDITION_ABSTRACT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_CONDITION_ABSTRACT (lasso_saml_condition_abstract_get_type())
#define LASSO_SAML_CONDITION_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_CONDITION_ABSTRACT, LassoSamlConditionAbstract))
#define LASSO_SAML_CONDITION_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_CONDITION_ABSTRACT, LassoSamlConditionAbstractClass))
#define LASSO_IS_SAML_CONDITION_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_CONDITION_ABSTRACT))
#define LASSO_IS_SAML_CONDITION_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_CONDITION_ABSTRACT))
#define LASSO_SAML_CONDITION_ABSTRACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_CONDITION_ABSTRACT, LassoSamlConditionAbstractClass))
typedef struct _LassoSamlConditionAbstract LassoSamlConditionAbstract;
typedef struct _LassoSamlConditionAbstractClass LassoSamlConditionAbstractClass;
struct _LassoSamlConditionAbstract {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlConditionAbstractClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_condition_abstract_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_condition_abstract_new(const xmlChar *name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_CONDITION_ABSTRACT_H__ */

176
lasso/xml/saml_conditions.c Normal file
View File

@ -0,0 +1,176 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_conditions.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="Conditions" type="saml:ConditionsType"/>
<complexType name="ConditionsType">
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="saml:AudienceRestrictionCondition"/>
<element ref="saml:Condition"/>
</choice>
<attribute name="NotBefore" type="dateTime" use="optional"/>
<attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
/**
* lasso_saml_conditions_add_condition:
* @node: the <saml:Conditions> node object
* @condition:
*
*
**/
void
lasso_saml_conditions_add_condition(LassoSamlConditions *node,
LassoSamlConditionAbstract *condition)
{
g_assert(LASSO_IS_SAML_CONDITIONS(node));
g_assert(LASSO_IS_SAML_CONDITION_ABSTRACT(condition));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(condition), TRUE);
}
/**
* lasso_saml_conditions_add_audienceRestrictionCondition:
* @node: the <saml:Conditions> node object
* @audienceRestrictionCondition:
*
*
**/
void
lasso_saml_conditions_add_audienceRestrictionCondition(LassoSamlConditions *node,
LassoSamlAudienceRestrictionCondition *audienceRestrictionCondition)
{
g_assert(LASSO_IS_SAML_CONDITIONS(node));
g_assert(LASSO_IS_SAML_AUDIENCE_RESTRICTION_CONDITION(audienceRestrictionCondition));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(audienceRestrictionCondition), TRUE);
}
/**
* lasso_saml_conditions_set_notBefore:
* @node: the <saml:Conditions> node object
* @notBefore: the value of "NotBefore" attribute
*
* Sets the "NotBefore" attribute.
*
* Specifies the earliest time instant at which the assertion is valid. The
* time value is encoded in UTC as described in Section 1.2.2
* (oasis-sstc-saml-core-1.0.pdf).
**/
void
lasso_saml_conditions_set_notBefore(LassoSamlConditions *node,
const xmlChar *notBefore)
{
g_assert(LASSO_IS_SAML_CONDITIONS(node));
g_assert(notBefore != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "NotBefore", notBefore);
}
/**
* lasso_saml_conditions_set_notOnOrAfter:
* @node: the <saml:Conditions> node object
* @notOnOrAfter: the value of "NotOnOrAfter" attribute.
*
* Sets the "NotOnOrAfter" attribute.
*
* Specifies the time instant at which the assertion has expired. The time
* value is encoded in UTC as described in Section 1.2.2
* (oasis-sstc-saml-core-1.0.pdf).
**/
void
lasso_saml_conditions_set_notOnOrAfter(LassoSamlConditions *node,
const xmlChar *notOnOrAfter)
{
g_assert(LASSO_IS_SAML_CONDITIONS(node));
g_assert(notOnOrAfter != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "NotOnOrAfter", notOnOrAfter);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_conditions_instance_init(LassoSamlConditions *instance,
LassoSamlConditionsClass *klass) {
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "Conditions");
}
static void
lasso_saml_conditions_class_init(LassoSamlConditionsClass *klass) {
}
GType lasso_saml_conditions_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlConditionsClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_conditions_class_init,
NULL,
NULL,
sizeof(LassoSamlConditions),
0,
(GInstanceInitFunc) lasso_saml_conditions_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlConditions",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_conditions_new:
*
* Creates a new <saml:Conditions> node object.
*
* Return value: the new @LassoSamlConditions
**/
LassoNode* lasso_saml_conditions_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_CONDITIONS, NULL));
}

View File

@ -0,0 +1,74 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_CONDITIONS_H__
#define __LASSO_SAML_CONDITIONS_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/saml_condition_abstract.h>
#include <lasso/xml/saml_audience_restriction_condition.h>
#define LASSO_TYPE_SAML_CONDITIONS (lasso_saml_conditions_get_type())
#define LASSO_SAML_CONDITIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_CONDITIONS, LassoSamlConditions))
#define LASSO_SAML_CONDITIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_CONDITIONS, LassoSamlConditionsClass))
#define LASSO_IS_SAML_CONDITIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_CONDITIONS))
#define LASSO_IS_SAML_CONDITIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_CONDITIONS))
#define LASSO_SAML_CONDITIONS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_CONDITIONS, LassoSamlConditionsClass))
typedef struct _LassoSamlConditions LassoSamlConditions;
typedef struct _LassoSamlConditionsClass LassoSamlConditionsClass;
struct _LassoSamlConditions {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlConditionsClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_saml_conditions_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_conditions_new(void);
LASSO_EXPORT void lasso_saml_conditions_add_condition (LassoSamlConditions *node,
LassoSamlConditionAbstract *condition);
LASSO_EXPORT void lasso_saml_conditions_add_audienceRestrictionCondition(LassoSamlConditions *node,
LassoSamlAudienceRestrictionCondition *audienceRestrictionCondition);
LASSO_EXPORT void lasso_saml_conditions_set_notBefore (LassoSamlConditions *node,
const xmlChar *notBefore);
LASSO_EXPORT void lasso_saml_conditions_set_notOnOrAfter (LassoSamlConditions *node,
const xmlChar *notOnOrAfter);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_CONDITIONS_H__ */

View File

@ -0,0 +1,126 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_name_identifier.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="NameIdentifier" type="saml:NameIdentifierType"/>
<complexType name="NameIdentifierType">
<simpleContent>
<extension base="string">
<attribute name="NameQualifier" type="string" use="optional"/>
<attribute name="Format" type="anyURI" use="optional"/>
</extension>
</simpleContent>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_name_identifier_set_nameQualifier(LassoSamlNameIdentifier *node,
const xmlChar *nameQualifier)
{
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(node));
g_assert(nameQualifier != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "NameQualifier", nameQualifier);
}
void
lasso_saml_name_identifier_set_format(LassoSamlNameIdentifier *node,
const xmlChar *format)
{
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(node));
g_assert(format != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "Format", format);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_name_identifier_instance_init(LassoSamlNameIdentifier *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "NameIdentifier");
}
static void
lasso_saml_name_identifier_class_init(LassoSamlNameIdentifierClass *klass)
{
}
GType lasso_saml_name_identifier_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlNameIdentifierClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_name_identifier_class_init,
NULL,
NULL,
sizeof(LassoSamlNameIdentifier),
0,
(GInstanceInitFunc) lasso_saml_name_identifier_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlNameIdentifier",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_name_identifier_new:
*
* Creates a new <saml:NameIdentifier> node object.
*
* Return value: the new @LassoSamlNameIdentifier
**/
LassoNode* lasso_saml_name_identifier_new(xmlChar *content)
{
LassoNode *node;
g_assert(content != NULL);
node = LASSO_NODE(g_object_new(LASSO_TYPE_SAML_NAME_IDENTIFIER, NULL));
xmlNodeSetContent(LASSO_NODE_GET_CLASS(node)->get_xmlNode(node),
content);
return (node);
}

View File

@ -0,0 +1,67 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_NAME_IDENTIFIER_H__
#define __LASSO_SAML_NAME_IDENTIFIER_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_NAME_IDENTIFIER (lasso_saml_name_identifier_get_type())
#define LASSO_SAML_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_NAME_IDENTIFIER, LassoSamlNameIdentifier))
#define LASSO_SAML_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_NAME_IDENTIFIER, LassoSamlNameIdentifierClass))
#define LASSO_IS_SAML_NAME_IDENTIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_NAME_IDENTIFIER))
#define LASSO_IS_SAML_NAME_IDENTIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_NAME_IDENTIFIER))
#define LASSO_SAML_NAME_IDENTIFIER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_NAME_IDENTIFIER, LassoSamlNameIdentifierClass))
typedef struct _LassoSamlNameIdentifier LassoSamlNameIdentifier;
typedef struct _LassoSamlNameIdentifierClass LassoSamlNameIdentifierClass;
struct _LassoSamlNameIdentifier {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlNameIdentifierClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_name_identifier_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_name_identifier_new(xmlChar *content);
LASSO_EXPORT void lasso_saml_name_identifier_set_nameQualifier (LassoSamlNameIdentifier *node,
const xmlChar *nameQualifier);
LASSO_EXPORT void lasso_saml_name_identifier_set_format (LassoSamlNameIdentifier *node,
const xmlChar *format);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_NAME_IDENTIFIER_H__ */

View File

@ -0,0 +1,95 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_statement_abstract.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="Statement" type="saml:StatementAbstractType"/>
<complexType name="StatementAbstractType" abstract="true"/>
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_statement_abstract_instance_init(LassoSamlStatementAbstract *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "StatementAbstract");
}
static void
lasso_saml_statement_abstract_class_init(LassoSamlStatementAbstractClass *klass)
{
}
GType lasso_saml_statement_abstract_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlStatementAbstractClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_statement_abstract_class_init,
NULL,
NULL,
sizeof(LassoSamlStatementAbstract),
0,
(GInstanceInitFunc) lasso_saml_statement_abstract_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlStatementAbstract",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_statement_abstract_new:
* @name: the node's name. If @name is NULL or an empty string, default value
* "StatementAbstract" will be used.
*
* Creates a new <saml:StatementAbstract> node object.
*
* Return value: the new @LassoSamlStatementAbstract
**/
LassoNode* lasso_saml_statement_abstract_new(const xmlChar *name)
{
LassoNode *node;
node = LASSO_NODE(g_object_new(LASSO_TYPE_SAML_STATEMENT_ABSTRACT, NULL));
if (name && *name)
LASSO_NODE_GET_CLASS(node)->set_name(node, name);
return (node);
}

View File

@ -0,0 +1,61 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_STATEMENT_ABSTRACT_H__
#define __LASSO_SAML_STATEMENT_ABSTRACT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_STATEMENT_ABSTRACT (lasso_saml_statement_abstract_get_type())
#define LASSO_SAML_STATEMENT_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_STATEMENT_ABSTRACT, LassoSamlStatementAbstract))
#define LASSO_SAML_STATEMENT_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_STATEMENT_ABSTRACT, LassoSamlStatementAbstractClass))
#define LASSO_IS_SAML_STATEMENT_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_STATEMENT_ABSTRACT))
#define LASSO_IS_SAML_STATEMENT_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_STATEMENT_ABSTRACT))
#define LASSO_SAML_STATEMENT_ABSTRACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_STATEMENT_ABSTRACT, LassoSamlStatementAbstractClass))
typedef struct _LassoSamlStatementAbstract LassoSamlStatementAbstract;
typedef struct _LassoSamlStatementAbstractClass LassoSamlStatementAbstractClass;
struct _LassoSamlStatementAbstract {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlStatementAbstractClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_statement_abstract_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_statement_abstract_new(const xmlChar *name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_STATEMENT_ABSTRACT_H__ */

119
lasso/xml/saml_subject.c Normal file
View File

@ -0,0 +1,119 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_subject.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="Subject" type="saml:SubjectType"/>
<complexType name="SubjectType">
<choice>
<sequence>
<element ref="saml:NameIdentifier"/>
<element ref="saml:SubjectConfirmation" minOccurs="0"/>
</sequence>
<element ref="saml:SubjectConfirmation"/>
</choice>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_subject_set_nameIdentifier(LassoSamlSubject *node,
LassoSamlNameIdentifier *nameIdentifier)
{
g_assert(LASSO_IS_SAML_SUBJECT(node));
g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(nameIdentifier), FALSE);
}
void
lasso_saml_subject_set_subjectConfirmation(LassoSamlSubject *node,
LassoSamlSubjectConfirmation *subjectConfirmation)
{
g_assert(LASSO_IS_SAML_SUBJECT(node));
g_assert(LASSO_IS_SAML_SUBJECT_CONFIRMATION(subjectConfirmation));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (subjectConfirmation), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_subject_instance_init(LassoSamlSubject *instance,
LassoSamlSubjectClass *klass) {
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "Subject");
}
static void
lasso_saml_subject_class_init(LassoSamlSubjectClass *klass) {
}
GType lasso_saml_subject_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlSubjectClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_subject_class_init,
NULL,
NULL,
sizeof(LassoSamlSubject),
0,
(GInstanceInitFunc) lasso_saml_subject_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlSubject",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_subject_new:
*
* Creates a new <saml:Subject> node object.
*
* Return value: the new @LassoSamlSubject
**/
LassoNode* lasso_saml_subject_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_SUBJECT, NULL));
}

68
lasso/xml/saml_subject.h Normal file
View File

@ -0,0 +1,68 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_SUBJECT_H__
#define __LASSO_SAML_SUBJECT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/saml_name_identifier.h>
#include <lasso/xml/saml_subject_confirmation.h>
#define LASSO_TYPE_SAML_SUBJECT (lasso_saml_subject_get_type())
#define LASSO_SAML_SUBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_SUBJECT, LassoSamlSubject))
#define LASSO_SAML_SUBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_SUBJECT, LassoSamlSubjectClass))
#define LASSO_IS_SAML_SUBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_SUBJECT))
#define LASSO_IS_SAML_SUBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_SUBJECT))
#define LASSO_SAML_SUBJECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_SUBJECT, LassoSamlSubjectClass))
typedef struct _LassoSamlSubject LassoSamlSubject;
typedef struct _LassoSamlSubjectClass LassoSamlSubjectClass;
struct _LassoSamlSubject {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlSubjectClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_saml_subject_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_subject_new(void);
LASSO_EXPORT void lasso_saml_subject_set_nameIdentifier (LassoSamlSubject *node,
LassoSamlNameIdentifier *nameIdentifier);
LASSO_EXPORT void lasso_saml_subject_set_subjectConfirmation (LassoSamlSubject *node,
LassoSamlSubjectConfirmation *subjectConfirmation);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_SUBJECT_H__ */

View File

@ -0,0 +1,124 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_subject_confirmation.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="SubjectConfirmation" type="saml:SubjectConfirmationType"/>
<complexType name="SubjectConfirmationType">
<sequence>
<element ref="saml:ConfirmationMethod" maxOccurs="unbounded"/>
<element ref="saml:SubjectConfirmationData" minOccurs="0"/>
<element ref="ds:KeyInfo" minOccurs="0"/>
</sequence>
</complexType>
<element name="SubjectConfirmationData" type="anyType"/>
<element name="ConfirmationMethod" type="anyURI"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_subject_confirmation_add_confirmationMethod(LassoSamlSubjectConfirmation *node,
const xmlChar *confirmationMethod)
{
g_assert(LASSO_IS_SAML_SUBJECT_CONFIRMATION(node));
g_assert(confirmationMethod != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node),
"ConfirmationMethod", confirmationMethod, TRUE);
}
void
lasso_saml_subject_confirmation_set_subjectConfirmationMethod(LassoSamlSubjectConfirmation *node,
const xmlChar *subjectConfirmationMethod)
{
g_assert(LASSO_IS_SAML_SUBJECT_CONFIRMATION(node));
g_assert(subjectConfirmationMethod != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node),
"SubjectConfirmationMethod", subjectConfirmationMethod,
FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_subject_confirmation_instance_init(LassoSamlSubjectConfirmation *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "SubjectConfirmation");
}
static void
lasso_saml_subject_confirmation_class_init(LassoSamlSubjectConfirmationClass *klass)
{
}
GType lasso_saml_subject_confirmation_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlSubjectConfirmationClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_subject_confirmation_class_init,
NULL,
NULL,
sizeof(LassoSamlSubjectConfirmation),
0,
(GInstanceInitFunc) lasso_saml_subject_confirmation_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlSubjectConfirmation",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_subject_confirmation_new:
*
* Creates a new <saml:SubjectConfirmation> node object.
*
* Return value: the new @LassoSamlSubjectConfirmation
**/
LassoNode* lasso_saml_subject_confirmation_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_SUBJECT_CONFIRMATION, NULL));
}

View File

@ -0,0 +1,67 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_SUBJECT_CONFIRMATION_H__
#define __LASSO_SAML_SUBJECT_CONFIRMATION_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_SUBJECT_CONFIRMATION (lasso_saml_subject_confirmation_get_type())
#define LASSO_SAML_SUBJECT_CONFIRMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_SUBJECT_CONFIRMATION, LassoSamlSubjectConfirmation))
#define LASSO_SAML_SUBJECT_CONFIRMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_SUBJECT_CONFIRMATION, LassoSamlSubjectConfirmationClass))
#define LASSO_IS_SAML_SUBJECT_CONFIRMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_SUBJECT_CONFIRMATION))
#define LASSO_IS_SAML_SUBJECT_CONFIRMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_SUBJECT_CONFIRMATION))
#define LASSO_SAML_SUBJECT_CONFIRMATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_SUBJECT_CONFIRMATION, LassoSamlSubjectConfirmationClass))
typedef struct _LassoSamlSubjectConfirmation LassoSamlSubjectConfirmation;
typedef struct _LassoSamlSubjectConfirmationClass LassoSamlSubjectConfirmationClass;
struct _LassoSamlSubjectConfirmation {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlSubjectConfirmationClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_subject_confirmation_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_subject_confirmation_new(void);
LASSO_EXPORT void lasso_saml_subject_confirmation_add_confirmationMethod (LassoSamlSubjectConfirmation *node,
const xmlChar *confirmationMethod);
LASSO_EXPORT void lasso_saml_subject_confirmation_set_subjectConfirmationMethod (LassoSamlSubjectConfirmation *node,
const xmlChar *subjectConfirmationMethod);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_SUBJECT_CONFIRMATION_H__ */

View File

@ -0,0 +1,115 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_subject_locality.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="SubjectLocality" type="saml:SubjectLocalityType"/>
<complexType name="SubjectLocalityType">
<attribute name="IPAddress" type="string" use="optional"/>
<attribute name="DNSAddress" type="string" use="optional"/>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_saml_subject_locality_set_dnsAddress(LassoSamlSubjectLocality *node,
const xmlChar *dnsAddress)
{
g_assert(LASSO_IS_SAML_SUBJECT_LOCALITY(node));
g_assert(dnsAddress != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "DNSAddress", dnsAddress);
}
void
lasso_saml_subject_locality_set_ipAddress(LassoSamlSubjectLocality *node,
const xmlChar *ipAddress)
{
g_assert(LASSO_IS_SAML_SUBJECT_LOCALITY(node));
g_assert(ipAddress != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "IPAddress", ipAddress);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_subject_locality_instance_init(LassoSamlSubjectLocality *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "SubjectLocality");
}
static void
lasso_saml_subject_locality_class_init(LassoSamlSubjectLocalityClass *klass)
{
}
GType lasso_saml_subject_locality_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlSubjectLocalityClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_subject_locality_class_init,
NULL,
NULL,
sizeof(LassoSamlSubjectLocality),
0,
(GInstanceInitFunc) lasso_saml_subject_locality_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlSubjectLocality",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_subject_locality_new:
*
* Creates a new <saml:SubjectLocality> node object.
*
* Return value: the new @LassoSamlSubjectLocality
**/
LassoNode* lasso_saml_subject_locality_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_SUBJECT_LOCALITY, NULL));
}

View File

@ -0,0 +1,67 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_SUBJECT_LOCALITY_H__
#define __LASSO_SAML_SUBJECT_LOCALITY_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAML_SUBJECT_LOCALITY (lasso_saml_subject_locality_get_type())
#define LASSO_SAML_SUBJECT_LOCALITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_SUBJECT_LOCALITY, LassoSamlSubjectLocality))
#define LASSO_SAML_SUBJECT_LOCALITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_SUBJECT_LOCALITY, LassoSamlSubjectLocalityClass))
#define LASSO_IS_SAML_SUBJECT_LOCALITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_SUBJECT_LOCALITY))
#define LASSO_IS_SAML_SUBJECT_LOCALITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_SUBJECT_LOCALITY))
#define LASSO_SAML_SUBJECT_LOCALITY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_SUBJECT_LOCALITY, LassoSamlSubjectLocalityClass))
typedef struct _LassoSamlSubjectLocality LassoSamlSubjectLocality;
typedef struct _LassoSamlSubjectLocalityClass LassoSamlSubjectLocalityClass;
struct _LassoSamlSubjectLocality {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlSubjectLocalityClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_subject_locality_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_subject_locality_new(void);
LASSO_EXPORT void lasso_saml_subject_locality_set_dnsAddress (LassoSamlSubjectLocality *node,
const xmlChar *dnsAddress);
LASSO_EXPORT void lasso_saml_subject_locality_set_ipAddress (LassoSamlSubjectLocality *node,
const xmlChar *ipAddress);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_SUBJECT_LOCALITY_H__ */

View File

@ -0,0 +1,119 @@
/* $Id$
*
* Lasso - A free implementation of the Samlerty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/saml_subject_statement_abstract.h>
/*
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
<element name="SubjectStatement" type="saml:SubjectStatementAbstractType"/>
<complexType name="SubjectStatementAbstractType" abstract="true">
<complexContent>
<extension base="saml:StatementAbstractType">
<sequence>
<element ref="saml:Subject"/>
</sequence>
</extension>
</complexContent>
</complexType>
*/
/*****************************************************************************/
/* publics methods */
/*****************************************************************************/
void
lasso_saml_subject_statement_abstract_set_subject(LassoSamlSubjectStatementAbstract *node,
LassoSamlSubject *subject)
{
g_assert(LASSO_IS_SAML_SUBJECT_STATEMENT_ABSTRACT(node));
g_assert(LASSO_IS_SAML_SUBJECT(subject));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(subject), FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_saml_subject_statement_abstract_instance_init(LassoSamlSubjectStatementAbstract *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
// namespace is herited from StatementAbstract
//class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:assertion", "saml");
class->set_name(node, "SubjectStatementAbstract");
}
static void
lasso_saml_subject_statement_abstract_class_init(LassoSamlSubjectStatementAbstractClass *klass)
{
}
GType lasso_saml_subject_statement_abstract_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlSubjectStatementAbstractClass),
NULL,
NULL,
(GClassInitFunc) lasso_saml_subject_statement_abstract_class_init,
NULL,
NULL,
sizeof(LassoSamlSubjectStatementAbstract),
0,
(GInstanceInitFunc) lasso_saml_subject_statement_abstract_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_SAML_STATEMENT_ABSTRACT,
"LassoSamlSubjectStatementAbstract",
&this_info, 0);
}
return this_type;
}
/**
* lasso_saml_subject_statement_abstract_new:
* @name: the node's name. If @name is NULL or an empty string, default value
* "SubjectStatementAbstract" will be used.
*
* Creates a new <saml:SubjectStatementAbstract> node object.
*
* Return value: the new @LassoSamlSubjectStatementAbstract
**/
LassoNode* lasso_saml_subject_statement_abstract_new(const xmlChar *name)
{
LassoNode *node;
node = LASSO_NODE(g_object_new(LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT, NULL));
if (name && *name)
LASSO_NODE_GET_CLASS(node)->set_name(node, name);
return (node);
}

View File

@ -0,0 +1,65 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT_H__
#define __LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml_statement_abstract.h>
#include <lasso/xml/saml_subject.h>
#define LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT (lasso_saml_subject_statement_abstract_get_type())
#define LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT, LassoSamlSubjectStatementAbstract))
#define LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT, LassoSamlSubjectStatementAbstractClass))
#define LASSO_IS_SAML_SUBJECT_STATEMENT_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT))
#define LASSO_IS_SAML_SUBJECT_STATEMENT_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT))
#define LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT, LassoSamlSubjectStatementAbstractClass))
typedef struct _LassoSamlSubjectStatementAbstract LassoSamlSubjectStatementAbstract;
typedef struct _LassoSamlSubjectStatementAbstractClass LassoSamlSubjectStatementAbstractClass;
struct _LassoSamlSubjectStatementAbstract {
LassoSamlStatementAbstract parent;
/*< private >*/
};
struct _LassoSamlSubjectStatementAbstractClass {
LassoSamlStatementAbstractClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_saml_subject_statement_abstract_get_type(void);
LASSO_EXPORT LassoNode* lasso_saml_subject_statement_abstract_new(const xmlChar *name);
LASSO_EXPORT void lasso_saml_subject_statement_abstract_set_subject (LassoSamlSubjectStatementAbstract *node,
LassoSamlSubject *subject);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT_H__ */

View File

@ -0,0 +1,158 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/samlp_request_abstract.h>
/*
The schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
<complexType name="RequestAbstractType" abstract="true">
<sequence>
<element ref="samlp:RespondWith" minOccurs="0" maxOccurs="unbounded"/>
<element ref="ds:Signature" minOccurs="0"/>
</sequence>
<attribute name="RequestID" type="saml:IDType" use="required"/>
<attribute name="MajorVersion" type="integer" use="required"/>
<attribute name="MinorVersion" type="integer" use="required"/>
<attribute name="IssueInstant" type="dateTime" use="required"/>
</complexType>
<element name="RespondWith" type="QName"/>
From oasis-sstc-saml-schema-assertion-1.0.xsd:
<simpleType name="IDType">
<restriction base="string"/>
</simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_samlp_request_abstract_add_respondWith(LassoSamlpRequestAbstract *node,
const xmlChar *respondWith)
{
g_assert(LASSO_IS_SAMLP_REQUEST_ABSTRACT(node));
g_assert(respondWith != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "RespondWith", respondWith, TRUE);
}
void
lasso_samlp_request_abstract_set_issueInstance(LassoSamlpRequestAbstract *node,
const xmlChar *issueInstance) {
g_assert(LASSO_IS_SAMLP_REQUEST_ABSTRACT(node));
g_assert(issueInstance != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "IssueInstance", issueInstance);
}
void
lasso_samlp_request_abstract_set_majorVersion(LassoSamlpRequestAbstract *node,
const xmlChar *majorVersion) {
g_assert(LASSO_IS_SAMLP_REQUEST_ABSTRACT(node));
g_assert(majorVersion != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "MajorVersion", majorVersion);
}
void
lasso_samlp_request_abstract_set_minorVersion(LassoSamlpRequestAbstract *node,
const xmlChar *minorVersion) {
g_assert(LASSO_IS_SAMLP_REQUEST_ABSTRACT(node));
g_assert(minorVersion != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "MinorVersion", minorVersion);
}
/**
* lasso_samlp_request_abstract_impl_set_requestID:
* @node: the pointer to <Samlp:RequestAbstract/> node
* @requestID: the RequestID attribut
*
* Sets the RequestID attribut (unique)
**/
void
lasso_samlp_request_abstract_set_requestID(LassoSamlpRequestAbstract *node,
const xmlChar *requestID)
{
g_assert(LASSO_IS_SAMLP_REQUEST_ABSTRACT(node));
g_assert(requestID != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "RequestID", requestID);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_samlp_request_abstract_instance_init(LassoSamlpRequestAbstract *instance,
LassoSamlpRequestAbstractClass *klass) {
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, NULL, "samlp");
class->set_name(node, "RequestAbstract");
}
static void
lasso_samlp_request_abstract_class_init(LassoSamlpRequestAbstractClass *klass)
{
}
GType lasso_samlp_request_abstract_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlpRequestAbstractClass),
NULL,
NULL,
(GClassInitFunc) lasso_samlp_request_abstract_class_init,
NULL,
NULL,
sizeof(LassoSamlpRequestAbstract),
0,
(GInstanceInitFunc) lasso_samlp_request_abstract_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE ,
"LassoSamlpRequestAbstract",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_samlp_request_abstract_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_SAMLP_REQUEST_ABSTRACT,
NULL));
}

View File

@ -0,0 +1,76 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAMLP_REQUEST_ABSTRACT_H__
#define __LASSO_SAMLP_REQUEST_ABSTRACT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAMLP_REQUEST_ABSTRACT (lasso_samlp_request_abstract_get_type())
#define LASSO_SAMLP_REQUEST_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAMLP_REQUEST_ABSTRACT, LassoSamlpRequestAbstract))
#define LASSO_SAMLP_REQUEST_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAMLP_REQUEST_ABSTRACT, LassoSamlpRequestAbstractClass))
#define LASSO_IS_SAMLP_REQUEST_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAMLP_REQUEST_ABSTRACT))
#define LASSO_IS_SAMLP_REQUEST_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAMLP_REQUEST_ABSTRACT))
#define LASSO_SAMLP_REQUEST_ABSTRACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAMLP_REQUEST_ABSTRACT, LassoSamlpRequestAbstractClass))
typedef struct _LassoSamlpRequestAbstract LassoSamlpRequestAbstract;
typedef struct _LassoSamlpRequestAbstractClass LassoSamlpRequestAbstractClass;
struct _LassoSamlpRequestAbstract {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlpRequestAbstractClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_samlp_request_abstract_get_type(void);
LASSO_EXPORT LassoNode* lasso_samlp_request_abstract_new(void);
LASSO_EXPORT void lasso_samlp_request_abstract_add_respondWith (LassoSamlpRequestAbstract *node,
const xmlChar *respondWith);
LASSO_EXPORT void lasso_samlp_request_abstract_set_issueInstance (LassoSamlpRequestAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_request_abstract_set_majorVersion (LassoSamlpRequestAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_request_abstract_set_minorVersion (LassoSamlpRequestAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_request_abstract_set_requestID (LassoSamlpRequestAbstract *,
const xmlChar *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAMLP_REQUEST_ABSTRACT_H__ */

114
lasso/xml/samlp_response.c Normal file
View File

@ -0,0 +1,114 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/samlp_response.h>
/*
Schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
<element name="Response" type="samlp:ResponseType"/>
<complexType name="ResponseType">
<complexContent>
<extension base="samlp:ResponseAbstractType">
<sequence>
<element ref="samlp:Status"/>
<element ref="saml:Assertion" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</extension>
</complexContent>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_samlp_response_set_status(LassoSamlpResponse *node,
LassoSamlpStatus *status)
{
g_assert(LASSO_IS_SAMLP_RESPONSE(node));
g_assert(LASSO_IS_SAMLP_STATUS(status));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(status), FALSE);
}
void
lasso_samlp_response_add_assertion(LassoSamlpResponse *node,
gpointer assertion)
{
g_assert(LASSO_IS_SAMLP_RESPONSE(node));
//g_assert(LASSO_IS_SAML_ASSERTION(assertion));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE(assertion), TRUE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_samlp_response_instance_init(LassoSamlpResponse *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, NULL, "samlp");
class->set_name(node, "Response");
}
static void
lasso_samlp_response_class_init(LassoSamlpResponseClass *klass) {
}
GType lasso_samlp_response_get_type() {
static GType response_type = 0;
if (!response_type) {
static const GTypeInfo response_info = {
sizeof (LassoSamlpResponseClass),
NULL,
NULL,
(GClassInitFunc) lasso_samlp_response_class_init,
NULL,
NULL,
sizeof(LassoSamlpResponse),
0,
(GInstanceInitFunc) lasso_samlp_response_instance_init,
};
response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT ,
"LassoSamlpResponse",
&response_info, 0);
}
return response_type;
}
LassoNode* lasso_samlp_response_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAMLP_RESPONSE, NULL));
}

View File

@ -0,0 +1,67 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAMLP_RESPONSE_H__
#define __LASSO_SAMLP_RESPONSE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/samlp_response_abstract.h>
#include <lasso/xml/samlp_status.h>
#define LASSO_TYPE_SAMLP_RESPONSE (lasso_samlp_response_get_type())
#define LASSO_SAMLP_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAMLP_RESPONSE, LassoSamlpResponse))
#define LASSO_SAMLP_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAMLP_RESPONSE, LassoSamlpResponseClass))
#define LASSO_IS_SAMLP_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAMLP_RESPONSE))
#define LASSO_IS_SAMLP_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAMLP_RESPONSE))
#define LASSO_SAMLP_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAMLP_RESPONSE, LassoSamlpResponseClass))
typedef struct _LassoSamlpResponse LassoSamlpResponse;
typedef struct _LassoSamlpResponseClass LassoSamlpResponseClass;
struct _LassoSamlpResponse {
LassoSamlpResponseAbstract parent;
/*< private >*/
};
struct _LassoSamlpResponseClass {
LassoSamlpResponseAbstractClass parent;
};
LASSO_EXPORT GType lasso_samlp_response_get_type(void);
LASSO_EXPORT LassoNode* lasso_samlp_response_new(void);
LASSO_EXPORT void lasso_samlp_response_set_status (LassoSamlpResponse *node,
LassoSamlpStatus *status);
LASSO_EXPORT void lasso_samlp_response_add_assertion (LassoSamlpResponse *node,
gpointer assertion);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAMLP_RESPONSE_H__ */

View File

@ -0,0 +1,180 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/samlp_response_abstract.h>
/*
The schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
<complexType name="ResponseAbstractType" abstract="true">
<sequence>
<element ref="ds:Signature" minOccurs="0"/>
</sequence>
<attribute name="ResponseID" type="saml:IDType" use="required"/>
<attribute name="InResponseTo" type="saml:IDReferenceType" use="optional"/>
<attribute name="MajorVersion" type="integer" use="required"/>
<attribute name="MinorVersion" type="integer" use="required"/>
<attribute name="IssueInstant" type="dateTime" use="required"/>
<attribute name="Recipient" type="anyURI" use="optional"/>
</complexType>
From oasis-sstc-saml-schema-assertion-1.0.xsd:
<simpleType name="IDType">
<restriction base="string"/>
</simpleType>
<simpleType name="IDReferenceType">
<restriction base="string"/>
</simpleType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_samlp_response_abstract_set_inResponseTo(LassoSamlpResponseAbstract *node,
const xmlChar *inResponseTo)
{
g_assert(LASSO_IS_SAMLP_RESPONSE_ABSTRACT(node));
g_assert(inResponseTo != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "InResponseTo", inResponseTo);
}
void
lasso_samlp_response_abstract_set_issueInstance(LassoSamlpResponseAbstract *node,
const xmlChar *issueInstance)
{
g_assert(LASSO_IS_SAMLP_RESPONSE_ABSTRACT(node));
g_assert(issueInstance != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "IssueInstance", issueInstance);
}
void
lasso_samlp_response_abstract_set_majorVersion(LassoSamlpResponseAbstract *node,
const xmlChar *majorVersion)
{
g_assert(LASSO_IS_SAMLP_RESPONSE_ABSTRACT(node));
g_assert(majorVersion != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "MajorVersion", majorVersion);
}
void
lasso_samlp_response_abstract_set_minorVersion(LassoSamlpResponseAbstract *node,
const xmlChar *minorVersion)
{
g_assert(LASSO_IS_SAMLP_RESPONSE_ABSTRACT(node));
g_assert(minorVersion != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "MinorVersion", minorVersion);
}
void
lasso_samlp_response_abstract_set_recipient(LassoSamlpResponseAbstract *node,
const xmlChar *recipient)
{
g_assert(LASSO_IS_SAMLP_RESPONSE_ABSTRACT(node));
g_assert(recipient != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "Recipient", recipient);
}
/**
* lasso_samlp_response_abstract_set_responseId:
* @node: the pointer to <Samlp:ResponseAbstract/> node
* @responseId: the ResponseID attribut
*
* Sets the ResponseID attribut (unique)
**/
void
lasso_samlp_response_abstract_set_responseID(LassoSamlpResponseAbstract *node,
const xmlChar *responseID)
{
g_assert(LASSO_IS_SAMLP_RESPONSE_ABSTRACT(node));
g_assert(responseID != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "ResponseID", responseID);
}
/* TODO
void
lasso_samlp_response_abstract_set_signature(LassoSamlpResponseAbstract *node)
{
}
*/
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_samlp_response_abstract_instance_init(LassoSamlpResponseAbstract *instance)
{
LassoNode *node = LASSO_NODE(instance);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, NULL, "samlp");
class->set_name(node, "ResponseAbstract");
}
static void
lasso_samlp_response_abstract_class_init(LassoSamlpResponseAbstractClass *klass)
{
}
GType lasso_samlp_response_abstract_get_type() {
static GType response_abstract_type = 0;
if (!response_abstract_type) {
static const GTypeInfo response_abstract_info = {
sizeof (LassoSamlpResponseAbstractClass),
NULL,
NULL,
(GClassInitFunc) lasso_samlp_response_abstract_class_init,
NULL,
NULL,
sizeof(LassoSamlpResponseAbstract),
0,
(GInstanceInitFunc) lasso_samlp_response_abstract_instance_init,
};
response_abstract_type = g_type_register_static(LASSO_TYPE_NODE ,
"LassoSamlpResponseAbstract",
&response_abstract_info, 0);
}
return response_abstract_type;
}
LassoNode* lasso_samlp_response_abstract_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT, NULL));
}

View File

@ -0,0 +1,79 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAMLP_RESPONSE_ABSTRACT_H__
#define __LASSO_SAMLP_RESPONSE_ABSTRACT_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT (lasso_samlp_response_abstract_get_type())
#define LASSO_SAMLP_RESPONSE_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT, LassoSamlpResponseAbstract))
#define LASSO_SAMLP_RESPONSE_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT, LassoSamlpResponseAbstractClass))
#define LASSO_IS_SAMLP_RESPONSE_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT))
#define LASSO_IS_SAMLP_RESPONSE_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT))
#define LASSO_SAMLP_RESPONSE_ABSTRACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT, LassoSamlpResponseAbstractClass))
typedef struct _LassoSamlpResponseAbstract LassoSamlpResponseAbstract;
typedef struct _LassoSamlpResponseAbstractClass LassoSamlpResponseAbstractClass;
struct _LassoSamlpResponseAbstract {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlpResponseAbstractClass {
LassoNodeClass parent;
/*< vtable >*/
};
LASSO_EXPORT GType lasso_samlp_response_abstract_get_type(void);
LASSO_EXPORT LassoNode* lasso_samlp_response_abstract_new(void);
LASSO_EXPORT void lasso_samlp_response_abstract_set_inResponseTo (LassoSamlpResponseAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_response_abstract_set_issueInstance (LassoSamlpResponseAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_response_abstract_set_majorVersion (LassoSamlpResponseAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_response_abstract_set_minorVersion (LassoSamlpResponseAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_response_abstract_set_recipient (LassoSamlpResponseAbstract *,
const xmlChar *);
LASSO_EXPORT void lasso_samlp_response_abstract_set_responseID (LassoSamlpResponseAbstract *,
const xmlChar *);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAMLP_RESPONSE_ABSTRACT_H__ */

120
lasso/xml/samlp_status.c Normal file
View File

@ -0,0 +1,120 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/samlp_status.h>
/*
Schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
<element name="Status" type="samlp:StatusType"/>
<complexType name="StatusType">
<sequence>
<element ref="samlp:StatusCode"/>
<element ref="samlp:StatusMessage" minOccurs="0" maxOccurs="1"/>
<element ref="samlp:StatusDetail" minOccurs="0"/>
</sequence>
</complexType>
<element name="StatusMessage" type="string"/>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_samlp_status_set_statusCode(LassoSamlpStatus *node,
LassoSamlpStatusCode *statusCode) {
g_assert(LASSO_IS_SAMLP_STATUS(node));
g_assert(LASSO_IS_SAMLP_STATUS_CODE(statusCode));
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(LASSO_NODE (node), LASSO_NODE (statusCode), FALSE);
}
/* TODO
void
lasso_samlp_status_set_statusDetail(LassoSamlpStatus *node,
LassoSamlpStatusDetail *statusDetail)
{
}
*/
void
lasso_samlp_status_set_statusMessage(LassoSamlpStatus *node,
const xmlChar *statusMessage)
{
g_assert(LASSO_IS_SAMLP_STATUS(node));
g_assert(statusMessage != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_child(LASSO_NODE (node), "StatusMessage", statusMessage, FALSE);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_samlp_status_instance_init(LassoSamlpStatus *instance)
{
LassoNode *node = (LassoNode *)instance;
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, "urn:oasis:names:tc:SAML:1.0:protocol", "samlp");
class->set_name(node, "Status");
}
static void
lasso_samlp_status_class_init(LassoSamlpStatusClass *klass)
{
}
GType lasso_samlp_status_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlpStatusClass),
NULL,
NULL,
(GClassInitFunc) lasso_samlp_status_class_init,
NULL,
NULL,
sizeof(LassoSamlpStatus),
0,
(GInstanceInitFunc) lasso_samlp_status_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlpStatus",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_samlp_status_new() {
return LASSO_NODE(g_object_new(LASSO_TYPE_SAMLP_STATUS,
NULL));
}

72
lasso/xml/samlp_status.h Normal file
View File

@ -0,0 +1,72 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAMLP_STATUS_H__
#define __LASSO_SAMLP_STATUS_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/samlp_status_code.h>
#define LASSO_TYPE_SAMLP_STATUS (lasso_samlp_status_get_type())
#define LASSO_SAMLP_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAMLP_STATUS, LassoSamlpStatus))
#define LASSO_SAMLP_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAMLP_STATUS, LassoSamlpStatusClass))
#define LASSO_IS_SAMLP_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAMLP_STATUS))
#define LASSO_IS_SAMLP_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAMLP_STATUS))
#define LASSO_SAMLP_STATUS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAMLP_STATUS, LassoSamlpStatusClass))
typedef struct _LassoSamlpStatus LassoSamlpStatus;
typedef struct _LassoSamlpStatusClass LassoSamlpStatusClass;
struct _LassoSamlpStatus {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlpStatusClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_samlp_status_get_type(void);
LASSO_EXPORT LassoNode* lasso_samlp_status_new(void);
LASSO_EXPORT void lasso_samlp_status_set_statusCode (LassoSamlpStatus *node,
LassoSamlpStatusCode *statusCode);
/* TODO
LASSO_EXPORT void lasso_samlp_status_set_statusDetail(LassoSamlpStatus *node,
LassoSamlpStatusDetail *statusDetail);
*/
LASSO_EXPORT void lasso_samlp_status_set_statusMessage (LassoSamlpStatus *node,
const xmlChar *statusMessage);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAMLP_STATUS_H__ */

View File

@ -0,0 +1,99 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/samlp_status_code.h>
/*
Schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
<element name="StatusCode" type="samlp:StatusCodeType"/>
<complexType name="StatusCodeType">
<sequence>
<element ref="samlp:StatusCode" minOccurs="0"/>
</sequence>
<attribute name="Value" type="QName" use="required"/>
</complexType>
*/
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
void
lasso_samlp_status_code_set_value(LassoSamlpStatusCode *node,
const xmlChar *value) {
g_assert(LASSO_IS_SAMLP_STATUS_CODE(node));
g_assert(value != NULL);
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(LASSO_NODE (node), "Value", value);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_samlp_status_code_instance_init(LassoSamlpStatusCode *instance)
{
LassoNode *node = (LassoNode *)instance;
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, NULL, "samlp");
class->set_name(node, "StatusCode");
}
static void
lasso_samlp_status_code_class_init(LassoSamlpStatusCodeClass *klass)
{
}
GType lasso_samlp_status_code_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoSamlpStatusCodeClass),
NULL,
NULL,
(GClassInitFunc) lasso_samlp_status_code_class_init,
NULL,
NULL,
sizeof(LassoSamlpStatusCode),
0,
(GInstanceInitFunc) lasso_samlp_status_code_instance_init,
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoSamlpStatusCode",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_samlp_status_code_new()
{
return LASSO_NODE(g_object_new(LASSO_TYPE_SAMLP_STATUS_CODE, NULL));
}

View File

@ -0,0 +1,63 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_SAMLP_STATUS_CODE_H__
#define __LASSO_SAMLP_STATUS_CODE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#define LASSO_TYPE_SAMLP_STATUS_CODE (lasso_samlp_status_code_get_type())
#define LASSO_SAMLP_STATUS_CODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SAMLP_STATUS_CODE, LassoSamlpStatusCode))
#define LASSO_SAMLP_STATUS_CODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SAMLP_STATUS_CODE, LassoSamlpStatusCodeClass))
#define LASSO_IS_SAMLP_STATUS_CODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SAMLP_STATUS_CODE))
#define LASSO_IS_SAMLP_STATUS_CODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SAMLP_STATUS_CODE))
#define LASSO_SAMLP_STATUS_CODE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SAMLP_STATUS_CODE, LassoSamlpStatusCodeClass))
typedef struct _LassoSamlpStatusCode LassoSamlpStatusCode;
typedef struct _LassoSamlpStatusCodeClass LassoSamlpStatusCodeClass;
struct _LassoSamlpStatusCode {
LassoNode parent;
/*< private >*/
};
struct _LassoSamlpStatusCodeClass {
LassoNodeClass parent;
};
LASSO_EXPORT GType lasso_samlp_status_code_get_type(void);
LASSO_EXPORT LassoNode* lasso_samlp_status_code_new(void);
LASSO_EXPORT void lasso_samlp_status_code_set_value (LassoSamlpStatusCode *node,
const xmlChar *value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_SAMLP_STATUS_CODE_H__ */

45
lasso/xml/strings.c Normal file
View File

@ -0,0 +1,45 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/lasso.h>
/* NameIDPolicyType */
const gchar lassoLibNameIDPolicyTypeNone[] = "none";
const gchar lassoLibNameIDPolicyTypeOneTime[] = "onetime";
const gchar lassoLibNameIDPolicyTypeFederated[] = "federated";
const gchar lassoLibNameIDPolicyTypeAny[] = "any";
/* AuthnContextComparison */
const gchar lassoLibAuthnContextComparisonExact[] = "exact";
const gchar lassoLibAuthnContextComparisonMinimum[] = "minimum";
const gchar lassoLibAuthnContextComparisonBetter[] = "better";
/* Lib versioning */
const gchar lassoLibMajorVersion[] = "1";
const gchar lassoLibMinorVersion[] = "2";
/* Saml versioning */
const gchar lassoSamlMajorVersion[] = "1";
const gchar lassoSamlMinorVersion[] = "0";

58
lasso/xml/strings.h Normal file
View File

@ -0,0 +1,58 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_STRINGS_H__
#define __LASSO_STRINGS_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/export.h>
#include <glib-object.h>
/* NameIDPolicyType */
LASSO_EXPORT_VAR const gchar lassoLibNameIDPolicyTypeNone[];
LASSO_EXPORT_VAR const gchar lassoLibNameIDPolicyTypeOneTime[];
LASSO_EXPORT_VAR const gchar lassoLibNameIDPolicyTypeFederated[];
LASSO_EXPORT_VAR const gchar lassoLibNameIDPolicyTypeAny[];
/* AuthnContextComparison */
LASSO_EXPORT_VAR const gchar lassoLibAuthnContextComparisonExact[];
LASSO_EXPORT_VAR const gchar lassoLibAuthnContextComparisonMinimum[];
LASSO_EXPORT_VAR const gchar lassLibAuthnContextComparisonBetter[];
/* Lib versioning */
LASSO_EXPORT_VAR const gchar lassoLibMajorVersion[];
LASSO_EXPORT_VAR const gchar lassoLibMinorVersion[];
/* Saml versioning */
LASSO_EXPORT_VAR const gchar lassoSamlMajorVersion[];
LASSO_EXPORT_VAR const gchar lassoSamlMinorVersion[];
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_STRINGS_H__ */

323
lasso/xml/tools.c Normal file
View File

@ -0,0 +1,323 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/tools.h>
xmlChar *
lasso_build_unique_id(guint8 size)
{
// The probability of 2 randomly chosen identifiers being identical MUST be
// less than 2^-128 and SHOULD be less than 2^-160.
// so we must have 128 <= exp <= 160
// we could build a 128-bit binary number but hexa system is shorter
// 32 <= hexa number size <= 48
int i, val;
xmlChar *id, *enc_id;
if (size == 0) size = 32;
id = g_malloc(size+1);
// build hex number (<= 2^exp-1)
for (i=0; i<size; i++) {
val = g_random_int_range(0, 16);
if (val < 10)
id[i] = 48 + val;
else
id[i] = 65 + val-10;
}
id[size] = '\0';
// base64 encoding of build string
enc_id = xmlSecBase64Encode(id, size, 0);
g_free(id);
return (enc_id);
}
xmlChar *
lasso_doc_get_node_content(xmlDocPtr doc, const xmlChar *name)
{
xmlNodePtr node;
node = xmlSecFindNode(xmlDocGetRootElement(doc), name, xmlSecDSigNs);
if (node != NULL)
/* val returned must be xmlFree() */
return (xmlNodeGetContent(node));
else
return (NULL);
}
xmlChar*
lasso_g_ptr_array_index(GPtrArray *a, guint i)
{
if (a != NULL) {
return (g_ptr_array_index(a, i));
}
else {
return (NULL);
}
}
xmlChar *
lasso_get_current_time()
{
struct tm *tm;
GTimeVal time_val;
xmlChar *ret = g_malloc(21);
g_get_current_time(&time_val);
tm = localtime(&(time_val.tv_sec));
strftime(ret, 21, "%FT%TZ", tm);
return (ret);
}
/**
* lasso_query_to_dict:
* @query: the query part of the 'url-encoded + signed' message
*
* Split query (& char) and build a dictonary with key=value
* value is a GPtrArray.
* The caller is responsible for freeing returned object by calling
* g_datalist_clear() function.
*
* Return value: a dictonary
**/
GData *
lasso_query_to_dict(const xmlChar *query)
{
GData *gd;
gchar **sa1, **sa2, **sa3;
GPtrArray *gpa;
guint i, j;
g_datalist_init(&gd);
sa1 = g_strsplit(query, "&", 0);
i = 0;
while (sa1[i++] != NULL) {
/* split of key=value to get (key, value) sub-strings */
sa2 = g_strsplit(lasso_str_unescape(sa1[i-1]), "=", 0);
//printf("%s => ", sa2[0]);
/* split of value to get mutli values sub-strings separated by SPACE char */
sa3 = g_strsplit(lasso_str_unescape(sa2[1]), " ", 0);
gpa = g_ptr_array_new();
j = 0;
while (sa3[j++] != NULL) {
g_ptr_array_add(gpa, sa3[j-1]);
//printf("%s, ", sa3[j-1]);
}
// add key => values in dict
g_datalist_set_data(&gd, sa2[0], gpa);
//printf("\n");
//g_strfreev(sa3);
//g_strfreev(sa2);
}
g_strfreev(sa1);
return (gd);
}
xmlChar *
lasso_str_escape(xmlChar *str)
{
/* value returned must be xmlFree() */
return (xmlURIEscapeStr((const xmlChar *)str, NULL));
}
xmlDocPtr
lasso_str_sign(xmlChar *str,
xmlSecTransformId signMethodId,
const char* key_file)
{
xmlDocPtr doc = xmlNewDoc("1.0");
xmlNodePtr cur;
xmlNodePtr envelope = xmlNewNode(NULL, "Envelope");
xmlNodePtr cdata, data = xmlNewNode(NULL, "Data");
xmlNodePtr signNode = NULL;
xmlNodePtr refNode = NULL;
xmlNodePtr keyInfoNode = NULL;
xmlSecDSigCtxPtr dsigCtx = NULL;
/* create doc */
xmlNewNs(envelope, "urn:envelope", NULL);
cdata = xmlNewCDataBlock(doc, str, strlen(str));
xmlAddChild(envelope, data);
xmlAddChild(data, cdata);
xmlAddChild((xmlNodePtr)doc, envelope);
/* create signature template for enveloped signature */
signNode = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
signMethodId, NULL);
if(signNode == NULL) {
fprintf(stderr, "Error: failed to create signature template\n");
goto done;
}
/* add <dsig:Signature/> node to the doc */
xmlAddChild(xmlDocGetRootElement(doc), signNode);
/* add reference */
refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id,
NULL, NULL, NULL);
if(refNode == NULL) {
fprintf(stderr, "Error: failed to add reference to signature template\n");
goto done;
}
/* add enveloped transform */
if(xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId) == NULL) {
fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
goto done;
}
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to put key name in the
signed document */
keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
if(keyInfoNode == NULL) {
fprintf(stderr, "Error: failed to add key info\n");
goto done;
}
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode, NULL) == NULL) {
fprintf(stderr, "Error: failed to add key name\n");
goto done;
}
/* create signature context */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
goto done;
}
/* load private key, assuming that there is not password */
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem,
NULL, NULL, NULL);
if(dsigCtx->signKey == NULL) {
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
goto done;
}
/* sign the template */
if(xmlSecDSigCtxSign(dsigCtx, signNode) < 0) {
fprintf(stderr,"Error: signature failed\n");
goto done;
}
//xmlDocDump(stdout, doc);
return (doc);
done:
/* cleanup */
if(dsigCtx != NULL) {
xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
xmlFreeDoc(doc);
}
return(NULL);
}
xmlChar *
lasso_str_unescape(xmlChar *str)
{
xmlChar *ret;
ret = g_malloc(strlen(str) * 2);
xmlURIUnescapeString((const char *)str, 0, ret);
return (ret);
}
int
lasso_str_verify(xmlChar *str,
const xmlChar *sender_public_key_file,
const xmlChar *recipient_private_key_file)
{
xmlDocPtr doc = NULL;
xmlNodePtr node = NULL, sigValNode = NULL;
xmlSecDSigCtxPtr dsigCtx = NULL;
gchar **str_split;
/* split query, signatureValue */
str_split = g_strsplit((const gchar *)str, "&Signature=", 0);
/* re-create doc to verify (signed + enrypted) */
doc = lasso_str_sign(str_split[0],
xmlSecTransformRsaSha1Id,
recipient_private_key_file);
sigValNode = xmlSecFindNode(xmlDocGetRootElement(doc),
xmlSecNodeSignatureValue,
xmlSecDSigNs);
/* SignatureValue content */
xmlNodeSetContent(sigValNode, lasso_str_unescape(str_split[1]));
g_strfreev(str_split);
//xmlDocDump(stdout, doc);
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
/* create signature context */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
goto done;
}
/* load public key */
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(sender_public_key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
if(dsigCtx->signKey == NULL) {
fprintf(stderr,"Error: failed to load public pem key from \"%s\"\n", sender_public_key_file);
goto done;
}
/* Verify signature */
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
fprintf(stderr,"Error: signature verify\n");
goto done;
}
/* print verification result to stdout and return */
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
fprintf(stdout, "Signature is OK\n");
return (1);
} else {
fprintf(stdout, "Signature is INVALID\n");
return (0);
}
done:
/* cleanup */
if(dsigCtx != NULL) {
xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
xmlFreeDoc(doc);
}
return (-1);
}

53
lasso/xml/tools.h Normal file
View File

@ -0,0 +1,53 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <glib-object.h>
#include <libxml/xpath.h>
#include <xmlsec/xmldsig.h>
#include <xmlsec/templates.h>
#include <xmlsec/crypto.h>
xmlChar * lasso_build_unique_id(guint8 size);
xmlChar * lasso_doc_get_node_content(xmlDocPtr doc, const xmlChar *name);
xmlChar * lasso_g_ptr_array_index(GPtrArray *a, guint i);
xmlChar * lasso_get_current_time(void);
GData * lasso_query_to_dict(const xmlChar *query);
xmlChar * lasso_str_escape(xmlChar *str);
xmlDocPtr lasso_str_sign(xmlChar *str,
xmlSecTransformId signMethodId,
const char* key_file);
xmlChar * lasso_str_unescape(xmlChar *str);
int lasso_str_verify(xmlChar *str,
const xmlChar *sender_public_key_file,
const xmlChar *recipient_private_key_file);

653
lasso/xml/xml.c Normal file
View File

@ -0,0 +1,653 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lasso/xml/xml.h>
#include "../export.h"
struct _LassoNodePrivate
{
gboolean dispose_has_run;
gchar *type_name;
xmlNodePtr node;
};
/*****************************************************************************/
/* virtual public methods */
/*****************************************************************************/
GString *
lasso_node_build_query(LassoNode *node)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->build_query(node));
}
xmlChar *
lasso_node_get_name(LassoNode *node)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->get_name(node));
}
void
lasso_node_dump(LassoNode *node, const xmlChar *encoding, int format) {
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->dump(node, encoding, format);
}
void
lasso_node_rename_prop(LassoNode *node,
const xmlChar *old_name,
const xmlChar *new_name)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->rename_prop(node, old_name, new_name);
}
GData *
lasso_node_serialize(LassoNode *node, GData *gd)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->serialize(node, gd));
}
gchar *
lasso_node_url_encode(LassoNode *node,
guint sign_method,
const gchar *key_file)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->url_encode(node, sign_method, key_file));
}
/*****************************************************************************/
/* virtual private methods */
/*****************************************************************************/
static void
lasso_node_add_child(LassoNode *node,
LassoNode *child,
gboolean unbounded)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->add_child(node, child, unbounded);
}
static LassoAttr *
lasso_node_get_attr(LassoNode *node, const xmlChar *name)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->get_attr(node, name));
}
static GPtrArray *
lasso_node_get_attrs(LassoNode *node)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->get_attrs(node));
}
static LassoNode *
lasso_node_get_child(LassoNode *node, const xmlChar *name) {
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->get_child(node, name));
}
static GPtrArray *
lasso_node_get_children(LassoNode *node)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->get_children(node));
}
static xmlNodePtr
lasso_node_get_xmlNode(LassoNode *node)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->get_xmlNode(node));
}
/**
* lasso_node_new_child:
* @node: the pointer to node
* @name: the name of the child
* @content: the content
* @unbounded: if TRUE, several children with the same name can be added else a
* child is unique.
*
* Add a new child in node.
* This is an internal function and should not be called by application directly.
**/
static void
lasso_node_new_child(LassoNode *node,
const xmlChar *name,
const xmlChar *content,
gboolean unbounded)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
return (class->new_child(node, name, content, unbounded));
}
static void
lasso_node_new_ns(LassoNode *node,
const xmlChar *href,
const xmlChar *prefix)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->new_ns(node, href, prefix);
}
static void
lasso_node_set_name(LassoNode *node,
const xmlChar *name)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_name(node, name);
}
static void
lasso_node_set_node(LassoNode *node,
xmlNodePtr libxml_node)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_node(node, libxml_node);
}
static void
lasso_node_set_prop(LassoNode *node,
const xmlChar *name,
const xmlChar *value)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
class->set_prop(node, name, value);
}
/*****************************************************************************/
/* implementation methods */
/*****************************************************************************/
static void
gdata_build_query_foreach_func(GQuark key_id,
gpointer data,
gpointer user_data) {
guint i;
GString *str;
GPtrArray *array;
array = g_ptr_array_new();
str = g_string_new("");
for (i=0; i<((GPtrArray *)data)->len; i++) {
str = g_string_append(str, g_ptr_array_index((GPtrArray *)data, i));
if (i<((GPtrArray *)data)->len - 1) {
str = g_string_append(str, " ");
}
/* free each val get with xmlGetProp() in lasso_node_impl_serialize() */
xmlFree(g_ptr_array_index((GPtrArray *)data, i));
}
g_ptr_array_add(array, g_quark_to_string(key_id));
g_ptr_array_add(array, str->str);
g_string_free(str, FALSE);
g_ptr_array_add((GPtrArray *)user_data, array);
}
GString *
lasso_node_impl_build_query(LassoNode *node)
{
guint i;
GData *gd;
GPtrArray *a, *aa;
GString *query;
gd = lasso_node_serialize(node, NULL);
a = g_ptr_array_new();
/* transform dict into array
each key => [val1, val2, ...] of dict become [key, "val1 val2 ..."] */
g_datalist_foreach(&gd, gdata_build_query_foreach_func, a);
query = g_string_new("");
for (i=0; i<a->len; i++) {
aa = g_ptr_array_index(a, i);
query = g_string_append(query, g_ptr_array_index(aa, 0));
query = g_string_append(query, "=");
query = g_string_append(query, lasso_str_escape(g_ptr_array_index(aa, 1)));
if (i<a->len - 1) {
query = g_string_append(query, "&");
}
// free allocated memory
g_ptr_array_free(aa, TRUE);
}
// free allocated memory
g_ptr_array_free(a, TRUE);
g_datalist_clear(&gd);
return (query);
}
static xmlChar *
lasso_node_impl_get_name(LassoNode *node)
{
return (node->private->node->name);
}
static void
lasso_node_impl_dump(LassoNode *node,
const xmlChar *encoding,
int format)
{
xmlChar *ret;
int len;
xmlOutputBufferPtr buf;
xmlCharEncodingHandlerPtr handler = NULL;
if (encoding != NULL) {
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) {
return;
}
}
buf = xmlAllocOutputBuffer(handler);
if (buf == NULL) {
return;
}
xmlNodeDumpOutput(buf, node->private->node->doc, node->private->node,
0, format, encoding);
xmlOutputBufferFlush(buf);
if (buf->conv != NULL) {
len = buf->conv->use;
ret = buf->conv->content;
buf->conv->content = NULL;
}
else {
len = buf->buffer->use;
ret = buf->buffer->content;
buf->buffer->content = NULL;
}
(void) xmlOutputBufferClose(buf);
printf("%s\n\n", ret);
}
static GData *
lasso_node_impl_serialize(LassoNode *node, GData *gd)
{
GPtrArray *attrs, *children;
GPtrArray *values;
xmlChar *name, *val;
int i;
if (gd == NULL) {
g_datalist_init(&gd);
}
attrs = lasso_node_get_attrs(node);
for(i=0; i<attrs->len; i++) {
values = g_ptr_array_new();
name = ((LassoAttr *)g_ptr_array_index(attrs, i))->name;
/* val must be xmlFree() */
val = xmlGetProp(node->private->node, name);
g_ptr_array_add(values, val);
g_datalist_set_data(&gd, name, values);
}
g_ptr_array_free(attrs, TRUE);
children = lasso_node_get_children(node);
if (children != NULL) {
for(i=0; i<children->len; i++) {
xmlNodePtr xml_node = ((LassoNode *)g_ptr_array_index(children, i))->private->node;
switch (xml_node->type) {
case XML_ELEMENT_NODE:
gd = lasso_node_serialize(g_ptr_array_index(children, i), gd);
break;
case XML_TEXT_NODE:
name = lasso_node_get_name(node);
values = (GPtrArray *)g_datalist_get_data(&gd, name);
if (values == NULL) {
values = g_ptr_array_new();
}
/* val must be xmlFree() */
val = xmlNodeGetContent(node->private->node);
g_ptr_array_add(values, val);
g_datalist_set_data(&gd, name, values);
break;
}
}
}
g_ptr_array_free(children, TRUE);
return (gd);
}
gchar *
lasso_node_impl_url_encode(LassoNode *node,
guint sign_method,
const gchar *key_file)
{
GString *msg;
xmlDocPtr doc;
xmlChar *str1, *str2;
gchar *ret;
msg = lasso_node_build_query(node);
if (sign_method > 0 && key_file != NULL) {
switch (sign_method) {
case LassoUrlEncodeRsaSha1:
msg = g_string_append(msg, "&SigAlg=");
msg = g_string_append(msg, lasso_str_escape("http://www.w3.org/2000/09/xmldsig#rsa-sha1"));
doc = lasso_str_sign(msg->str, xmlSecTransformRsaSha1Id, key_file);
msg = g_string_append(msg, "&Signature=");
str1 = lasso_doc_get_node_content(doc, xmlSecNodeSignatureValue);
str2 = lasso_str_escape(str1);
xmlFree(str1);
msg = g_string_append(msg, str2);
xmlFree(str2);
break;
case LassoUrlEncodeDsaSha1:
msg = g_string_append(msg, "&SigAlg=");
msg = g_string_append(msg, lasso_str_escape("http://www.w3.org/2000/09/xmldsig#dsa-sha1"));
doc = lasso_str_sign(msg->str, xmlSecTransformDsaSha1Id, key_file);
msg = g_string_append(msg, "&Signature=");
str1 = lasso_doc_get_node_content(doc, xmlSecNodeSignatureValue);
str2 = lasso_str_escape(str1);
xmlFree(str1);
msg = g_string_append(msg, str2);
xmlFree(str2);
break;
}
}
ret = g_strdup(msg->str);
g_string_free(msg, TRUE);
return (ret);
}
/*****************************************************************************/
static void
lasso_node_impl_add_child(LassoNode *node,
LassoNode *child,
gboolean unbounded)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
LassoNode *old_child;
// if child is not unbounded, we search it
if (!unbounded) {
old_child = class->get_child(node, child->private->node->name);
}
if (!unbounded && old_child != NULL) {
// child replace old child
xmlReplaceNode(old_child->private->node, child->private->node);
}
else {
// else child is added
xmlAddChild(node->private->node, child->private->node);
}
}
static LassoAttr *
lasso_node_impl_get_attr(LassoNode *node, xmlChar *name)
{
LassoAttr *prop;
prop = node->private->node->properties;
while (prop != NULL) {
if (xmlStrEqual(prop->name, name)) {
return (prop);
}
prop = prop->next;
}
return (NULL);
}
static GPtrArray *
lasso_node_impl_get_attrs(LassoNode *node)
{
GPtrArray *attributs;
LassoAttr *prop;
attributs = g_ptr_array_new();
prop = node->private->node->properties;
while (prop != NULL) {
g_ptr_array_add(attributs, prop);
prop = prop->next;
}
return (attributs);
}
static LassoNode *
lasso_node_impl_get_child(LassoNode *node,
const xmlChar *name)
{
xmlNodePtr cur;
cur = node->private->node->children;
while (cur != NULL) {
if(cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, name)) {
return (lasso_node_new(cur));
}
}
cur = cur->next;
}
return (NULL);
}
static GPtrArray *
lasso_node_impl_get_children(LassoNode *node)
{
GPtrArray *children = NULL;
xmlNodePtr cur;
cur = node->private->node->children;
if (cur != NULL)
children = g_ptr_array_new();
while (cur != NULL) {
g_ptr_array_add(children, lasso_node_new(cur));
cur = cur->next;
}
return (children);
}
static xmlNodePtr
lasso_node_impl_get_xmlNode(LassoNode *node)
{
return (node->private->node);
}
static void
lasso_node_impl_new_child(LassoNode *node,
const xmlChar *name,
const xmlChar *content,
gboolean unbounded)
{
LassoNodeClass *class = LASSO_NODE_GET_CLASS(node);
LassoNode *old_child;
if (!unbounded) {
old_child = class->get_child(node, name);
}
if (!unbounded && old_child != NULL)
xmlNodeSetContent(old_child->private->node, content);
else {
xmlNewChild(node->private->node, NULL, name, content);
}
}
static void
lasso_node_impl_new_ns(LassoNode *node,
const xmlChar *href,
const xmlChar *prefix)
{
xmlSetNs(node->private->node,
xmlNewNs(node->private->node, href, prefix));
}
static void
lasso_node_impl_rename_prop(LassoNode *node,
const xmlChar *old_name,
const xmlChar *new_name)
{
xmlChar *value;
LassoAttr *prop;
value = xmlGetProp(node->private->node, old_name);
if (value != NULL) {
xmlRemoveProp(lasso_node_get_attr(node, old_name));
lasso_node_set_prop(node, new_name, value);
}
}
static void
lasso_node_impl_set_name(LassoNode *node,
const xmlChar *name)
{
xmlNodeSetName(node->private->node, name);
node->private->type_name = xmlStrdup(name);
}
static void
lasso_node_impl_set_node(LassoNode *node,
xmlNodePtr libxml_node)
{
xmlFreeNode(node->private->node);
node->private->node = libxml_node;
}
static void
lasso_node_impl_set_prop(LassoNode *node,
const xmlChar *name,
const xmlChar *value)
{
xmlSetProp(node->private->node, name, value);
}
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
lasso_node_instance_init(LassoNode *instance)
{
LassoNode *node = LASSO_NODE(instance);
node->private = g_new (LassoNodePrivate, 1);
node->private->dispose_has_run = FALSE;
node->private->type_name = NULL;
node->private->node = xmlNewNode(NULL, "no-name-set");
}
/* overrided parent class methods */
static void
lasso_node_dispose(LassoNode *node)
{
if (node->private->dispose_has_run) {
return;
}
node->private->dispose_has_run = TRUE;
/* unref reference counted objects */
/* we don't have any here */
g_print("%s 0x%x disposed ...\n", node->private->type_name, node);
}
static void
lasso_node_finalize(LassoNode *node)
{
g_print("%s 0x%x finalized ...\n", node->private->type_name, node);
g_free (node->private->type_name);
xmlFreeNode(node->private->node);
}
static void
lasso_node_class_init(LassoNodeClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(class);
/* virtual public methods */
class->build_query = lasso_node_impl_build_query;
class->get_name = lasso_node_impl_get_name;
class->dump = lasso_node_impl_dump;
class->serialize = lasso_node_impl_serialize;
class->url_encode = lasso_node_impl_url_encode;
/* virtual private methods */
class->add_child = lasso_node_impl_add_child;
class->get_attr = lasso_node_impl_get_attr;
class->get_attrs = lasso_node_impl_get_attrs;
class->get_child = lasso_node_impl_get_child;
class->get_children = lasso_node_impl_get_children;
class->get_xmlNode = lasso_node_impl_get_xmlNode;
class->new_child = lasso_node_impl_new_child;
class->new_ns = lasso_node_impl_new_ns;
class->rename_prop = lasso_node_impl_rename_prop;
class->set_name = lasso_node_impl_set_name;
class->set_node = lasso_node_impl_set_node;
class->set_prop = lasso_node_impl_set_prop;
/* override parent class methods */
gobject_class->dispose = (void *)lasso_node_dispose;
gobject_class->finalize = (void *)lasso_node_finalize;
}
GType lasso_node_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoNodeClass),
NULL,
NULL,
(GClassInitFunc) lasso_node_class_init,
NULL,
NULL,
sizeof(LassoNode),
0,
(GInstanceInitFunc) lasso_node_instance_init,
};
this_type = g_type_register_static(G_TYPE_OBJECT , "LassoNode",
&this_info, 0);
}
return this_type;
}
LassoNode* lasso_node_new(xmlNodePtr node) {
LassoNode *lasso_node;
lasso_node = LASSO_NODE(g_object_new(LASSO_TYPE_NODE, NULL));
if (node != NULL) {
xmlFreeNode(lasso_node->private->node);
lasso_node->private->node = node;
}
return (lasso_node);
}

134
lasso/xml/xml.h Normal file
View File

@ -0,0 +1,134 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Author: Valery Febvre <vfebvre@easter-eggs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_XML_H__
#define __LASSO_XML_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/strings.h>
#include <lasso/xml/tools.h>
#define LASSO_TYPE_NODE (lasso_node_get_type())
#define LASSO_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_NODE, LassoNode))
#define LASSO_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_NODE, LassoNodeClass))
#define LASSO_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_NODE))
#define LASSO_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_NODE))
#define LASSO_NODE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_NODE, LassoNodeClass))
typedef struct _xmlAttr LassoAttr;
typedef struct _LassoNode LassoNode;
typedef struct _LassoNodeClass LassoNodeClass;
typedef struct _LassoNodePrivate LassoNodePrivate;
/**
* _LassoNode:
* @parent: the parent object
* @private: private pointer structure
**/
struct _LassoNode {
GObject parent;
/*< private >*/
LassoNodePrivate *private;
};
struct _LassoNodeClass {
GObjectClass parent_class;
/*< vtable >*/
/*< public >*/
GString * (* build_query) (LassoNode *node);
xmlChar * (* get_name) (LassoNode *);
void (* dump) (LassoNode *,
const xmlChar *,
int);
GData * (* serialize) (LassoNode *,
GData *);
gchar * (* url_encode) (LassoNode *node,
guint sign_method,
const gchar *key_file);
/*< private >*/
void (* add_child) (LassoNode *,
LassoNode *,
gboolean);
LassoAttr* (* get_attr) (LassoNode *,
const xmlChar *);
GPtrArray* (* get_attrs) (LassoNode *);
LassoNode* (* get_child) (LassoNode *,
const xmlChar *);
GPtrArray* (* get_children) (LassoNode *);
xmlNodePtr (* get_xmlNode) (LassoNode *);
void (* new_child) (LassoNode *,
const xmlChar *,
const xmlChar *,
gboolean);
void (* new_ns) (LassoNode *,
const xmlChar *,
const xmlChar *);
void (* rename_prop) (LassoNode *node,
const xmlChar *old_name,
const xmlChar *new_name);
void (* set_name) (LassoNode *,
const xmlChar *);
void (* set_node) (LassoNode *,
xmlNodePtr);
void (* set_prop) (LassoNode *,
const xmlChar *,
const xmlChar *);
};
typedef enum {
LassoUrlEncodeRsaSha1 = 1,
LassoUrlEncodeDsaSha1
} LassoUrlEncodeSignMethod;
LASSO_EXPORT GType lasso_node_get_type(void);
LASSO_EXPORT LassoNode* lasso_node_new(xmlNodePtr node);
LASSO_EXPORT GString* lasso_node_build_query (LassoNode *node);
LASSO_EXPORT xmlChar* lasso_node_get_name (LassoNode *node);
LASSO_EXPORT void lasso_node_dump (LassoNode *,
const xmlChar *,
int);
LASSO_EXPORT void lasso_node_rename_prop (LassoNode *node,
const xmlChar *old_name,
const xmlChar *new_name);
LASSO_EXPORT GData* lasso_node_serialize (LassoNode *node,
GData *gd);
LASSO_EXPORT gchar* lasso_node_url_encode (LassoNode *node,
guint sign_method,
const gchar *key_file);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_XML_H__ */