diff options
| author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-07-09 16:07:36 +0000 |
|---|---|---|
| committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-07-09 16:07:36 +0000 |
| commit | 425c710ee7d7cfbbb496909b24ce038c2f6768b8 (patch) | |
| tree | 237b350fad8d6b14679906e198a0080f1e13cb0f /python/environs | |
| parent | 32b13e03dce0109b3445fda6b8d895a053353b6b (diff) | |
| download | lasso-425c710ee7d7cfbbb496909b24ce038c2f6768b8.tar.gz lasso-425c710ee7d7cfbbb496909b24ce038c2f6768b8.tar.xz lasso-425c710ee7d7cfbbb496909b24ce038c2f6768b8.zip | |
*** empty log message ***
Diffstat (limited to 'python/environs')
| -rw-r--r-- | python/environs/py_login.c | 112 | ||||
| -rw-r--r-- | python/environs/py_login.h | 46 | ||||
| -rw-r--r-- | python/environs/py_user.c | 61 | ||||
| -rw-r--r-- | python/environs/py_user.h | 42 |
4 files changed, 261 insertions, 0 deletions
diff --git a/python/environs/py_login.c b/python/environs/py_login.c new file mode 100644 index 00000000..91649aea --- /dev/null +++ b/python/environs/py_login.c @@ -0,0 +1,112 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Authors: 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 "py_login.h" + +PyObject *LassoLogin_wrap(LassoLogin *login) { + PyObject *ret; + + if (login == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyCObject_FromVoidPtrAndDesc((void *) login, + (char *) "LassoLogin *", NULL); + return (ret); +} + +/******************************************************************************/ + +PyObject *login_new(PyObject *self, PyObject *args) { + PyObject *server_obj, *user_obj; + LassoLogin *login; + LassoServer *server; + LassoUser *user = NULL; + + if (CheckArgs(args, "Oo:login_new")) { + if(!PyArg_ParseTuple(args, (char *) "O|O:login_new", &server_obj, &user_obj)) + return NULL; + } + else return NULL; + + server = LassoServer_get(server_obj); + if (user_obj != Py_None) { + user = LassoUser_get(user_obj); + } + login = LASSO_LOGIN(lasso_login_new(server, user)); + + return (LassoLogin_wrap(login)); +} + +PyObject *login_new_from_dump(PyObject *self, PyObject *args) { + PyObject *server_obj, *user_obj; + LassoLogin *login; + LassoServer *server; + LassoUser *user = NULL; + gchar *dump; + + if (CheckArgs(args, "OoS:login_new_from_dump")) { + if(!PyArg_ParseTuple(args, (char *) "O|Os:login_new_from_dump", &server_obj, + &user_obj, &dump)) + return NULL; + } + else return NULL; + + server = LassoServer_get(server_obj); + if (user_obj != Py_None) { + user = LassoUser_get(user_obj); + } + login = LASSO_LOGIN(lasso_login_new_from_dump(server, user, dump)); + + return (LassoLogin_wrap(login)); +} + +PyObject *login_build_artifact_msg(PyObject *self, PyObject *args) { + PyObject *login_obj; + gint authentication_result; + const gchar *authenticationMethod; + const gchar *reauthenticateOnOrAfter; + lassoHttpMethods method; + gint ret; + + if (CheckArgs(args, "OISSI:login_build_artifact_msg")) { + if(!PyArg_ParseTuple(args, (char *) "Oissi:login_build_artifact_msg", + &login_obj, &authentication_result, + &authenticationMethod, &reauthenticateOnOrAfter, + &method)) + return NULL; + } + else return NULL; + + ret = lasso_login_build_artifact_msg(LassoLogin_get(login_obj), + authentication_result, + authenticationMethod, + reauthenticateOnOrAfter, + method); + + return (int_wrap(ret)); +} diff --git a/python/environs/py_login.h b/python/environs/py_login.h new file mode 100644 index 00000000..d6ff0fb3 --- /dev/null +++ b/python/environs/py_login.h @@ -0,0 +1,46 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Authors: 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_LOGIN_H__ +#define __PYLASSO_PY_LOGIN_H__ + +#include <lasso/environs/login.h> + +#include "py_server.h" +#include "py_user.h" + +typedef struct { + PyObject_HEAD + LassoLogin *obj; +} LassoLogin_object; + +#define LassoLogin_get(v) (((v) == Py_None) ? NULL : (((LassoLogin_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) +PyObject *LassoLogin_wrap(LassoLogin *login); + +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); + +#endif /* __PYLASSO_PY_LOGIN_H__ */ diff --git a/python/environs/py_user.c b/python/environs/py_user.c new file mode 100644 index 00000000..0d359d8c --- /dev/null +++ b/python/environs/py_user.c @@ -0,0 +1,61 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Authors: 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 "py_user.h" + +PyObject *LassoUser_wrap(LassoUser *user) { + PyObject *ret; + + if (user == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyCObject_FromVoidPtrAndDesc((void *) user, + (char *) "LassoUser *", NULL); + return (ret); +} + +/******************************************************************************/ + +PyObject *user_new(PyObject *self, PyObject *args) { + return (LassoUser_wrap(lasso_user_new())); +} + +PyObject *user_new_from_dump(PyObject *self, PyObject *args) { + LassoUser *user; + gchar *dump; + + if (CheckArgs(args, "S:user_new_from_dump")) { + if(!PyArg_ParseTuple(args, (char *) "s:user_new_from_dump", &dump)) + return NULL; + } + else return NULL; + + user = lasso_user_new_from_dump(dump); + + return (LassoUser_wrap(user)); +} diff --git a/python/environs/py_user.h b/python/environs/py_user.h new file mode 100644 index 00000000..21543209 --- /dev/null +++ b/python/environs/py_user.h @@ -0,0 +1,42 @@ +/* $Id$ + * + * PyLasso -- Python bindings for Lasso library + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.labs.libre-entreprise.org + * + * Authors: 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_USER_H__ +#define __PYLASSO_PY_USER_H__ + +#include <lasso/environs/user.h> + +typedef struct { + PyObject_HEAD + LassoUser *obj; +} LassoUser_object; + +#define LassoUser_get(v) (((v) == Py_None) ? NULL : (((LassoUser_object *)(PyObject_GetAttr(v, PyString_FromString("_o"))))->obj)) +PyObject *LassoUser_wrap(LassoUser *user); + +PyObject *user_new(PyObject *self, PyObject *args); +PyObject *user_new_from_dump(PyObject *self, PyObject *args); + +#endif /* __PYLASSO_PY_USER_H__ */ |
