diff options
author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-05 22:25:48 +0000 |
---|---|---|
committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-05 22:25:48 +0000 |
commit | caa62ddc7a5c39234a6f00132f0138a6b00f9cb0 (patch) | |
tree | d4e44a619964dbd13fec670c8bf42a069cb02889 /lasso/xml/saml_subject.c | |
parent | 80960808a8a1a59989f95ad2436d0a332473b816 (diff) | |
download | lasso-caa62ddc7a5c39234a6f00132f0138a6b00f9cb0.tar.gz lasso-caa62ddc7a5c39234a6f00132f0138a6b00f9cb0.tar.xz lasso-caa62ddc7a5c39234a6f00132f0138a6b00f9cb0.zip |
Files moved. Initialy located in lasso/schema/ directory
Diffstat (limited to 'lasso/xml/saml_subject.c')
-rw-r--r-- | lasso/xml/saml_subject.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/lasso/xml/saml_subject.c b/lasso/xml/saml_subject.c new file mode 100644 index 00000000..9e5d9679 --- /dev/null +++ b/lasso/xml/saml_subject.c @@ -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)); +} |