diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-07-20 16:05:05 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-07-20 16:05:05 +0000 |
| commit | 2b83bc221ab4df6a13651392414f3c995e150d10 (patch) | |
| tree | 5fca60a0ba26bfbe8436cae463dcac2e36b8c449 /python | |
| parent | a7c3554f40b6b017a4d4abc396de64ed89342a62 (diff) | |
| download | lasso-2b83bc221ab4df6a13651392414f3c995e150d10.tar.gz lasso-2b83bc221ab4df6a13651392414f3c995e150d10.tar.xz lasso-2b83bc221ab4df6a13651392414f3c995e150d10.zip | |
update internal code to use new_from_export style
Diffstat (limited to 'python')
| -rw-r--r-- | python/environs/py_logout.c | 4 | ||||
| -rw-r--r-- | python/examples/logout.py | 26 | ||||
| -rw-r--r-- | python/protocols/py_logout_request.c | 41 | ||||
| -rw-r--r-- | python/protocols/py_logout_request.h | 3 | ||||
| -rw-r--r-- | python/protocols/py_logout_response.c | 91 | ||||
| -rw-r--r-- | python/protocols/py_logout_response.h | 7 |
6 files changed, 56 insertions, 116 deletions
diff --git a/python/environs/py_logout.c b/python/environs/py_logout.c index 5a28217f..1333e40f 100644 --- a/python/environs/py_logout.c +++ b/python/environs/py_logout.c @@ -143,8 +143,8 @@ PyObject *logout_init_request(PyObject *self, PyObject *args) { gchar *remote_providerID; gint codeError; - if (CheckArgs(args, "OS:logout_init_request")) { - if(!PyArg_ParseTuple(args, (char *) "Os:logout_init_request", + if (CheckArgs(args, "Os:logout_init_request")) { + if(!PyArg_ParseTuple(args, (char *) "O|s:logout_init_request", &logout_obj, &remote_providerID)) return NULL; } diff --git a/python/examples/logout.py b/python/examples/logout.py index ec3ed914..faa31e4b 100644 --- a/python/examples/logout.py +++ b/python/examples/logout.py @@ -11,8 +11,9 @@ spserver = lasso.Server.new("../../examples/sp.xml", lasso.signatureMethodRsaSha1) spserver.add_provider("../../examples/idp.xml", None, None) +spserver.add_provider("../../examples/idp2.xml", None, None) -spuser_dump = "<LassoUser><LassoIdentities><LassoIdentity RemoteProviderID=\"https://identity-provider:2003/liberty-alliance/metadata\"><LassoLocalNameIdentifier><NameIdentifier NameQualifier=\"qualifier.com\" Format=\"federated\">LLLLLLLLLLLLLLLLLLLLLLLLL</NameIdentifier></LassoLocalNameIdentifier></LassoIdentity></LassoIdentities></LassoUser>" +spuser_dump = "<LassoUser><LassoIdentities><LassoIdentity RemoteProviderID=\"https://identity-provider:2003/liberty-alliance/metadata\"><LassoLocalNameIdentifier><NameIdentifier NameQualifier=\"qualifier.com\" Format=\"federated\">11111111111111111111111111</NameIdentifier></LassoLocalNameIdentifier></LassoIdentity><LassoIdentity RemoteProviderID=\"https://identity-provider2:2003/liberty-alliance/metadata\"><LassoLocalNameIdentifier><NameIdentifier NameQualifier=\"qualifier.com\" Format=\"federated\">22222222222222222222222222</NameIdentifier></LassoLocalNameIdentifier></LassoIdentity></LassoIdentities></LassoUser>" spuser = lasso.User.new_from_dump(spuser_dump) @@ -22,8 +23,13 @@ splogout.init_request("https://identity-provider:2003/liberty-alliance/metadata" splogout.build_request_msg() request_msg = splogout.msg_body -print 'request url : ', splogout.msg_url -print 'request body : ', splogout.msg_body +msg_url = splogout.msg_url +msg_body = splogout.msg_body + +splogout.destroy() + +print 'request url : ', msg_url +print 'request body : ', msg_body # LogoutResponse : @@ -36,9 +42,15 @@ idpuser_dump = "<LassoUser><LassoAssertions></LassoAssertions><LassoIdentities>< idpuser = lasso.User.new_from_dump(idpuser_dump) idplogout = lasso.Logout.new(idpserver, idpuser, lasso.providerTypeIdp) -idplogout.process_request_msg(request_msg, lasso.httpMethodSoap) -idplogout.build_response_msg() -print 'url : ', idplogout.msg_url -print 'body : ', idplogout.msg_body +#idplogout.process_request_msg(request_msg, lasso.httpMethodSoap) +#idplogout.build_response_msg() + +#msg_url = idplogout.msg_url +#msg_body = idplogout.msg_body +#print 'body : ', idplogout.msg_body + +# process the response : +#splogout = lasso.Logout.new(spserver, spuser, lasso.providerTypeSp) +#splogout.process_response_msg(msg_body, lasso.httpMethodSoap) lasso.shutdown() diff --git a/python/protocols/py_logout_request.c b/python/protocols/py_logout_request.c index fde13d34..ee4a75bf 100644 --- a/python/protocols/py_logout_request.c +++ b/python/protocols/py_logout_request.c @@ -42,10 +42,10 @@ PyObject *LassoLogoutRequest_wrap(LassoLogoutRequest *request) { /******************************************************************************/ PyObject *logout_request_new(PyObject *self, PyObject *args) { - const xmlChar *providerID; - const xmlChar *nameIdentifier; - const xmlChar *nameQualifier; - const xmlChar *format; + gchar *providerID; + gchar *nameIdentifier; + gchar *nameQualifier; + gchar *format; LassoNode *request; @@ -62,36 +62,19 @@ PyObject *logout_request_new(PyObject *self, PyObject *args) { return (LassoLogoutRequest_wrap(LASSO_LOGOUT_REQUEST(request))); } -PyObject *logout_request_new_from_soap(PyObject *self, PyObject *args) { - const xmlChar *soap_buffer; +PyObject *logout_request_new_from_export(PyObject *self, PyObject *args) { + gchar *buffer; + lassoNodeExportTypes export_type; + LassoNode *request; - LassoNode *request; - - if (CheckArgs(args, "S:logout_request_new_from_soap")) { - if(!PyArg_ParseTuple(args, (char *) "s:logout_request_new_from_soap", - &soap_buffer)) - return NULL; - } - else return NULL; - - request = lasso_logout_request_new_from_soap(soap_buffer); - - return (LassoLogoutRequest_wrap(LASSO_LOGOUT_REQUEST(request))); -} - -PyObject *logout_request_new_from_query(PyObject *self, PyObject *args) { - const xmlChar *query; - - LassoNode *request; - - if (CheckArgs(args, "S:logout_request_new_from_query")) { - if(!PyArg_ParseTuple(args, (char *) "s:logout_request_new_from_query", - &query)) + if (CheckArgs(args, "SS:logout_request_new_from_export")) { + if(!PyArg_ParseTuple(args, (char *) "ss:logout_request_new_from_export", + &buffer, &export_type)) return NULL; } else return NULL; - request = lasso_logout_request_new_from_query(query); + request = lasso_logout_request_new_from_export(buffer, export_type); return (LassoLogoutRequest_wrap(LASSO_LOGOUT_REQUEST(request))); } diff --git a/python/protocols/py_logout_request.h b/python/protocols/py_logout_request.h index 38cf1e46..da73b488 100644 --- a/python/protocols/py_logout_request.h +++ b/python/protocols/py_logout_request.h @@ -39,7 +39,6 @@ PyObject *LassoLogoutRequest_wrap(LassoLogoutRequest *request); PyObject *logout_request_getattr(PyObject *self, PyObject *args); PyObject *logout_request_new(PyObject *self, PyObject *args); -PyObject *logout_request_new_from_soap(PyObject *self, PyObject *args); -PyObject *logout_request_new_from_query(PyObject *self, PyObject *args); +PyObject *logout_request_new_from_export(PyObject *self, PyObject *args); #endif /* __PYLASSO_PY_LOGOUT_REQUEST_H__ */ diff --git a/python/protocols/py_logout_response.c b/python/protocols/py_logout_response.c index 34f535cd..09f57f2d 100644 --- a/python/protocols/py_logout_response.c +++ b/python/protocols/py_logout_response.c @@ -41,97 +41,46 @@ PyObject *LassoLogoutResponse_wrap(LassoLogoutResponse *response) { /******************************************************************************/ -PyObject *logout_response_new_from_request_soap(PyObject *self, PyObject *args) { - const xmlChar *request_soap_dump; - const xmlChar *providerID; - const xmlChar *status_code_value; +PyObject *logout_response_new_from_request_export(PyObject *self, PyObject *args) { + gchar *request_export; + gchar *providerID; + gchar *status_code_value; + gint export_type; LassoNode *response = NULL; - if (CheckArgs(args, "SSS:logout_response_new_from_request_soap")) { - if(!PyArg_ParseTuple(args, (char *) "sss:logout_response_new_from_request_soap", - &request_soap_dump, + if (CheckArgs(args, "SSSS:logout_response_new_from_request_export")) { + if(!PyArg_ParseTuple(args, (char *) "ssss:logout_response_new_from_request_export", + &request_export, + &export_type, &providerID, &status_code_value)) return NULL; } else return NULL; - response = lasso_logout_response_new_from_request_soap(request_soap_dump, - providerID, - status_code_value); + response = lasso_logout_response_new_from_request_export(request_export, + export_type, + providerID, + status_code_value); return (LassoLogoutResponse_wrap(LASSO_LOGOUT_RESPONSE(response))); } -PyObject *logout_response_new_from_soap(PyObject *self, PyObject *args) { - const xmlChar *request_soap_dump; +PyObject *logout_response_new_from_export(PyObject *self, PyObject *args) { + gchar *request_export; + gint export_type; LassoNode *response = NULL; - if (CheckArgs(args, "S:logout_response_new_from_soap")) { - if(!PyArg_ParseTuple(args, (char *) "s:logout_response_new_from_soap", - &request_soap_dump)) + if (CheckArgs(args, "SS:logout_response_new_from_export")) { + if(!PyArg_ParseTuple(args, (char *) "ss:logout_response_new_from_export", + &request_export, &export_type)) return NULL; } else return NULL; - response = lasso_logout_response_new_from_soap(request_soap_dump); - - return (LassoLogoutResponse_wrap(LASSO_LOGOUT_RESPONSE(response))); -} - -PyObject *logout_response_new_from_dump(PyObject *self, PyObject *args) { - const xmlChar *dump; - - LassoNode *response = NULL; - - if (CheckArgs(args, "S:logout_response_new_from_dump")) { - if(!PyArg_ParseTuple(args, (char *) "s:logout_response_new_from_dump", - &dump)) - return NULL; - } - else return NULL; - - response = lasso_logout_response_new_from_soap(dump); - - return (LassoLogoutResponse_wrap(LASSO_LOGOUT_RESPONSE(response))); -} - -PyObject *logout_response_new_from_request_query(PyObject *self, PyObject *args) { - const xmlChar *query; - const xmlChar *providerID; - const xmlChar *status_code_value; - - LassoNode *response = NULL; - - if (CheckArgs(args, "SSS:logout_response_new_from_request_query")) { - if(!PyArg_ParseTuple(args, (char *) "sss:logout_response_new_from_request_query", - &query, - &providerID, - &status_code_value)) - return NULL; - } - else return NULL; - - response = lasso_logout_response_new_from_request_query(query, providerID, status_code_value); - - return (LassoLogoutResponse_wrap(LASSO_LOGOUT_RESPONSE(response))); -} - -PyObject *logout_response_new_from_query(PyObject *self, PyObject *args) { - const xmlChar *query; - - LassoNode *response = NULL; - - if (CheckArgs(args, "S:logout_response_new_from_request_query")) { - if(!PyArg_ParseTuple(args, (char *) "s:logout_response_new_from_request_query", - &query)) - return NULL; - } - else return NULL; - - response = lasso_logout_response_new_from_query(query); + response = lasso_logout_response_new_from_export(request_export, export_type); return (LassoLogoutResponse_wrap(LASSO_LOGOUT_RESPONSE(response))); } diff --git a/python/protocols/py_logout_response.h b/python/protocols/py_logout_response.h index 04d1d22e..5e265c04 100644 --- a/python/protocols/py_logout_response.h +++ b/python/protocols/py_logout_response.h @@ -35,10 +35,7 @@ typedef struct { #define LassoLogoutResponse_get(v) (((v) == Py_None) ? NULL : (((LassoLogoutResponse_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) PyObject *LassoLogoutResponse_wrap(LassoLogoutResponse *response); -PyObject *logout_response_new_from_request_soap(PyObject *self, PyObject *args); -PyObject *logout_response_new_from_soap(PyObject *self, PyObject *args); -PyObject *logout_response_new_from_dump(PyObject *self, PyObject *args); -PyObject *logout_response_new_from_request_query(PyObject *self, PyObject *args); -PyObject *logout_response_new_from_query(PyObject *self, PyObject *args); +PyObject *logout_response_new_from_request_export(PyObject *self, PyObject *args); +PyObject *logout_response_new_from_export(PyObject *self, PyObject *args); #endif /* __PYLASSO_PY_LOGOUT_RESPONSE_H__ */ |
