diff options
author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-07-11 00:18:26 +0000 |
---|---|---|
committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-07-11 00:18:26 +0000 |
commit | e1580d4b512b7fdbaed988e50b8069b66ff688d5 (patch) | |
tree | e10a22ec7b06271b2364c29e757a4cd2dcaa3dd2 /python | |
parent | 3677573bee663ff680489855724dcdc8360e6860 (diff) | |
download | lasso-e1580d4b512b7fdbaed988e50b8069b66ff688d5.tar.gz lasso-e1580d4b512b7fdbaed988e50b8069b66ff688d5.tar.xz lasso-e1580d4b512b7fdbaed988e50b8069b66ff688d5.zip |
*** empty log message ***
Diffstat (limited to 'python')
-rw-r--r-- | python/environs/py_login.c | 45 | ||||
-rw-r--r-- | python/environs/py_login.h | 2 | ||||
-rw-r--r-- | python/examples/login.py | 20 | ||||
-rw-r--r-- | python/lasso.py | 7 | ||||
-rw-r--r-- | python/lassomod.c | 2 |
5 files changed, 74 insertions, 2 deletions
diff --git a/python/environs/py_login.c b/python/environs/py_login.c index d7734a2f..f0dbee5a 100644 --- a/python/environs/py_login.c +++ b/python/environs/py_login.c @@ -56,8 +56,8 @@ PyObject *login_getattr(PyObject *self, PyObject *args) { login = LassoLogin_get(login_obj); if (!strcmp(attr, "__members__")) - return Py_BuildValue("[sssss]", "request", "response", "request_type", - "msg_url", "protocolProfile"); + return Py_BuildValue("[ssssss]", "request", "response", "request_type", + "msg_url", "msg_body", "protocolProfile"); if (!strcmp(attr, "request")) return (LassoNode_wrap(LASSO_PROFILE_CONTEXT(login)->request)); if (!strcmp(attr, "response")) @@ -66,6 +66,8 @@ PyObject *login_getattr(PyObject *self, PyObject *args) { return (int_wrap(LASSO_PROFILE_CONTEXT(login)->request_type)); if (!strcmp(attr, "msg_url")) return (charPtrConst_wrap(LASSO_PROFILE_CONTEXT(login)->msg_url)); + if (!strcmp(attr, "msg_body")) + return (charPtrConst_wrap(LASSO_PROFILE_CONTEXT(login)->msg_body)); if (!strcmp(attr, "protocolProfile")) return (int_wrap(login->protocolProfile)); @@ -161,6 +163,22 @@ PyObject *login_build_authn_request_msg(PyObject *self, PyObject *args) { return (int_wrap(ret)); } +PyObject *login_build_request_msg(PyObject *self, PyObject *args) { + PyObject *login_obj; + gint ret; + + if (CheckArgs(args, "O:login_build_request_msg")) { + if(!PyArg_ParseTuple(args, (char *) "O:login_build_request_msg", + &login_obj)) + return NULL; + } + else return NULL; + + ret = lasso_login_build_request_msg(LassoLogin_get(login_obj)); + + return (int_wrap(ret)); +} + PyObject *login_init_authn_request(PyObject *self, PyObject *args) { PyObject *login_obj; gchar *remote_providerID; @@ -199,6 +217,29 @@ PyObject *login_init_from_authn_request_msg(PyObject *self, PyObject *args) { return (int_wrap(ret)); } +PyObject *login_init_request(PyObject *self, PyObject *args) { + PyObject *login_obj; + gchar *response_msg; + lassoHttpMethods response_method; + const gchar *remote_providerID; + gint ret; + + if (CheckArgs(args, "OSIS:login_init_request")) { + if(!PyArg_ParseTuple(args, (char *) "Osis:login_init_request", + &login_obj, &response_msg, + &response_method, &remote_providerID)) + return NULL; + } + else return NULL; + + ret = lasso_login_init_request(LassoLogin_get(login_obj), + response_msg, + response_method, + remote_providerID); + + return (int_wrap(ret)); +} + PyObject *login_must_authenticate(PyObject *self, PyObject *args) { PyObject *login_obj; gboolean ret; diff --git a/python/environs/py_login.h b/python/environs/py_login.h index cb48de1c..7b8b4e2d 100644 --- a/python/environs/py_login.h +++ b/python/environs/py_login.h @@ -44,8 +44,10 @@ PyObject *login_new(PyObject *self, PyObject *args); PyObject *login_new_from_dump(PyObject *self, PyObject *args); PyObject *login_build_artifact_msg(PyObject *self, PyObject *args); PyObject *login_build_authn_request_msg(PyObject *self, PyObject *args); +PyObject *login_build_request_msg(PyObject *self, PyObject *args); PyObject *login_init_authn_request(PyObject *self, PyObject *args); PyObject *login_init_from_authn_request_msg(PyObject *self, PyObject *args); +PyObject *login_init_request(PyObject *self, PyObject *args); PyObject *login_must_authenticate(PyObject *self, PyObject *args); #endif /* __PYLASSO_PY_LOGIN_H__ */ diff --git a/python/examples/login.py b/python/examples/login.py index 04d21b57..e12195d4 100644 --- a/python/examples/login.py +++ b/python/examples/login.py @@ -62,3 +62,23 @@ if idplogin.protocolProfile == 1: "", lasso.HttpMethodRedirect) print "ret = %d, msg_url = %s" % (ret, idplogin.msg_url) + +#################### +# Service provider # +#################### +server = lasso.Server.new("../../examples/sp.xml", + "../../examples/rsapub.pem", "../../examples/rsakey.pem", "../../examples/rsacert.pem", + lasso.SignatureMethodRsaSha1) + +server.add_provider("../../examples/idp.xml", None, None) + +# create Request OR finish (if an authnResponse was received) +splogin = lasso.Login.new(server, None) + +response_msg = string.split(idplogin.msg_url, '?')[1] +ret = splogin.init_request(response_msg, + lasso.HttpMethodRedirect, + "https://identity-provider:2003/liberty-alliance/metadata") + +ret = splogin.build_request_msg() +print "ret = %d, msg_url = %s, msg_body = %s" % (ret, splogin.msg_url, splogin.msg_body) diff --git a/python/lasso.py b/python/lasso.py index 33f82c6f..009bb867 100644 --- a/python/lasso.py +++ b/python/lasso.py @@ -871,6 +871,9 @@ class Login: def build_authn_request_msg(self): return lassomod.login_build_authn_request_msg(self) + def build_request_msg(self): + return lassomod.login_build_request_msg(self) + def init_authn_request(self, remote_providerID): return lassomod.login_init_authn_request(self, remote_providerID) @@ -878,6 +881,10 @@ class Login: return lassomod.login_init_from_authn_request_msg(self, authn_request_msg, authn_request_method) + def init_request(self, response_msg, response_method, remote_providerID): + return lassomod.login_init_request(self, response_msg, + response_method, remote_providerID) + def must_authenticate(self): return lassomod.login_must_authenticate(self) diff --git a/python/lassomod.c b/python/lassomod.c index 4ebbc412..c17a8edc 100644 --- a/python/lassomod.c +++ b/python/lassomod.c @@ -207,8 +207,10 @@ static PyMethodDef lasso_methods[] = { {"login_new_from_dump", login_new_from_dump, METH_VARARGS}, {"login_build_artifact_msg", login_build_artifact_msg, METH_VARARGS}, {"login_build_authn_request_msg", login_build_authn_request_msg, METH_VARARGS}, + {"login_build_request_msg", login_build_request_msg, METH_VARARGS}, {"login_init_authn_request", login_init_authn_request, METH_VARARGS}, {"login_init_from_authn_request_msg", login_init_from_authn_request_msg, METH_VARARGS}, + {"login_init_request", login_init_request, METH_VARARGS}, {"login_must_authenticate", login_must_authenticate, METH_VARARGS}, /* py_logout.h */ |