~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): Stephan Hermann
  • Date: 2005-09-16 02:16:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050916021649-lr5tuka6pfmmks44
Tags: 0.6.2-3ubuntu1
* debian/control: removed hardcoded php dependency, added php:Depends
  substvar
* debian/rules: added phpapiver, added substitution of php:Depends

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 $
 
1
/* $Id: saml_advice.c,v 1.18 2005/01/22 15:57:55 eraviart Exp $
2
2
 *
3
3
 * Lasso - A free implementation of the Samlerty Alliance specifications.
4
4
 *
5
 
 * Copyright (C) 2004 Entr'ouvert
 
5
 * Copyright (C) 2004, 2005 Entr'ouvert
6
6
 * http://lasso.entrouvert.org
7
7
 * 
8
 
 * Authors: Nicolas Clapies <nclapies@entrouvert.com>
9
 
 *          Valery Febvre <vfebvre@easter-eggs.com>
 
8
 * Authors: See AUTHORS file in top-level directory.
10
9
 *
11
10
 * This program is free software; you can redistribute it and/or modify
12
11
 * it under the terms of the GNU General Public License as published by
24
23
 */
25
24
 
26
25
#include <lasso/xml/saml_advice.h>
 
26
#include <lasso/xml/saml_assertion.h>
27
27
 
28
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
 
}
 
29
 * 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
/* private methods                                                           */
 
48
/*****************************************************************************/
 
49
 
 
50
static struct XmlSnippet schema_snippets[] = {
 
51
        { "AssertionIDReference", SNIPPET_LIST_CONTENT,
 
52
                G_STRUCT_OFFSET(LassoSamlAdvice, AssertionIDReference) },
 
53
        { "Assertion", SNIPPET_NODE, G_STRUCT_OFFSET(LassoSamlAdvice, Assertion) },
 
54
        { NULL, 0, 0}
 
55
};
76
56
 
77
57
/*****************************************************************************/
78
58
/* instance and class init functions                                         */
79
59
/*****************************************************************************/
80
60
 
81
61
static void
82
 
lasso_saml_advice_instance_init(LassoSamlAdvice *node)
 
62
instance_init(LassoSamlAdvice *node)
83
63
{
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");
 
64
        node->AssertionIDReference = NULL;
 
65
        node->Assertion = NULL;
89
66
}
90
67
 
91
68
static void
92
 
lasso_saml_advice_class_init(LassoSamlAdviceClass *klass) {
 
69
class_init(LassoSamlAdviceClass *klass)
 
70
{
 
71
        LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
 
72
 
 
73
        nclass->node_data = g_new0(LassoNodeClassData, 1);
 
74
        lasso_node_class_set_nodename(nclass, "Advice");
 
75
        lasso_node_class_set_ns(nclass, LASSO_SAML_ASSERTION_HREF, LASSO_SAML_ASSERTION_PREFIX);
 
76
        lasso_node_class_add_snippets(nclass, schema_snippets);
93
77
}
94
78
 
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;
 
79
GType
 
80
lasso_saml_advice_get_type()
 
81
{
 
82
        static GType this_type = 0;
 
83
 
 
84
        if (!this_type) {
 
85
                static const GTypeInfo this_info = {
 
86
                        sizeof (LassoSamlAdviceClass),
 
87
                        NULL,
 
88
                        NULL,
 
89
                        (GClassInitFunc) class_init,
 
90
                        NULL,
 
91
                        NULL,
 
92
                        sizeof(LassoSamlAdvice),
 
93
                        0,
 
94
                        (GInstanceInitFunc) instance_init,
 
95
                };
 
96
 
 
97
                this_type = g_type_register_static(LASSO_TYPE_NODE,
 
98
                                "LassoSamlAdvice", &this_info, 0);
 
99
        }
 
100
        return this_type;
116
101
}
117
102
 
118
103
/**
119
104
 * lasso_saml_advice_new:
120
105
 * 
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
 
106
 * Creates a new #LassoSamlAdvice object.
 
107
 *
 
108
 * Return value: a newly created #LassoSamlAdvice
140
109
 **/
141
 
LassoNode* lasso_saml_advice_new()
 
110
LassoNode*
 
111
lasso_saml_advice_new()
142
112
{
143
 
  return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_ADVICE, NULL));
 
113
        return g_object_new(LASSO_TYPE_SAML_ADVICE, NULL);
144
114
}