diff options
Diffstat (limited to 'lasso/xml/samlp_response_abstract.c')
-rw-r--r-- | lasso/xml/samlp_response_abstract.c | 56 |
1 files changed, 6 insertions, 50 deletions
diff --git a/lasso/xml/samlp_response_abstract.c b/lasso/xml/samlp_response_abstract.c index 128054fa..7e78496c 100644 --- a/lasso/xml/samlp_response_abstract.c +++ b/lasso/xml/samlp_response_abstract.c @@ -57,6 +57,8 @@ /*****************************************************************************/ static struct XmlSnippet schema_snippets[] = { + { "Signature", SNIPPET_SIGNATURE, + G_STRUCT_OFFSET(LassoSamlpResponseAbstract, ResponseID) }, { "ResponseID", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoSamlpResponseAbstract, ResponseID) }, { "MajorVersion", SNIPPET_ATTRIBUTE | SNIPPET_INTEGER, @@ -71,53 +73,6 @@ static struct XmlSnippet schema_snippets[] = { { NULL, 0, 0} }; -static LassoNodeClass *parent_class = NULL; - -static xmlNode* -get_xmlNode(LassoNode *node) -{ - xmlNode *xmlnode; - LassoSamlpResponseAbstract *response = LASSO_SAMLP_RESPONSE_ABSTRACT(node); - - xmlnode = parent_class->get_xmlNode(node); - - /* signature stuff */ - if (response->sign_type != LASSO_SIGNATURE_TYPE_NONE) { - xmlNode *signature = NULL, *reference, *key_info; - char *uri; - - if (response->sign_method == LASSO_SIGNATURE_METHOD_RSA_SHA1) { - signature = xmlSecTmplSignatureCreate(NULL, xmlSecTransformExclC14NId, - xmlSecTransformRsaSha1Id, NULL); - } - if (response->sign_method == LASSO_SIGNATURE_METHOD_DSA_SHA1) { - signature = xmlSecTmplSignatureCreate(NULL, xmlSecTransformExclC14NId, - xmlSecTransformDsaSha1Id, NULL); - } - /* get out if signature == NULL ? */ - xmlAddChild(xmlnode, signature); - - uri = g_strdup_printf("#%s", response->ResponseID); - reference = xmlSecTmplSignatureAddReference(signature, - xmlSecTransformSha1Id, NULL, uri, NULL); - g_free(uri); - - /* add enveloped transform */ - xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId); - /* add exclusive C14N transform */ - xmlSecTmplReferenceAddTransform(reference, xmlSecTransformExclC14NId); - - /* add <dsig:KeyInfo/> */ - if (response->sign_type == LASSO_SIGNATURE_TYPE_WITHX509) { - key_info = xmlSecTmplSignatureEnsureKeyInfo(signature, NULL); - xmlSecTmplKeyInfoAddX509Data(key_info); - } - } - - - return xmlnode; -} - static char* get_sign_attr_name() { @@ -125,7 +80,6 @@ get_sign_attr_name() } - /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -147,13 +101,15 @@ class_init(LassoSamlpResponseAbstractClass *klass) { LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); - parent_class = g_type_class_peek_parent(klass); - nclass->get_xmlNode = get_xmlNode; nclass->get_sign_attr_name = get_sign_attr_name; nclass->node_data = g_new0(LassoNodeClassData, 1); lasso_node_class_set_nodename(nclass, "ResponseAbstract"); lasso_node_class_set_ns(nclass, LASSO_SAML_PROTOCOL_HREF, LASSO_SAML_PROTOCOL_PREFIX); lasso_node_class_add_snippets(nclass, schema_snippets); + nclass->node_data->sign_type_offset = G_STRUCT_OFFSET( + LassoSamlpResponseAbstract, sign_type); + nclass->node_data->sign_method_offset = G_STRUCT_OFFSET( + LassoSamlpResponseAbstract, sign_method); } GType |