summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-08-27 10:56:39 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-08-27 10:56:39 +0000
commit31aa53988b3d28ef575004985bbaf300e9dc7b0c (patch)
tree5b739dc68f2300adbd358ba36079fe9210257e34
parent740fcce66a749a8b1cf4ea86a41b98a5d89734ed (diff)
downloadlasso-31aa53988b3d28ef575004985bbaf300e9dc7b0c.tar.gz
lasso-31aa53988b3d28ef575004985bbaf300e9dc7b0c.tar.xz
lasso-31aa53988b3d28ef575004985bbaf300e9dc7b0c.zip
Removed SWIG Lasso.c file.
Added a Python test for defederation (currently it aborts).
-rw-r--r--csharp/Makefile.am3
-rw-r--r--java/Makefile.am4
-rw-r--r--python/Makefile.am3
-rw-r--r--python/tests/login_tests.py27
-rw-r--r--swig/Lasso.c75
-rw-r--r--swig/Lasso.i44
-rw-r--r--swig/Makefile.am2
7 files changed, 68 insertions, 90 deletions
diff --git a/csharp/Makefile.am b/csharp/Makefile.am
index d3d55cf8..c3292b0c 100644
--- a/csharp/Makefile.am
+++ b/csharp/Makefile.am
@@ -3,8 +3,7 @@ INCLUDES = -I$(top_srcdir)
lib_LTLIBRARIES = liblassosharpglue.la
liblassosharpglue_la_SOURCES = \
- liblassosharpglue_wrap.c \
- $(top_srcdir)/swig/Lasso.c
+ liblassosharpglue_wrap.c
liblassosharpglue_la_CFLAGS = \
$(LASSO_CFLAGS) \
diff --git a/java/Makefile.am b/java/Makefile.am
index d91df56f..b38c97ed 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -13,8 +13,8 @@ javasharedir = $(prefix)/share/java
# Shared library.
javalib_LTLIBRARIES = libjlasso.la
-libjlasso_la_SOURCES = $(JAVA_MODULE)_wrap.c \
- $(top_srcdir)/swig/Lasso.c
+libjlasso_la_SOURCES = $(JAVA_MODULE)_wrap.c
+
libjlasso_la_CFLAGS = $(JDK_INCLUDES) \
$(LASSO_CFLAGS) \
-I$(top_srcdir)
diff --git a/python/Makefile.am b/python/Makefile.am
index 6c4a5a34..7e2c55ef 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -6,8 +6,7 @@ python_LTLIBRARIES = _lassomod.la
PYTHON_PACKAGE=lassomod
-_lassomod_la_SOURCES = $(PYTHON_PACKAGE)_wrap.c \
- $(top_srcdir)/swig/Lasso.c
+_lassomod_la_SOURCES = $(PYTHON_PACKAGE)_wrap.c
_lassomod_la_CFLAGS = $(LASSO_CFLAGS) \
-DSWIG_COBJECT_TYPES \
diff --git a/python/tests/login_tests.py b/python/tests/login_tests.py
index e43db5a6..4ecb7b25 100644
--- a/python/tests/login_tests.py
+++ b/python/tests/login_tests.py
@@ -86,10 +86,35 @@ class LogoutTestCase(unittest.TestCase):
self.failIf(logout.get_next_providerID())
+class DefederationTestCase(unittest.TestCase):
+ def test01(self):
+ """IDP initiated defederation; testing process_notification_msg with non Liberty query."""
+
+ lassoServer = lasso.Server(
+ os.path.join(dataDir, 'idp1-la/metadata.xml'),
+ None, # os.path.join(dataDir, 'idp1-la/public-key.pem') is no more used
+ os.path.join(dataDir, 'idp1-la/private-key-raw.pem'),
+ os.path.join(dataDir, 'idp1-la/certificate.pem'),
+ lasso.signatureMethodRsaSha1)
+ lassoServer.add_provider(
+ os.path.join(dataDir, 'sp1-la/metadata.xml'),
+ os.path.join(dataDir, 'sp1-la/public-key.pem'),
+ os.path.join(dataDir, 'sp1-la/certificate.pem'))
+ defederation = lasso.Defederation(lassoServer, lasso.providerTypeIdp)
+ # The process_notification_msg should failt but not abort.
+ try:
+ defederation.process_notification_msg('nonLibertyQuery=1', lasso.httpMethodRedirect)
+ except lasso.Error, error:
+ pass
+ else:
+ fail('Defederation process_notification_msg should have failed.')
+
+
suite1 = unittest.makeSuite(LoginTestCase, 'test')
suite2 = unittest.makeSuite(LogoutTestCase, 'test')
+suite3 = unittest.makeSuite(DefederationTestCase, 'test')
-allTests = unittest.TestSuite((suite1, suite2))
+allTests = unittest.TestSuite((suite1, suite2, suite3))
if __name__ == '__main__':
sys.exit(not unittest.TextTestRunner(verbosity = 2).run(allTests).wasSuccessful())
diff --git a/swig/Lasso.c b/swig/Lasso.c
deleted file mode 100644
index 3ebf0666..00000000
--- a/swig/Lasso.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: c; c-basic-offset: 8 -*-
- *
- * $Id$
- *
- * SWIG bindings for Lasso Library
- *
- * Copyright (C) 2004 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Romain Chantereau <rchantereau@entrouvert.com>
- * Emmanuel Raviart <eraviart@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 <lasso/lasso_config.h>
-#include <lasso/lasso.h>
-
-
-/***********************************************************************
- ***********************************************************************
- * Profiles
- ***********************************************************************
- ***********************************************************************/
-
-
-/***********************************************************************
- * Profile
- ***********************************************************************/
-
-
-LassoAuthnRequest* lasso_profile_get_authn_request_ref(LassoProfile *profile)
-{
- if (profile->request_type == lassoMessageTypeAuthnRequest)
- return LASSO_AUTHN_REQUEST(profile->request);
- else
- return NULL;
-}
-
-LassoAuthnResponse* lasso_profile_get_authn_response_ref(LassoProfile *profile)
-{
- if (profile->response_type == lassoMessageTypeAuthnResponse)
- return LASSO_AUTHN_RESPONSE(profile->response);
- else
- return NULL;
-}
-
-LassoRequest* lasso_profile_get_request_ref(LassoProfile *profile)
-{
- if (profile->request_type == lassoMessageTypeRequest)
- return LASSO_REQUEST(profile->request);
- else
- return NULL;
-}
-
-LassoResponse* lasso_profile_get_response_ref(LassoProfile *profile)
-{
- if (profile->response_type == lassoMessageTypeResponse)
- return LASSO_RESPONSE(profile->response);
- else
- return NULL;
-}
diff --git a/swig/Lasso.i b/swig/Lasso.i
index bfa8911f..e1d8a8ab 100644
--- a/swig/Lasso.i
+++ b/swig/Lasso.i
@@ -533,19 +533,49 @@ typedef struct _LassoProfile {
lassoMessageType response_type;
} LassoProfile;
-/* Methods */
+/* Inline Methods */
+
+%inline %{
+
+LassoAuthnRequest* lasso_profile_get_authn_request_ref(LassoProfile *profile)
+{
+ if (profile->request_type == lassoMessageTypeAuthnRequest)
+ return LASSO_AUTHN_REQUEST(profile->request);
+ else
+ return NULL;
+}
+
+LassoAuthnResponse* lasso_profile_get_authn_response_ref(LassoProfile *profile)
+{
+ if (profile->response_type == lassoMessageTypeAuthnResponse)
+ return LASSO_AUTHN_RESPONSE(profile->response);
+ else
+ return NULL;
+}
+
+LassoRequest* lasso_profile_get_request_ref(LassoProfile *profile)
+{
+ if (profile->request_type == lassoMessageTypeRequest)
+ return LASSO_REQUEST(profile->request);
+ else
+ return NULL;
+}
+
+LassoResponse* lasso_profile_get_response_ref(LassoProfile *profile)
+{
+ if (profile->response_type == lassoMessageTypeResponse)
+ return LASSO_RESPONSE(profile->response);
+ else
+ return NULL;
+}
-LassoAuthnRequest* lasso_profile_get_authn_request_ref(LassoProfile *profile);
+%}
-LassoAuthnResponse* lasso_profile_get_authn_response_ref(LassoProfile *profile);
+/* Methods */
%newobject lasso_profile_get_identity;
LassoIdentity* lasso_profile_get_identity(LassoProfile *profile);
-LassoRequest* lasso_profile_get_request_ref(LassoProfile *profile);
-
-LassoResponse* lasso_profile_get_response_ref(LassoProfile *profile);
-
%newobject lasso_profile_get_session;
LassoSession* lasso_profile_get_session(LassoProfile *profile);
diff --git a/swig/Makefile.am b/swig/Makefile.am
index eaf88164..fe8669e5 100644
--- a/swig/Makefile.am
+++ b/swig/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = Lasso.i Lasso.c
+EXTRA_DIST = Lasso.i
clean-local:
rm -f Lasso.py Lasso_wrap.c