~ubuntu-branches/ubuntu/edgy/lasso/edgy

« back to all changes in this revision

Viewing changes to lasso/xml/saml_advice.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2004-09-13 09:26:34 UTC
  • Revision ID: james.westby@ubuntu.com-20040913092634-01vdfl8j9cp94exa
Tags: upstream-0.4.1
ImportĀ upstreamĀ versionĀ 0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: saml_advice.c,v 1.5 2004/08/13 15:16:13 fpeters Exp $
 
2
 *
 
3
 * Lasso - A free implementation of the Samlerty Alliance specifications.
 
4
 *
 
5
 * Copyright (C) 2004 Entr'ouvert
 
6
 * http://lasso.entrouvert.org
 
7
 * 
 
8
 * Authors: Nicolas Clapies <nclapies@entrouvert.com>
 
9
 *          Valery Febvre <vfebvre@easter-eggs.com>
 
10
 *
 
11
 * This program is free software; you can redistribute it and/or modify
 
12
 * it under the terms of the GNU General Public License as published by
 
13
 * the Free Software Foundation; either version 2 of the License, or
 
14
 * (at your option) any later version.
 
15
 * 
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 * 
 
21
 * You should have received a copy of the GNU General Public License
 
22
 * along with this program; if not, write to the Free Software
 
23
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
24
 */
 
25
 
 
26
#include <lasso/xml/saml_advice.h>
 
27
 
 
28
/*
 
29
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
 
30
 
 
31
<element name="Advice" type="saml:AdviceType"/>
 
32
<complexType name="AdviceType">
 
33
  <choice minOccurs="0" maxOccurs="unbounded">
 
34
    <element ref="saml:AssertionIDReference"/>
 
35
    <element ref="saml:Assertion"/>
 
36
    <any namespace="##other" processContents="lax"/>
 
37
  </choice>
 
38
</complexType>
 
39
 
 
40
<element name="AssertionIDReference" type="saml:IDReferenceType"/>
 
41
<simpleType name="IDReferenceType">
 
42
  <restriction base="string"/>
 
43
</simpleType>
 
44
*/
 
45
 
 
46
/*****************************************************************************/
 
47
/* public methods                                                            */
 
48
/*****************************************************************************/
 
49
 
 
50
void
 
51
lasso_saml_advice_add_assertionIDReference(LassoSamlAdvice *node,
 
52
                                           const xmlChar *assertionIDReference)
 
53
{
 
54
  LassoNodeClass *class;
 
55
  g_assert(LASSO_IS_SAML_ADVICE(node));
 
56
  g_assert(assertionIDReference != NULL);
 
57
 
 
58
  class = LASSO_NODE_GET_CLASS(node);
 
59
  class->new_child(LASSO_NODE (node),
 
60
                   "AssertionIDReference",
 
61
                   assertionIDReference,
 
62
                   TRUE);
 
63
}
 
64
 
 
65
void
 
66
lasso_saml_advice_add_assertion(LassoSamlAdvice *node,
 
67
                                gpointer *assertion)
 
68
{
 
69
  LassoNodeClass *class;
 
70
  g_assert(LASSO_IS_SAML_ADVICE(node));
 
71
  /* g_assert(LASSO_IS_SAML_ASSERTION(assertion)); */
 
72
 
 
73
  class = LASSO_NODE_GET_CLASS(node);
 
74
  class->add_child(LASSO_NODE (node), LASSO_NODE (assertion), TRUE);
 
75
}
 
76
 
 
77
/*****************************************************************************/
 
78
/* instance and class init functions                                         */
 
79
/*****************************************************************************/
 
80
 
 
81
static void
 
82
lasso_saml_advice_instance_init(LassoSamlAdvice *node)
 
83
{
 
84
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
 
85
 
 
86
  class->set_ns(LASSO_NODE(node), lassoSamlAssertionHRef,
 
87
                lassoSamlAssertionPrefix);
 
88
  class->set_name(LASSO_NODE(node), "Advice");
 
89
}
 
90
 
 
91
static void
 
92
lasso_saml_advice_class_init(LassoSamlAdviceClass *klass) {
 
93
}
 
94
 
 
95
GType lasso_saml_advice_get_type() {
 
96
  static GType this_type = 0;
 
97
 
 
98
  if (!this_type) {
 
99
    static const GTypeInfo this_info = {
 
100
      sizeof (LassoSamlAdviceClass),
 
101
      NULL,
 
102
      NULL,
 
103
      (GClassInitFunc) lasso_saml_advice_class_init,
 
104
      NULL,
 
105
      NULL,
 
106
      sizeof(LassoSamlAdvice),
 
107
      0,
 
108
      (GInstanceInitFunc) lasso_saml_advice_instance_init,
 
109
    };
 
110
    
 
111
    this_type = g_type_register_static(LASSO_TYPE_NODE,
 
112
                                       "LassoSamlAdvice",
 
113
                                       &this_info, 0);
 
114
  }
 
115
  return this_type;
 
116
}
 
117
 
 
118
/**
 
119
 * lasso_saml_advice_new:
 
120
 * 
 
121
 * Creates a new <saml:Advice> node object.
 
122
 *
 
123
 * The <Advice> element contains any additional information that the issuer
 
124
 * wishes to provide. This information MAY be ignored by applications without
 
125
 * affecting either the semantics or the validity of the assertion.
 
126
 * The <Advice> element contains a mixture of zero or more <Assertion>
 
127
 * elements, <AssertionIDReference> elements and elements in other namespaces,
 
128
 * with lax schema validation in effect for these other elements.
 
129
 * Following are some potential uses of the <Advice> element:
 
130
 *
 
131
 * - Include evidence supporting the assertion claims to be cited, either
 
132
 * directly (through incorporating the claims) or indirectly (by reference to
 
133
 * the supporting assertions).
 
134
 *
 
135
 * - State a proof of the assertion claims.
 
136
 *
 
137
 * - Specify the timing and distribution points for updates to the assertion.
 
138
 * 
 
139
 * Return value: the new @LassoSamlAdvice
 
140
 **/
 
141
LassoNode* lasso_saml_advice_new()
 
142
{
 
143
  return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_ADVICE, NULL));
 
144
}