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

« back to all changes in this revision

Viewing changes to lasso/protocols/elements/assertion.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: assertion.c,v 1.6 2004/09/01 09:59:53 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: Valery Febvre   <vfebvre@easter-eggs.com>
 
9
 *          Nicolas Clapies <nclapies@entrouvert.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/protocols/elements/assertion.h>
 
27
 
 
28
/*****************************************************************************/
 
29
/* public methods                                                            */
 
30
/*****************************************************************************/
 
31
 
 
32
/*****************************************************************************/
 
33
/* instance and class init functions                                         */
 
34
/*****************************************************************************/
 
35
 
 
36
static void
 
37
lasso_assertion_instance_init(LassoAssertion *assertion)
 
38
{
 
39
}
 
40
 
 
41
static void
 
42
lasso_assertion_class_init(LassoAssertionClass *class)
 
43
{
 
44
}
 
45
 
 
46
GType lasso_assertion_get_type() {
 
47
  static GType this_type = 0;
 
48
 
 
49
  if (!this_type) {
 
50
    static const GTypeInfo this_info = {
 
51
      sizeof (LassoAssertionClass),
 
52
      NULL,
 
53
      NULL,
 
54
      (GClassInitFunc) lasso_assertion_class_init,
 
55
      NULL,
 
56
      NULL,
 
57
      sizeof(LassoAssertion),
 
58
      0,
 
59
      (GInstanceInitFunc) lasso_assertion_instance_init,
 
60
    };
 
61
    
 
62
    this_type = g_type_register_static(LASSO_TYPE_LIB_ASSERTION,
 
63
                                       "LassoAssertion",
 
64
                                       &this_info, 0);
 
65
  }
 
66
  return this_type;
 
67
}
 
68
 
 
69
LassoNode*
 
70
lasso_assertion_new(const xmlChar *issuer,
 
71
                    xmlChar       *requestID)
 
72
{
 
73
  LassoNode *assertion;
 
74
  xmlChar *id, *time;
 
75
 
 
76
  g_return_val_if_fail(issuer != NULL, NULL);
 
77
 
 
78
  assertion = LASSO_NODE(g_object_new(LASSO_TYPE_ASSERTION,
 
79
                                      "use_xsitype", TRUE,
 
80
                                      NULL));
 
81
 
 
82
  id = lasso_build_unique_id(32);
 
83
  lasso_saml_assertion_set_assertionID(LASSO_SAML_ASSERTION(assertion),
 
84
                                       (const xmlChar *)id);
 
85
  xmlFree(id);
 
86
  lasso_saml_assertion_set_majorVersion(LASSO_SAML_ASSERTION(assertion),
 
87
                                        lassoLibMajorVersion);
 
88
  lasso_saml_assertion_set_minorVersion(LASSO_SAML_ASSERTION(assertion),
 
89
                                        lassoLibMinorVersion);
 
90
  time = lasso_get_current_time();
 
91
  lasso_saml_assertion_set_issueInstant(LASSO_SAML_ASSERTION(assertion),
 
92
                                        (const xmlChar *)time);
 
93
  xmlFree(time);
 
94
 
 
95
  lasso_saml_assertion_set_issuer(LASSO_SAML_ASSERTION(assertion), issuer);
 
96
 
 
97
  /* InResponseTo */
 
98
  if (requestID != NULL) {
 
99
    lasso_lib_assertion_set_inResponseTo(LASSO_LIB_ASSERTION(assertion),
 
100
                                         requestID);
 
101
  }
 
102
 
 
103
  return assertion;
 
104
}