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

« back to all changes in this revision

Viewing changes to lasso/xml/lib_name_identifier_mapping_response.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: lib_name_identifier_mapping_response.c,v 1.5 2004/08/13 15:16:13 fpeters Exp $ 
 
1
/* $Id: lib_name_identifier_mapping_response.c,v 1.19 2005/01/22 15:57:55 eraviart Exp $ 
2
2
 *
3
3
 * Lasso - A free implementation of the Liberty 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/lib_name_identifier_mapping_response.h>
27
26
 
28
27
/*
29
 
The Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
30
 
 
31
 
<xs:element name="NameIdentifierMappingResponse" type="NameIdentifierMappingResponseType"/>
32
 
<xs:complexType name="NameIdentifierMappingResponseType">
33
 
  <xs:complexContent>
34
 
    <xs:extension base="samlp:ResponseAbstractType">
35
 
      <xs:sequence>
36
 
        <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
37
 
        <xs:element ref="ProviderID"/>
38
 
        <xs:element ref="samlp:Status"/>
39
 
        <xs:element ref="saml:NameIdentifier" minOccurs="0"/>
40
 
      </xs:sequence>
41
 
    </xs:extension>
42
 
  </xs:complexContent>
43
 
</xs:complexType>
44
 
 
45
 
*/
46
 
 
47
 
/*****************************************************************************/
48
 
/* public methods                                                            */
49
 
/*****************************************************************************/
50
 
 
51
 
void lasso_lib_name_identifier_mapping_response_set_nameIdentifier(LassoLibNameIdentifierMappingResponse *node,
52
 
                                                                   LassoSamlNameIdentifier *nameIdentifier)
53
 
{
54
 
  LassoNodeClass *class;
55
 
  g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
56
 
  g_assert(LASSO_IS_SAML_NAME_IDENTIFIER(nameIdentifier));
57
 
  
58
 
  class = LASSO_NODE_GET_CLASS(node);
59
 
  class->add_child(LASSO_NODE (node),
60
 
                   LASSO_NODE (nameIdentifier),
61
 
                   FALSE);
62
 
}
63
 
 
64
 
void
65
 
lasso_lib_name_identifier_mapping_response_set_providerID(LassoLibNameIdentifierMappingResponse *node,
66
 
                                                          const xmlChar *providerID)
67
 
{
68
 
  LassoNodeClass *class;
69
 
  g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
70
 
  g_assert(providerID != NULL);
71
 
  /* FIXME : providerID length SHOULD be <= 1024 */
72
 
 
73
 
  class = LASSO_NODE_GET_CLASS(node);
74
 
  class->new_child(LASSO_NODE (node), "ProviderID", providerID, FALSE);
75
 
}
76
 
 
77
 
void lasso_lib_name_identifier_mapping_response_set_status(LassoLibNameIdentifierMappingResponse *node,
78
 
                                                           LassoSamlpStatus *status)
79
 
{
80
 
  LassoNodeClass *class;
81
 
  g_assert(LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(node));
82
 
  g_assert(LASSO_IS_SAMLP_STATUS(status));
83
 
 
84
 
  class = LASSO_NODE_GET_CLASS(node);
85
 
  class->add_child(LASSO_NODE (node), LASSO_NODE(status), FALSE);
86
 
}
 
28
 * Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
 
29
 * 
 
30
 * <xs:element name="NameIdentifierMappingResponse" type="NameIdentifierMappingResponseType"/>
 
31
 * <xs:complexType name="NameIdentifierMappingResponseType">
 
32
 *   <xs:complexContent>
 
33
 *     <xs:extension base="samlp:ResponseAbstractType">
 
34
 *       <xs:sequence>
 
35
 *         <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
 
36
 *         <xs:element ref="ProviderID"/>
 
37
 *         <xs:element ref="samlp:Status"/>
 
38
 *         <xs:element ref="saml:NameIdentifier" minOccurs="0"/>
 
39
 *       </xs:sequence>
 
40
 *     </xs:extension>
 
41
 *   </xs:complexContent>
 
42
 * </xs:complexType>
 
43
 */
 
44
 
 
45
/*****************************************************************************/
 
46
/* private methods                                                           */
 
47
/*****************************************************************************/
 
48
 
 
49
static struct XmlSnippet schema_snippets[] = {
 
50
        { "Extension", SNIPPET_EXTENSION,
 
51
                G_STRUCT_OFFSET(LassoLibNameIdentifierMappingResponse, Extension) },
 
52
        { "ProviderID", SNIPPET_CONTENT,
 
53
                G_STRUCT_OFFSET(LassoLibNameIdentifierMappingResponse, ProviderID) },
 
54
        { "Status", SNIPPET_NODE,
 
55
                G_STRUCT_OFFSET(LassoLibNameIdentifierMappingResponse, Status) },
 
56
        { "NameIdentifier", SNIPPET_NODE,
 
57
                G_STRUCT_OFFSET(LassoLibNameIdentifierMappingResponse, NameIdentifier) },
 
58
        { NULL, 0, 0}
 
59
};
87
60
 
88
61
/*****************************************************************************/
89
62
/* instance and class init functions                                         */
90
63
/*****************************************************************************/
91
64
 
92
65
static void
93
 
lasso_lib_name_identifier_mapping_response_instance_init(LassoLibNameIdentifierMappingResponse *node)
 
66
instance_init(LassoLibNameIdentifierMappingResponse *node)
94
67
{
95
 
  LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(node));
96
 
 
97
 
  class->set_ns(LASSO_NODE(node), lassoLibHRef, lassoLibPrefix);
98
 
  class->set_name(LASSO_NODE(node), "NameIdentifierMappingResponse");
 
68
        node->Extension = NULL;
 
69
        node->ProviderID = NULL;
 
70
        node->Status = NULL;
 
71
        node->NameIdentifier = NULL;
99
72
}
100
73
 
101
74
static void
102
 
lasso_lib_name_identifier_mapping_response_class_init(LassoLibNameIdentifierMappingResponseClass *klass)
103
 
{
104
 
}
105
 
 
106
 
GType lasso_lib_name_identifier_mapping_response_get_type() {
107
 
  static GType name_identifier_mapping_response_type = 0;
108
 
 
109
 
  if (!name_identifier_mapping_response_type) {
110
 
    static const GTypeInfo name_identifier_mapping_response_info = {
111
 
      sizeof (LassoLibNameIdentifierMappingResponseClass),
112
 
      NULL,
113
 
      NULL,
114
 
      (GClassInitFunc) lasso_lib_name_identifier_mapping_response_class_init,
115
 
      NULL,
116
 
      NULL,
117
 
      sizeof(LassoLibNameIdentifierMappingResponse),
118
 
      0,
119
 
      (GInstanceInitFunc) lasso_lib_name_identifier_mapping_response_instance_init,
120
 
    };
121
 
    
122
 
    name_identifier_mapping_response_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT,
123
 
                                                                   "LassoLibNameIdentifierMappingResponse",
124
 
                                                                   &name_identifier_mapping_response_info, 0);
125
 
  }
126
 
  return name_identifier_mapping_response_type;
127
 
}
128
 
 
129
 
LassoNode* lasso_lib_name_identifier_mapping_response_new()
130
 
{
131
 
  return LASSO_NODE(g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL));
 
75
class_init(LassoLibNameIdentifierMappingResponseClass *klass)
 
76
{
 
77
        LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
 
78
 
 
79
        nclass->node_data = g_new0(LassoNodeClassData, 1);
 
80
        lasso_node_class_set_nodename(nclass, "NameIdentifierMappingResponse");
 
81
        lasso_node_class_set_ns(nclass, LASSO_LIB_HREF, LASSO_LIB_PREFIX);
 
82
        lasso_node_class_add_snippets(nclass, schema_snippets);
 
83
}
 
84
 
 
85
GType
 
86
lasso_lib_name_identifier_mapping_response_get_type()
 
87
{
 
88
        static GType name_identifier_mapping_response_type = 0;
 
89
 
 
90
        if (!name_identifier_mapping_response_type) {
 
91
                static const GTypeInfo name_identifier_mapping_response_info = {
 
92
                        sizeof (LassoLibNameIdentifierMappingResponseClass),
 
93
                        NULL,
 
94
                        NULL,
 
95
                        (GClassInitFunc) class_init,
 
96
                        NULL,
 
97
                        NULL,
 
98
                        sizeof(LassoLibNameIdentifierMappingResponse),
 
99
                        0,
 
100
                        (GInstanceInitFunc) instance_init,
 
101
                };
 
102
 
 
103
                name_identifier_mapping_response_type = g_type_register_static
 
104
                        (LASSO_TYPE_SAMLP_RESPONSE_ABSTRACT,
 
105
                         "LassoLibNameIdentifierMappingResponse",
 
106
                         &name_identifier_mapping_response_info, 0);
 
107
        }
 
108
        return name_identifier_mapping_response_type;
 
109
}
 
110
 
 
111
/**
 
112
 * lasso_lib_name_identifier_mapping_response_new:
 
113
 *
 
114
 * Creates a new #LassoLibNameIdentifierMappingResponse object.
 
115
 *
 
116
 * Return value: a newly created #LassoLibNameIdentifierMappingResponse object
 
117
 **/
 
118
LassoSamlpResponseAbstract*
 
119
lasso_lib_name_identifier_mapping_response_new()
 
120
{
 
121
        return g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL);
 
122
}
 
123
 
 
124
 
 
125
/**
 
126
 * lasso_lib_name_identifier_mapping_response_new_full:
 
127
 * @providerID:
 
128
 * @statusCodeValue:
 
129
 * @request: the request this is a response to
 
130
 * @sign_type:
 
131
 * @sign_method:
 
132
 *
 
133
 * Creates a new #LassoLibNameIdentifierMappingResponse object and initializes
 
134
 * it with the parameters.
 
135
 *
 
136
 * Return value: a newly created #LassoLibNameIdentifierMappingResponse object
 
137
 **/
 
138
LassoSamlpResponseAbstract*
 
139
lasso_lib_name_identifier_mapping_response_new_full(char *providerID, const char *statusCodeValue,
 
140
                LassoLibNameIdentifierMappingRequest *request,
 
141
                LassoSignatureType sign_type, LassoSignatureMethod sign_method)
 
142
{
 
143
        LassoLibNameIdentifierMappingResponse *response;
 
144
 
 
145
        response = g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL);
 
146
        lasso_samlp_response_abstract_fill(
 
147
                        LASSO_SAMLP_RESPONSE_ABSTRACT(response),
 
148
                        LASSO_SAMLP_REQUEST_ABSTRACT(request)->RequestID,
 
149
                        request->ProviderID);
 
150
        LASSO_SAMLP_RESPONSE_ABSTRACT(response)->sign_type = sign_type;
 
151
        LASSO_SAMLP_RESPONSE_ABSTRACT(response)->sign_method = sign_method;
 
152
 
 
153
        response->ProviderID = g_strdup(providerID);
 
154
        response->Status = lasso_samlp_status_new();
 
155
        response->Status->StatusCode = lasso_samlp_status_code_new();
 
156
        response->Status->StatusCode->Value = g_strdup(statusCodeValue);
 
157
 
 
158
        return LASSO_SAMLP_RESPONSE_ABSTRACT(response);
132
159
}