summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-08-07 15:11:06 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-08-07 15:11:06 +0000
commitf475a5388810dbdefabbdb301b085d8c82313866 (patch)
tree82fa3f3743a1ddbf45e49ba3f1601924ba5603b3 /python
parentff605a8ca2a1116eb2dbcc03bd01454f445c2f78 (diff)
downloadlasso-f475a5388810dbdefabbdb301b085d8c82313866.tar.gz
lasso-f475a5388810dbdefabbdb301b085d8c82313866.tar.xz
lasso-f475a5388810dbdefabbdb301b085d8c82313866.zip
Added attributes request, request_type, response, response_type to Lecp in
Python binding. Close bug #247.
Diffstat (limited to 'python')
-rw-r--r--python/environs/py_lecp.c13
-rw-r--r--python/lasso.py16
2 files changed, 26 insertions, 3 deletions
diff --git a/python/environs/py_lecp.c b/python/environs/py_lecp.c
index 9aa8ae58..dae603ca 100644
--- a/python/environs/py_lecp.c
+++ b/python/environs/py_lecp.c
@@ -24,6 +24,7 @@
*/
#include "../lassomod.h"
+#include "../xml/py_xml.h"
#include "py_lecp.h"
#include "py_server.h"
@@ -59,14 +60,22 @@ PyObject *lecp_getattr(PyObject *self, PyObject *args) {
lecp = LassoLecp_get(lecp_obj);
if (!strcmp(attr, "__members__"))
- return Py_BuildValue("[sss]", "assertionConsumerServiceURL",
- "msg_body", "msg_url");
+ return Py_BuildValue("[sssssss]", "assertionConsumerServiceURL", "msg_body", "msg_url",
+ "request", "request_type", "response", "response_type");
if (!strcmp(attr, "assertionConsumerServiceURL"))
return (charPtrConst_wrap(lecp->assertionConsumerServiceURL));
if (!strcmp(attr, "msg_body"))
return (charPtrConst_wrap(LASSO_PROFILE(lecp)->msg_body));
if (!strcmp(attr, "msg_url"))
return (charPtrConst_wrap(LASSO_PROFILE(lecp)->msg_url));
+ if (!strcmp(attr, "request"))
+ return (LassoNode_wrap(LASSO_PROFILE(lecp)->request));
+ if (!strcmp(attr, "request_type"))
+ return (int_wrap(LASSO_PROFILE(lecp)->request_type));
+ if (!strcmp(attr, "response"))
+ return (LassoNode_wrap(LASSO_PROFILE(lecp)->response));
+ if (!strcmp(attr, "response_type"))
+ return (int_wrap(LASSO_PROFILE(lecp)->response_type));
Py_INCREF(Py_None);
return (Py_None);
diff --git a/python/lasso.py b/python/lasso.py
index 96d528f2..9f070467 100644
--- a/python/lasso.py
+++ b/python/lasso.py
@@ -1446,7 +1446,21 @@ class Lecp(Login):
raise AttributeError, name
ret = lassomod.lecp_getattr(self, name)
if ret is None:
- return None
+ raise AttributeError, name
+ elif name == "request":
+ if lassomod.lecp_getattr(self, "request_type") == messageTypeAuthnRequest:
+ ret = AuthnRequest(None, _obj=ret)
+ elif lassomod.lecp_getattr(self, "request_type") == messageTypeRequest:
+ ret = Node(_obj=ret)
+ # FIXME ret = Request(_obj=ret)
+ elif name == "response":
+ if lassomod.lecp_getattr(self, "response_type") == messageTypeAuthnResponse:
+ ret = AuthnResponse(None, _obj=ret)
+ elif lassomod.lecp_getattr(self, "response_type") == messageTypeResponse:
+ ret = SamlpResponse(_obj=ret)
+ # FIXME ret = Response(_obj=ret)
+ elif lassomod.lecp_getattr(self, "response_type") == messageTypeArtifact:
+ ret = Node(_obj=ret)
return ret
def new(cls, server = None):