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

« back to all changes in this revision

Viewing changes to lasso/xml/saml_authentication_statement.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_authentication_statement.c,v 1.5 2004/08/13 15:16:13 fpeters Exp $
 
1
/* $Id: saml_authentication_statement.c,v 1.20 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
26
25
#include <lasso/xml/saml_authentication_statement.h>
27
26
 
28
27
/*
29
 
The schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
30
 
 
31
 
<element name="AuthenticationStatement" type="saml:AuthenticationStatementType"/>
32
 
<complexType name="AuthenticationStatementType">
33
 
  <complexContent>
34
 
    <extension base="saml:SubjectStatementAbstractType">
35
 
      <sequence>
36
 
        <element ref="saml:SubjectLocality" minOccurs="0"/>
37
 
        <element ref="saml:AuthorityBinding" minOccurs="0" maxOccurs="unbounded"/>
38
 
      </sequence>
39
 
      <attribute name="AuthenticationMethod" type="anyURI" use="required"/>
40
 
      <attribute name="AuthenticationInstant" type="dateTime" use="required"/>
41
 
    </extension>
42
 
  </complexContent>
43
 
</complexType>
44
 
*/
45
 
 
46
 
/*****************************************************************************/
47
 
/* public methods                                                            */
48
 
/*****************************************************************************/
49
 
 
50
 
void
51
 
lasso_saml_authentication_statement_add_authorityBinding(LassoSamlAuthenticationStatement *node,
52
 
                                                         LassoSamlAuthorityBinding *authorityBinding)
53
 
{
54
 
  LassoNodeClass *class;
55
 
  g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
56
 
  g_assert(LASSO_IS_SAML_AUTHORITY_BINDING(authorityBinding));
57
 
 
58
 
  class = LASSO_NODE_GET_CLASS(node);
59
 
  class->add_child(LASSO_NODE (node), LASSO_NODE(authorityBinding), TRUE);
60
 
}
61
 
 
62
 
void
63
 
lasso_saml_authentication_statement_set_authenticationInstant(LassoSamlAuthenticationStatement *node,
64
 
                                                              const xmlChar *authenticationInstant)
65
 
{
66
 
  LassoNodeClass *class;
67
 
  g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
68
 
  g_assert(authenticationInstant != NULL);
69
 
 
70
 
  class = LASSO_NODE_GET_CLASS(node);
71
 
  class->set_prop(LASSO_NODE (node), "AuthenticationInstant", authenticationInstant);
72
 
}
73
 
 
74
 
void
75
 
lasso_saml_authentication_statement_set_authenticationMethod(LassoSamlAuthenticationStatement *node,
76
 
                                                             const xmlChar *authenticationMethod)
77
 
{
78
 
  LassoNodeClass *class;
79
 
  g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
80
 
  g_assert(authenticationMethod != NULL);
81
 
 
82
 
  class = LASSO_NODE_GET_CLASS(node);
83
 
  class->set_prop(LASSO_NODE (node), "AuthenticationMethod", authenticationMethod);
84
 
}
85
 
 
86
 
void
87
 
lasso_saml_authentication_statement_set_subjectLocality(LassoSamlAuthenticationStatement *node,
88
 
                                                        LassoSamlSubjectLocality *subjectLocality)
89
 
{
90
 
  LassoNodeClass *class;
91
 
  g_assert(LASSO_IS_SAML_AUTHENTICATION_STATEMENT(node));
92
 
  g_assert(LASSO_IS_SAML_SUBJECT_LOCALITY(subjectLocality));
93
 
 
94
 
  class = LASSO_NODE_GET_CLASS(node);
95
 
  class->add_child(LASSO_NODE (node), LASSO_NODE(subjectLocality), FALSE);
96
 
}
 
28
 * Schema fragment (oasis-sstc-saml-schema-assertion-1.0.xsd):
 
29
 * 
 
30
 * <element name="AuthenticationStatement" type="saml:AuthenticationStatementType"/>
 
31
 * <complexType name="AuthenticationStatementType">
 
32
 *   <complexContent>
 
33
 *     <extension base="saml:SubjectStatementAbstractType">
 
34
 *       <sequence>
 
35
 *         <element ref="saml:SubjectLocality" minOccurs="0"/>
 
36
 *         <element ref="saml:AuthorityBinding" minOccurs="0" maxOccurs="unbounded"/>
 
37
 *       </sequence>
 
38
 *       <attribute name="AuthenticationMethod" type="anyURI" use="required"/>
 
39
 *       <attribute name="AuthenticationInstant" type="dateTime" use="required"/>
 
40
 *     </extension>
 
41
 *   </complexContent>
 
42
 * </complexType>
 
43
 */
 
44
 
 
45
/*****************************************************************************/
 
46
/* private methods                                                           */
 
47
/*****************************************************************************/
 
48
 
 
49
static struct XmlSnippet schema_snippets[] = {
 
50
        { "SubjectLocality", SNIPPET_NODE,
 
51
                G_STRUCT_OFFSET(LassoSamlAuthenticationStatement, SubjectLocality) },
 
52
        { "AuthorityBinding", SNIPPET_LIST_NODES,
 
53
                G_STRUCT_OFFSET(LassoSamlAuthenticationStatement, AuthorityBinding) },
 
54
        { "AuthenticationMethod", SNIPPET_ATTRIBUTE,
 
55
                G_STRUCT_OFFSET(LassoSamlAuthenticationStatement, AuthenticationMethod) },
 
56
        { "AuthenticationInstant", SNIPPET_ATTRIBUTE,
 
57
                G_STRUCT_OFFSET(LassoSamlAuthenticationStatement, AuthenticationInstant) },
 
58
        { NULL, 0, 0}
 
59
};
97
60
 
98
61
/*****************************************************************************/
99
62
/* instance and class init functions                                         */
100
63
/*****************************************************************************/
101
64
 
102
65
static void
103
 
lasso_saml_authentication_statement_instance_init(LassoSamlAuthenticationStatement *node)
 
66
instance_init(LassoSamlAuthenticationStatement *node)
104
67
{
105
 
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
106
 
 
107
 
  /* namespace herited from SubjectStatementAbstract -> StatementAbstract */
108
 
  class->set_name(LASSO_NODE(node), "AuthenticationStatement");
 
68
        node->SubjectLocality = NULL;
 
69
        node->AuthorityBinding = NULL;
 
70
        node->AuthenticationMethod = NULL;
 
71
        node->AuthenticationInstant = NULL;
109
72
}
110
73
 
111
74
static void
112
 
lasso_saml_authentication_statement_class_init(LassoSamlAuthenticationStatementClass *klass)
 
75
class_init(LassoSamlAuthenticationStatementClass *klass)
113
76
{
 
77
        LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
 
78
 
 
79
        nclass->node_data = g_new0(LassoNodeClassData, 1);
 
80
        lasso_node_class_set_nodename(nclass, "AuthenticationStatement");
 
81
        lasso_node_class_set_ns(nclass, LASSO_SAML_ASSERTION_HREF, LASSO_SAML_ASSERTION_PREFIX);
 
82
        lasso_node_class_add_snippets(nclass, schema_snippets);
114
83
}
115
84
 
116
 
GType lasso_saml_authentication_statement_get_type() {
117
 
  static GType this_type = 0;
118
 
 
119
 
  if (!this_type) {
120
 
    static const GTypeInfo this_info = {
121
 
      sizeof (LassoSamlAuthenticationStatementClass),
122
 
      NULL,
123
 
      NULL,
124
 
      (GClassInitFunc) lasso_saml_authentication_statement_class_init,
125
 
      NULL,
126
 
      NULL,
127
 
      sizeof(LassoSamlAuthenticationStatement),
128
 
      0,
129
 
      (GInstanceInitFunc) lasso_saml_authentication_statement_instance_init,
130
 
    };
131
 
    
132
 
    this_type = g_type_register_static(LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT,
133
 
                                       "LassoSamlAuthenticationStatement",
134
 
                                       &this_info, 0);
135
 
  }
136
 
  return this_type;
 
85
GType
 
86
lasso_saml_authentication_statement_get_type()
 
87
{
 
88
        static GType this_type = 0;
 
89
 
 
90
        if (!this_type) {
 
91
                static const GTypeInfo this_info = {
 
92
                        sizeof (LassoSamlAuthenticationStatementClass),
 
93
                        NULL,
 
94
                        NULL,
 
95
                        (GClassInitFunc) class_init,
 
96
                        NULL,
 
97
                        NULL,
 
98
                        sizeof(LassoSamlAuthenticationStatement),
 
99
                        0,
 
100
                        (GInstanceInitFunc) instance_init,
 
101
                };
 
102
 
 
103
                this_type = g_type_register_static(LASSO_TYPE_SAML_SUBJECT_STATEMENT_ABSTRACT,
 
104
                                "LassoSamlAuthenticationStatement", &this_info, 0);
 
105
        }
 
106
        return this_type;
137
107
}
138
108
 
139
109
/**
140
110
 * lasso_saml_authentication_statement_new:
141
111
 *
142
 
 * Creates a new <saml:AuthenticationStatement> node object.
 
112
 * Creates a new #LassoSamlAuthenticationStatement object.
143
113
 * 
144
 
 * Return value: the new @LassoSamlAuthenticationStatement
 
114
 * Return value: a newly created #LassoSamlAuthenticationStatement object
145
115
 **/
146
 
LassoNode* lasso_saml_authentication_statement_new()
 
116
LassoNode*
 
117
lasso_saml_authentication_statement_new()
147
118
{
148
 
  return LASSO_NODE(g_object_new(LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT, NULL));
 
119
        return g_object_new(LASSO_TYPE_SAML_AUTHENTICATION_STATEMENT, NULL);
149
120
}