summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-04-13 10:15:54 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-04-13 10:15:54 +0000
commitf1d2812a740a1463bf920e6501e14baafe632aed (patch)
tree5685eae31fbb0aea42b821a0eb4b95c2ceffefbe /python
parentda44bfe52bb580448477d8b91e59dcc6bc47e914 (diff)
downloadlasso-f1d2812a740a1463bf920e6501e14baafe632aed.tar.gz
lasso-f1d2812a740a1463bf920e6501e14baafe632aed.tar.xz
lasso-f1d2812a740a1463bf920e6501e14baafe632aed.zip
*** empty log message ***
Diffstat (limited to 'python')
-rwxr-xr-xpython/examples/test.py17
-rw-r--r--python/lassomod.c9
-rw-r--r--python/py_lasso.c3
-rwxr-xr-xpython/setup.py8
-rw-r--r--python/wrap_objs.c2
-rw-r--r--python/wrap_objs.h2
-rw-r--r--python/xml/py_xml.c52
-rw-r--r--python/xml/py_xml.h3
8 files changed, 81 insertions, 15 deletions
diff --git a/python/examples/test.py b/python/examples/test.py
index d3df943d..5fcd622e 100755
--- a/python/examples/test.py
+++ b/python/examples/test.py
@@ -4,7 +4,7 @@ import sys
sys.path.insert(0, '../')
import lasso
-print lasso.init()
+lasso.init()
req = lasso.AuthnRequest("providerid.com",
"federated",
@@ -28,7 +28,7 @@ print query
res = lasso.AuthnResponse(query, 1,
"../../examples/rsapub.pem",
- "../../examples/rsakey2.pem",
+ "../../examples/rsakey.pem",
"../../examples/rsacert.pem", 0)
res.init("toto", 1)
@@ -36,7 +36,7 @@ res.init("toto", 1)
assertion = lasso.assertion_build(res, "http://idprovider.com")
authentication_statement = lasso.authentication_statement_build("password",
"3",
- "tralalal",
+ "tralala",
"dslqkjfslfj",
"http://service-provider.com",
"federated",
@@ -46,8 +46,15 @@ authentication_statement = lasso.authentication_statement_build("password",
"bearer")
lasso.assertion_add_authenticationStatement(assertion, authentication_statement);
res.add_assertion(assertion)
-
res.node.dump("iso-8859-1", 1)
+
+assertion.verify_signature("../../examples/rootcert.pem")
+res.node.get_child("Assertion").verify_signature("../../examples/rootcert.pem")
+
+status = res.node.get_child("Status")
+status_code = status.get_child("StatusCode")
+print status_code.get_attr_value("Value")
+
#req.node.destroy()
-#print lasso.shutdown()
+#lasso.shutdown()
diff --git a/python/lassomod.c b/python/lassomod.c
index bad6649f..407d3778 100644
--- a/python/lassomod.c
+++ b/python/lassomod.c
@@ -38,9 +38,12 @@ static PyMethodDef lasso_methods[] = {
{"check_version_ext", check_version_ext, METH_VARARGS},
/* py_xml.h */
- {"node_dump", node_dump, METH_VARARGS},
- {"node_unref", node_unref, METH_VARARGS},
- {"node_url_encode", node_url_encode, METH_VARARGS},
+ {"node_dump", node_dump, METH_VARARGS},
+ {"node_get_attr_value", node_get_attr_value, METH_VARARGS},
+ {"node_get_child", node_get_child, METH_VARARGS},
+ {"node_unref", node_unref, METH_VARARGS},
+ {"node_url_encode", node_url_encode, METH_VARARGS},
+ {"node_verify_signature", node_verify_signature, METH_VARARGS},
/* py_single_sign_on_and_federation.h */
{"authn_request_getattr", authn_request_getattr, METH_VARARGS},
diff --git a/python/py_lasso.c b/python/py_lasso.c
index 5fa8f931..0ff9c751 100644
--- a/python/py_lasso.c
+++ b/python/py_lasso.c
@@ -31,7 +31,8 @@ PyObject *init(PyObject *self, PyObject *args) {
}
PyObject *shutdown(PyObject *self, PyObject *args) {
- return (int_wrap(lasso_shutdown()));
+ //return (int_wrap(lasso_shutdown()));
+ return (int_wrap(0));
}
PyObject *check_version_exact(PyObject *self, PyObject *args) {
diff --git a/python/setup.py b/python/setup.py
index 63d65fee..290ad5ec 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -180,10 +180,10 @@ extract_cflags(xmlsec1_cflags)
extract_libs(xmlsec1_libs)
# FIXME : cflags & libs for lasso
-#include_dirs.append('..')
-#library_dirs.append('../lasso/.libs')
-include_dirs.append('/usr/local/include')
-library_dirs.append('/usr/local/lib')
+include_dirs.append('..')
+library_dirs.append('../lasso/.libs')
+#include_dirs.append('/usr/local/include')
+#library_dirs.append('/usr/local/lib')
libraries.append('lasso')
em = Extension("lassomod",
diff --git a/python/wrap_objs.c b/python/wrap_objs.c
index d175f6ea..777aa8e0 100644
--- a/python/wrap_objs.c
+++ b/python/wrap_objs.c
@@ -70,7 +70,7 @@ PyObject *charPtrConst_wrap(const char *str) {
/* Functions to wrap LibXML objects -> Python objects */
/*****************************************************************************/
-PyObject *wrap_xmlCharPtr(xmlChar *str) {
+PyObject *xmlCharPtr_wrap(xmlChar *str) {
PyObject *ret;
if (str == NULL) {
diff --git a/python/wrap_objs.h b/python/wrap_objs.h
index a846d00a..ef3356de 100644
--- a/python/wrap_objs.h
+++ b/python/wrap_objs.h
@@ -55,7 +55,7 @@ PyObject *int_wrap(int val);
PyObject *charPtr_wrap(char *str);
PyObject *charPtrConst_wrap(const char *str);
-PyObject *wrap_xmlCharPtr(xmlChar *str);
+PyObject *xmlCharPtr_wrap(xmlChar *str);
PyObject *wrap_xmlCharPtrConst(const xmlChar *str);
PyObject *wrap_xmlDocPtr(xmlDocPtr doc);
PyObject *wrap_xmlNodePtr(xmlNodePtr node);
diff --git a/python/xml/py_xml.c b/python/xml/py_xml.c
index 1ce046eb..d2816ceb 100644
--- a/python/xml/py_xml.c
+++ b/python/xml/py_xml.c
@@ -60,6 +60,40 @@ PyObject *node_dump(PyObject *self, PyObject *args) {
return (Py_None);
}
+PyObject *node_get_attr_value(PyObject *self, PyObject *args) {
+ PyObject *node_obj;
+ const xmlChar *name;
+ xmlChar *ret;
+
+ if (CheckArgs(args, "OS:node_get_attr_value")) {
+ if(!PyArg_ParseTuple(args, (char *) "Os:node_get_attr_value",
+ &node_obj, &name))
+ return NULL;
+ }
+ else return NULL;
+
+ ret = lasso_node_get_attr_value(LassoNode_get(node_obj), name);
+
+ return (xmlCharPtr_wrap(ret));
+}
+
+PyObject *node_get_child(PyObject *self, PyObject *args) {
+ PyObject *node_obj;
+ const xmlChar *name;
+ LassoNode *ret;
+
+ if (CheckArgs(args, "OS:node_get_child")) {
+ if(!PyArg_ParseTuple(args, (char *) "Os:node_get_child",
+ &node_obj, &name))
+ return NULL;
+ }
+ else return NULL;
+
+ ret = lasso_node_get_child(LassoNode_get(node_obj), name);
+
+ return (LassoNode_wrap(ret));
+}
+
PyObject *node_unref(PyObject *self, PyObject *args) {
PyObject *node_obj;
@@ -94,3 +128,21 @@ PyObject *node_url_encode(PyObject *self, PyObject *args) {
return (charPtr_wrap(ret));
}
+
+PyObject *node_verify_signature(PyObject *self, PyObject *args) {
+ PyObject *node_obj;
+ const gchar *certificate_file;
+ gint ret;
+
+ if (CheckArgs(args, "OS:node_verify_signature")) {
+ if(!PyArg_ParseTuple(args, (char *) "Os:node_verify_signature",
+ &node_obj, &certificate_file))
+ return NULL;
+ }
+ else return NULL;
+
+ ret = lasso_node_verify_signature(LassoNode_get(node_obj),
+ certificate_file);
+
+ return (int_wrap(ret));
+}
diff --git a/python/xml/py_xml.h b/python/xml/py_xml.h
index a1a186ab..2de90e1a 100644
--- a/python/xml/py_xml.h
+++ b/python/xml/py_xml.h
@@ -36,7 +36,10 @@ typedef struct {
PyObject *LassoNode_wrap(LassoNode *node);
PyObject *node_dump(PyObject *self, PyObject *args);
+PyObject *node_get_attr_value(PyObject *self, PyObject *args);
+PyObject *node_get_child(PyObject *self, PyObject *args);
PyObject *node_unref(PyObject *self, PyObject *args);
PyObject *node_url_encode(PyObject *self, PyObject *args);
+PyObject *node_verify_signature(PyObject *self, PyObject *args);
#endif /* __PYLASSO_PY_XML_H__ */