diff options
author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-29 01:46:33 +0000 |
---|---|---|
committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-04-29 01:46:33 +0000 |
commit | 03c0b215c6f8b5fc7f724498c7fb5f81987cdd01 (patch) | |
tree | 3c254ae9e405bb666791da37018f97b4ec40cc80 /python/protocols/py_authn_request.c | |
parent | 6dfee05214d86dc3081d2b0d6f3f1caa4e421dec (diff) | |
download | lasso-03c0b215c6f8b5fc7f724498c7fb5f81987cdd01.tar.gz lasso-03c0b215c6f8b5fc7f724498c7fb5f81987cdd01.tar.xz lasso-03c0b215c6f8b5fc7f724498c7fb5f81987cdd01.zip |
Initial commit
Diffstat (limited to 'python/protocols/py_authn_request.c')
-rw-r--r-- | python/protocols/py_authn_request.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/python/protocols/py_authn_request.c b/python/protocols/py_authn_request.c new file mode 100644 index 00000000..d0b197f6 --- /dev/null +++ b/python/protocols/py_authn_request.c @@ -0,0 +1,100 @@ +/* $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 + */ + +#include "../lassomod.h" + +#include "../xml/py_xml.h" +#include "py_authn_request.h" + +/******************************************************************************/ +/* LassoAuthnRequest */ +/******************************************************************************/ + +PyObject *LassoAuthnRequest_wrap(LassoAuthnRequest *request) { + PyObject *ret; + + if (request == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyCObject_FromVoidPtrAndDesc((void *) request, + (char *) "LassoAuthnRequest *", NULL); + return (ret); +} + +/******************************************************************************/ + +PyObject *authn_request_new(PyObject *self, PyObject *args) { + const xmlChar *providerID; + LassoNode *request; + + if(!PyArg_ParseTuple(args, (char *) "s:authn_request_new", &providerID)) + return NULL; + + request = lasso_authn_request_new(providerID); + + return (LassoAuthnRequest_wrap(LASSO_AUTHN_REQUEST(request))); +} + +PyObject *authn_request_set_requestAuthnContext(PyObject *self, PyObject *args) { + PyObject *request_obj, *authnContextClassRefs_obj; + PyObject *authnContextStatementRefs_obj; + GPtrArray *authnContextClassRefs = NULL; + GPtrArray *authnContextStatementRefs = NULL; + const xmlChar *authnContextComparison = NULL; + + if(!PyArg_ParseTuple(args, (char *) "O|O|Oz:authn_request_set_requestAuthnContext", + &request_obj, &authnContextClassRefs_obj, + &authnContextStatementRefs_obj, &authnContextComparison)) + return NULL; + + if (authnContextClassRefs_obj != Py_None) { + authnContextClassRefs = PythonStringList2_get(authnContextClassRefs_obj); + } + if (authnContextStatementRefs_obj != Py_None) { + authnContextStatementRefs = PythonStringList2_get(authnContextStatementRefs_obj); + } + + lasso_authn_request_set_requestAuthnContext(LassoAuthnRequest_get(request_obj), + authnContextClassRefs, + authnContextStatementRefs, + authnContextComparison); + Py_INCREF(Py_None); + return (Py_None); +} + +PyObject *authn_request_set_scoping(PyObject *self, PyObject *args) { + PyObject *request_obj; + gint proxyCount; + + if(!PyArg_ParseTuple(args, (char *) "Oi:authn_request_set_scoping", + &request_obj, &proxyCount)) + return NULL; + + lasso_authn_request_set_scoping(LassoAuthnRequest_get(request_obj), + proxyCount); + + Py_INCREF(Py_None); + return (Py_None); +} |