~ubuntu-branches/ubuntu/utopic/lasso/utopic-proposed

« back to all changes in this revision

Viewing changes to lasso/xml/samlp_response.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: samlp_response.c,v 1.7 2004/08/13 15:16:13 fpeters Exp $ 
 
2
 *
 
3
 * Lasso - A free implementation of the Liberty 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/samlp_response.h>
 
27
 
 
28
/*
 
29
Schema fragment (oasis-sstc-saml-schema-protocol-1.0.xsd):
 
30
 
 
31
<element name="Response" type="samlp:ResponseType"/>
 
32
<complexType name="ResponseType">
 
33
  <complexContent>
 
34
    <extension base="samlp:ResponseAbstractType">
 
35
      <sequence>
 
36
        <element ref="samlp:Status"/>
 
37
        <element ref="saml:Assertion" minOccurs="0" maxOccurs="unbounded"/>
 
38
      </sequence>
 
39
    </extension>
 
40
  </complexContent>
 
41
</complexType>
 
42
 
 
43
*/
 
44
 
 
45
/*****************************************************************************/
 
46
/* public methods                                                            */
 
47
/*****************************************************************************/
 
48
 
 
49
void
 
50
lasso_samlp_response_add_assertion(LassoSamlpResponse *node,
 
51
                                   gpointer assertion)
 
52
{
 
53
  LassoNodeClass *class;
 
54
  g_assert(LASSO_IS_SAMLP_RESPONSE(node));
 
55
  /* g_assert(LASSO_IS_SAML_ASSERTION(assertion)); */
 
56
 
 
57
  class = LASSO_NODE_GET_CLASS(node);
 
58
  class->add_child(LASSO_NODE (node), LASSO_NODE(assertion), TRUE);
 
59
}
 
60
 
 
61
void
 
62
lasso_samlp_response_set_status(LassoSamlpResponse *node,
 
63
                                LassoSamlpStatus *status)
 
64
{
 
65
  LassoNodeClass *class;
 
66
  g_assert(LASSO_IS_SAMLP_RESPONSE(node));
 
67
  g_assert(LASSO_IS_SAMLP_STATUS(status));
 
68
 
 
69
  class = LASSO_NODE_GET_CLASS(node);
 
70
  class->add_child(LASSO_NODE (node), LASSO_NODE(status), FALSE);
 
71
}
 
72
 
 
73
/*****************************************************************************/
 
74
/* instance and class init functions                                         */
 
75
/*****************************************************************************/
 
76
 
 
77
static void
 
78
lasso_samlp_response_instance_init(LassoSamlpResponse *node)
 
79
{
 
80
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
 
81
 
 
82
  /* namespace herited from samlp:ResponseAbstract */
 
83
  class->set_name(LASSO_NODE(node), "Response");
 
84
}
 
85
 
 
86
static void
 
87
lasso_samlp_response_class_init(LassoSamlpResponseClass *klass) {
 
88
}
 
89
 
 
90
GType lasso_samlp_response_get_type() {
 
91
  static GType response_type = 0;
 
92
 
 
93
  if (!response_type) {
 
94
    static const GTypeInfo response_info = {
 
95
      sizeof (LassoSamlpResponseClass),
 
96
      NULL,
 
97
      NULL,
 
98
      (GClassInitFunc) lasso_samlp_response_class_init,
 
99
      NULL,
 
100
      NULL,
 
101
      sizeof(LassoSamlpResponse),
 
102
      0,
 
103
      (GInstanceInitFunc) lasso_samlp_response_instance_init,
 
104
    };
 
105
    
 
106
    response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT ,
 
107
                                           "LassoSamlpResponse",
 
108
                                           &response_info, 0);
 
109
  }
 
110
  return response_type;
 
111
}
 
112
 
 
113
LassoNode* lasso_samlp_response_new()
 
114
{
 
115
  return LASSO_NODE(g_object_new(LASSO_TYPE_SAMLP_RESPONSE, NULL));
 
116
}