diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-04-27 17:20:36 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-04-27 17:20:36 +0000 |
| commit | 6f1ffb6de23ab0c05f0eb7d1b4119f73a58d8bd8 (patch) | |
| tree | afda82e1ce1da0d3a9ee105835cfc80dbb466ea3 /python | |
| parent | 22e74ede81046574292d305a1bc1f123491c36d0 (diff) | |
| download | lasso-6f1ffb6de23ab0c05f0eb7d1b4119f73a58d8bd8.tar.gz lasso-6f1ffb6de23ab0c05f0eb7d1b4119f73a58d8bd8.tar.xz lasso-6f1ffb6de23ab0c05f0eb7d1b4119f73a58d8bd8.zip | |
add NameIdentifierMappingRequest/Response class and binding
Diffstat (limited to 'python')
| -rw-r--r-- | python/lasso.py | 65 | ||||
| -rw-r--r-- | python/lassomod.c | 11 | ||||
| -rw-r--r-- | python/protocols/py_name_identifier_mapping_request.c | 93 | ||||
| -rw-r--r-- | python/protocols/py_name_identifier_mapping_request.h | 47 | ||||
| -rw-r--r-- | python/protocols/py_name_identifier_mapping_response.c | 78 | ||||
| -rw-r--r-- | python/protocols/py_name_identifier_mapping_response.h | 41 |
6 files changed, 335 insertions, 0 deletions
diff --git a/python/lasso.py b/python/lasso.py index f6e8eeac..77d26f94 100644 --- a/python/lasso.py +++ b/python/lasso.py @@ -419,3 +419,68 @@ class FederationTerminationNotification(Node): if name == "node": ret = Node(_obj=ret) return ret + + +class NameIdentifierMappingRequest(Node): + def __init__(self, + providerID, + nameIdentifier, nameQualifier, format, + consent = None, + _obj=None): + """ + """ + if _obj != None: + self._o = _obj + return + self._o = lassomod.name_identifier_mapping_request(providerID, + nameIdentifier, nameQualifier, format) + if self._o is None: raise Error('lasso_name_identifier_mapping_request() failed') + + if consent: + lassomod.name_identifier_mapping_request_set_consent(self, consent) + + def __isprivate(self, name): + return name == '_o' + + def __getattr__(self, name): + if self.__isprivate(name): + return self.__dict__[name] + if name[:2] == "__" and name[-2:] == "__" and name != "__members__": + raise AttributeError, name + ret = lassomod.name_identifier_mapping_request_getattr(self, name) + if ret is None: + raise AttributeError, name + if name == "node": + ret = Node(_obj=ret) + return ret + +class NameIdentifierMappingResponse(Node): + def __init__(self, + providerID, + statusCodeValue, + request, + _obj=None): + """ + """ + if _obj != None: + self._o = _obj + return + self._o = lassomod.name_identifier_mapping_response(providerID, + statusCodeValue, + request) + if self._o is None: raise Error('lasso_name_identifier_mapping_response() failed') + + def __isprivate(self, name): + return name == '_o' + + def __getattr__(self, name): + if self.__isprivate(name): + return self.__dict__[name] + if name[:2] == "__" and name[-2:] == "__" and name != "__members__": + raise AttributeError, name + ret = lassomod.name_identifier_mapping_response_getattr(self, name) + if ret is None: + raise AttributeError, name + if name == "node": + ret = Node(_obj=ret) + return ret diff --git a/python/lassomod.c b/python/lassomod.c index eef24563..86d02b28 100644 --- a/python/lassomod.c +++ b/python/lassomod.c @@ -31,6 +31,8 @@ #include "protocols/py_register_name_identifier_request.h" #include "protocols/py_register_name_identifier_response.h" #include "protocols/py_federation_termination_notification.h" +#include "protocols/py_name_identifier_mapping_request.h" +#include "protocols/py_name_identifier_mapping_response.h" static PyMethodDef lasso_methods[] = { /* py_lasso.h */ @@ -96,6 +98,15 @@ static PyMethodDef lasso_methods[] = { {"federation_termination_notification", federation_termination_notification, METH_VARARGS}, {"federation_termination_notification_set_consent", federation_termination_notification_set_consent, METH_VARARGS}, + /* py_name_identifier_mapping_request.h */ + {"name_identifier_mapping_request_getattr", name_identifier_mapping_request_getattr, METH_VARARGS}, + {"name_identifier_mapping_request", name_identifier_mapping_request, METH_VARARGS}, + {"name_identifier_mapping_request_set_consent", name_identifier_mapping_request_set_consent, METH_VARARGS}, + + {"name_identifier_mapping_response_getattr", name_identifier_mapping_response_getattr, METH_VARARGS}, + {"name_identifier_mapping_response", name_identifier_mapping_response, METH_VARARGS}, + + {NULL, NULL} /* End of Methods Sentinel */ }; diff --git a/python/protocols/py_name_identifier_mapping_request.c b/python/protocols/py_name_identifier_mapping_request.c new file mode 100644 index 00000000..7b691326 --- /dev/null +++ b/python/protocols/py_name_identifier_mapping_request.c @@ -0,0 +1,93 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Author: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "../lassomod.h" + +#include "../xml/py_xml.h" +#include "py_name_identifier_mapping_request.h" + +PyObject *lassoNameIdentifierMappingRequest_wrap(LassoNameIdentifierMappingRequest *request) { + PyObject *ret; + + if (request == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyCObject_FromVoidPtrAndDesc((void *) request, + (char *) "LassoNameIdentifierMappingRequest *", NULL); + return (ret); +} + +PyObject *name_identifier_mapping_request_getattr(PyObject *self, PyObject *args) { + PyObject *request_obj; + LassoNameIdentifierMappingRequest *request; + const char *attr; + + if (CheckArgs(args, "OS:name_identifier_mapping_request_get_attr")) { + if (!PyArg_ParseTuple(args, "Os:name_identifier_mapping_request_get_attr", &request_obj, &attr)) + return NULL; + } + else return NULL; + + request = lassoNameIdentifierMappingRequest_get(request_obj); + + Py_INCREF(Py_None); + return (Py_None); +} + +PyObject *name_identifier_mapping_request(PyObject *self, PyObject *args) { + const xmlChar *providerID; + const xmlChar *nameIdentifier; + const xmlChar *nameQualifier; + const xmlChar *format; + + LassoNameIdentifierMappingRequest *request; + + if(!PyArg_ParseTuple(args, (char *) "ssss:name_identifier_mapping_request", + &providerID, + &nameIdentifier, &nameQualifier, &format)) + return NULL; + + request = (LassoNameIdentifierMappingRequest *)lasso_name_identifier_mapping_request_new(providerID, + nameIdentifier, + nameQualifier, + format); + + return (lassoNameIdentifierMappingRequest_wrap(request)); +} + +PyObject *name_identifier_mapping_request_set_consent(PyObject *self, PyObject *args){ + PyObject *request_obj; + const xmlChar *consent; + + if(!PyArg_ParseTuple(args, (char *) "Os:name_identifier_mapping_request_set_consent", + &request_obj, &consent)) + return NULL; + + lasso_lib_name_identifier_mapping_request_set_consent(lassoNameIdentifierMappingRequest_get(request_obj), + consent); + + return (int_wrap(1)); +} diff --git a/python/protocols/py_name_identifier_mapping_request.h b/python/protocols/py_name_identifier_mapping_request.h new file mode 100644 index 00000000..fca869ca --- /dev/null +++ b/python/protocols/py_name_identifier_mapping_request.h @@ -0,0 +1,47 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Author: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PYLASSO_PY_NAME_IDENTIFIER_MAPPING_REQUEST_H__ +#define __PYLASSO_PY_NAME_IDENTIFIER_MAPPING_REQUEST_H__ + +#include <lasso/protocols/name_identifier_mapping_request.h> +#include <lasso/xml/lib_name_identifier_mapping_request.h> + +typedef struct { + PyObject_HEAD + LassoNameIdentifierMappingRequest *obj; +} LassoNameIdentifierMappingRequest_object; + +#define lassoNameIdentifierMappingRequest_get(v) (((v) == Py_None) ? NULL : (((LassoNameIdentifierMappingRequest_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) +PyObject *lassoNameIdentifierMappingRequest_wrap(LassoNameIdentifierMappingRequest *request); + +PyObject *name_identifier_mapping_request_getattr(PyObject *self, PyObject *args); +PyObject *name_identifier_mapping_request(PyObject *self, PyObject *args); + +PyObject *name_identifier_mapping_request_set_sessionIndex(PyObject *self, PyObject *args); +PyObject *name_identifier_mapping_request_set_relayState(PyObject *self, PyObject *args); +PyObject *name_identifier_mapping_request_set_consent(PyObject *self, PyObject *args); + +#endif /* __PYLASSO_PY_NAME_IDENTIFIER_MAPPING_REQUEST_H__ */ diff --git a/python/protocols/py_name_identifier_mapping_response.c b/python/protocols/py_name_identifier_mapping_response.c new file mode 100644 index 00000000..76a2cd40 --- /dev/null +++ b/python/protocols/py_name_identifier_mapping_response.c @@ -0,0 +1,78 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Author: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "../lassomod.h" + +#include "../xml/py_xml.h" +#include "py_name_identifier_mapping_request.h" +#include "py_name_identifier_mapping_response.h" + +PyObject *lassoNameIdentifierMappingResponse_wrap(LassoNameIdentifierMappingResponse *response) { + PyObject *ret; + + if (response == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyCObject_FromVoidPtrAndDesc((void *) response, + (char *) "LassoNameIdentifierMappingResponse *", NULL); + return (ret); +} + +PyObject *name_identifier_mapping_response_getattr(PyObject *self, PyObject *args) { + PyObject *response_obj; + LassoNameIdentifierMappingResponse *response; + const char *attr; + + if (CheckArgs(args, "OS:name_identifier_mapping_response_get_attr")) { + if (!PyArg_ParseTuple(args, "Os:name_identifier_mapping_response_get_attr", &response_obj, &attr)) + return NULL; + } + else return NULL; + + response = lassoNameIdentifierMappingResponse_get(response_obj); + + Py_INCREF(Py_None); + return (Py_None); +} + +PyObject *name_identifier_mapping_response(PyObject *self, PyObject *args) { + const xmlChar *providerID; + const xmlChar *statusCodeValue; + PyObject *request_obj; + + LassoNameIdentifierMappingResponse *response; + + if(!PyArg_ParseTuple(args, (char *) "ssO:name_identifier_mapping_response", + &providerID, + &statusCodeValue, &request_obj)) + return NULL; + + response = (LassoNameIdentifierMappingResponse *)lasso_name_identifier_mapping_response_new(providerID, + statusCodeValue, + lassoNameIdentifierMappingRequest_get(request_obj)); + + return (lassoNameIdentifierMappingResponse_wrap(response)); +} diff --git a/python/protocols/py_name_identifier_mapping_response.h b/python/protocols/py_name_identifier_mapping_response.h new file mode 100644 index 00000000..cdf1bb59 --- /dev/null +++ b/python/protocols/py_name_identifier_mapping_response.h @@ -0,0 +1,41 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Author: Valery Febvre <vfebvre@easter-eggs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PYLASSO_PY_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ +#define __PYLASSO_PY_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ + +#include <lasso/protocols/name_identifier_mapping_response.h> + +typedef struct { + PyObject_HEAD + LassoNameIdentifierMappingResponse *obj; +} LassoNameIdentifierMappingResponse_object; + +#define lassoNameIdentifierMappingResponse_get(v) (((v) == Py_None) ? NULL : (((LassoNameIdentifierMappingResponse_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) +PyObject *lassoNameIdentifierMappingResponse_wrap(LassoNameIdentifierMappingResponse *response); + +PyObject *name_identifier_mapping_response_getattr(PyObject *self, PyObject *args); +PyObject *name_identifier_mapping_response(PyObject *self, PyObject *args); + +#endif /* __PYLASSO_PY_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ */ |
