diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-25 23:47:46 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-25 23:47:46 +0000 |
| commit | 641a6af75a8e0befddc5414065042bd71c9a97ad (patch) | |
| tree | 8084096b08577886b87dab70e57be6217ec005d4 /php | |
| parent | bec8672cc57d9afa3da88aa7bf0e251d3b274b5c (diff) | |
| download | lasso-641a6af75a8e0befddc5414065042bd71c9a97ad.tar.gz lasso-641a6af75a8e0befddc5414065042bd71c9a97ad.tar.xz lasso-641a6af75a8e0befddc5414065042bd71c9a97ad.zip | |
Bindings: remove all SWIG bindings and SWIG related files
Diffstat (limited to 'php')
| -rw-r--r-- | php/.cvsignore | 10 | ||||
| -rw-r--r-- | php/Makefile.am | 26 | ||||
| -rwxr-xr-x | php/patch_swig_output.py | 285 | ||||
| -rw-r--r-- | php/tests/.cvsignore | 3 | ||||
| -rwxr-xr-x | php/tests/binding_tests.php | 309 | ||||
| -rwxr-xr-x | php/tests/perfs.php | 94 |
6 files changed, 0 insertions, 727 deletions
diff --git a/php/.cvsignore b/php/.cvsignore deleted file mode 100644 index e363e606..00000000 --- a/php/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -lasso.la -lasso.php -lasso_la-lasso_wrap.lo -lasso_wrap.c -php_lasso.h -run-tests.php diff --git a/php/Makefile.am b/php/Makefile.am deleted file mode 100644 index ba2c6145..00000000 --- a/php/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -SWIG_OUTPUTS = lasso_wrap.c php_lasso.h lasso.php - -php_extension_LTLIBRARIES = lasso.la -lasso_la_CFLAGS = $(LASSO_CORE_CFLAGS) -I$(top_builddir) -I$(top_srcdir) $(PHP4_INCLUDES) -lasso_la_LDFLAGS = -export-dynamic -prefer-pic -module -avoid-version -lasso_la_LIBADD = $(top_builddir)/lasso/liblasso.la $(LASSO_LIBS) $(PHP4_LDFLAGS) -lasso_la_SOURCES = lasso_wrap.c - -php_extensiondir = ${prefix}@PHP4_UNPREFIXED_EXTENSION_DIR@ - -SWIG_I_FILES=$(shell find $(top_srcdir)/swig/ -name '*.[ih]') -lasso_wrap.c php_lasso.h lasso.php: $(SWIG_I_FILES) - $(SWIG) -I$(top_builddir)/swig -v -php4 -module lasso -o lasso_wrap.c $(top_srcdir)/swig/Lasso.i - cp lasso_wrap.c lasso_wrap.c.bak - test x"$(SWIG)" = xecho || \ - $(PYTHON) $(srcdir)/patch_swig_output.py $(SWIG_VERSION) < lasso_wrap.c.bak > lasso_wrap.c - -test-php: lasso.la lasso.php - $(PHP4) -d extension_dir=.libs $(srcdir)/lasso.php - -MAINTAINERCLEANFILES = Makefile.in $(SWIG_OUTPUTS) -EXTRA_DIST = patch_swig_output.py $(SWIG_OUTPUTS) - -clean-local: - rm -f lasso_wrap.c.bak - diff --git a/php/patch_swig_output.py b/php/patch_swig_output.py deleted file mode 100755 index cb1ded12..00000000 --- a/php/patch_swig_output.py +++ /dev/null @@ -1,285 +0,0 @@ -#! /usr/bin/env python -# -*- coding: UTF-8 -*- -# -# $Id$ -# -# SWIG based PHP binding for Lasso Library -# -# Copyright (C) 2004-2007 Entr'ouvert -# http://lasso.entrouvert.org -# -# Authors: See AUTHORS file in top-level directory. -# -# 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 - - -"""Correct SWIG output for PHP binding. - -The PHP binding of SWIG version 1.3.22 has several bugs: - -(1) It wraps NULL pointers into non NULL PHP objects. - -(2) It doesn't handle dynamic cast of function results well: After the C object is dynamically - casted, it creates a statically casted PHP object. - -(3) It handles badly optional arguments of methods. - -This program corrects (1) and (2), by replacing things like: - if (!result) { - ZVAL_NULL(return_value); - } else { - swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_LassoXXX, (void **) &result); - SWIG_SetPointerZval(return_value, (void *)result, ty, 1); - } - - /* Wrap this return value */ - if (this_ptr) { - /* NATIVE Constructor, use this_ptr */ - zval *_cPtr; MAKE_STD_ZVAL(_cPtr); - *_cPtr = *return_value; - INIT_ZVAL(*return_value); - add_property_zval(this_ptr,"_cPtr",_cPtr); - } else if (! this_ptr) { - /* ALTERNATIVE Constructor, make an object wrapper */ - zval *obj, *_cPtr; - MAKE_STD_ZVAL(obj); - MAKE_STD_ZVAL(_cPtr); - *_cPtr = *return_value; - INIT_ZVAL(*return_value); - object_init_ex(obj,ptr_ce_swig_LassoXXX); - add_property_zval(obj,"_cPtr",_cPtr); - *return_value=*obj; - } -with: - if (!result) { - ZVAL_NULL(return_value); - } else { - swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_LassoXXX, (void **) &result); - SWIG_SetPointerZval(return_value, (void *)result, ty, 1); - /* Wrap this return value */ - if (this_ptr) { - /* NATIVE Constructor, use this_ptr */ - zval *_cPtr; MAKE_STD_ZVAL(_cPtr); - *_cPtr = *return_value; - INIT_ZVAL(*return_value); - add_property_zval(this_ptr,"_cPtr",_cPtr); - } else if (! this_ptr) { - /* ALTERNATIVE Constructor, make an object wrapper */ - zval *obj, *_cPtr; - MAKE_STD_ZVAL(obj); - MAKE_STD_ZVAL(_cPtr); - *_cPtr = *return_value; - INIT_ZVAL(*return_value); - object_init_ex(obj,get_node_info_with_swig(ty)->php); - add_property_zval(obj,"_cPtr",_cPtr); - *return_value=*obj; - }} -and - if (!result) { - ZVAL_NULL(return_value); - } else { - swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_LassoXXX, (void **) &result); - SWIG_SetPointerZval(return_value, (void *)result, ty, 0); - } - - /* Wrap this return value */ - { - /* ALTERNATIVE Constructor, make an object wrapper */ - zval *obj, *_cPtr; - MAKE_STD_ZVAL(obj); - MAKE_STD_ZVAL(_cPtr); - *_cPtr = *return_value; - INIT_ZVAL(*return_value); - object_init_ex(obj,ptr_ce_swig_LassoXXX); - add_property_zval(obj,"_cPtr",_cPtr); - *return_value=*obj; - } -with: - if (!result) { - ZVAL_NULL(return_value); - } else { - swig_type_info *ty = SWIG_TypeDynamicCast(SWIGTYPE_p_LassoXXX, (void **) &result); - SWIG_SetPointerZval(return_value, (void *)result, ty, 0); - /* Wrap this return value */ - { - /* ALTERNATIVE Constructor, make an object wrapper */ - zval *obj, *_cPtr; - MAKE_STD_ZVAL(obj); - MAKE_STD_ZVAL(_cPtr); - *_cPtr = *return_value; - INIT_ZVAL(*return_value); - object_init_ex(obj,get_node_info_with_swig(ty)->php); - add_property_zval(obj,"_cPtr",_cPtr); - *return_value=*obj; - }} - -In old SWIG versions, this program corrects (3), by replacing things like: - if(zend_get_parameters_array_ex(arg_count-argbase,args)!=SUCCESS) -with: - if(zend_get_parameters_array_ex(arg_count,args)!=SUCCESS) -and by replacing: - if(arg_count > 1) { -with: - if(arg_count > 1 - argbase) { - -In newer SWIG versions, this program corrects (3), by replacing code like: - if(arg_count<2 || arg_count>4) -with: - if(arg_count<1 || arg_count>3) -whenever the function uses a this_ptr. -""" - -import re -import sys - -wrap = sys.stdin.read() -swig_version = sys.argv[1] -major, minor, release = re.match('(.*)\.(.*)\.(.*)', swig_version).groups() -major = int(major) -minor = int(minor) -release = int(release) -if major < 1 or (major == 1 and (minor < 3 or (minor == 3 and release < 32))): -# (1) - begin = """ - } - - /* Wrap this return value */ -""" - end = """ - *return_value=*obj; - } -""" - i = wrap.find(begin) - while i >= 0: - j = wrap.find(end, i) + len(end) - segment = wrap[i:j] - segment = segment.replace(begin, """ - /* Wrap this return value */ -""") - segment = segment.replace(end, """ - *return_value=*obj; - }} -""") - wrap = '%s%s%s' % (wrap[:i], segment, wrap[j:]) - i = wrap.find(begin, i + len(segment)) - -# (2) - begin = 'swig_type_info *ty = SWIG_TypeDynamicCast(' - end = """ - *return_value=*obj; - }} -""" - i = wrap.find(begin) - while i >= 0: - j = wrap.find(end, i) + len(end) - #print >> sys.stderr, "END:", j, len(end) - if j < len(end): # bails out if not found - break - segment = wrap[i:j] - x = segment.find('object_init_ex(obj,') + len('object_init_ex(obj,') - y = segment.find(')', x) - segment = '%s%s%s' % (segment[:x], 'get_node_info_with_swig(ty)->php', segment[y:]) - wrap = '%s%s%s' % (wrap[:i], segment, wrap[j:]) - i = wrap.find(begin, i + len(segment)) - -# (3) - wrap = wrap.replace('if(zend_get_parameters_array_ex(arg_count-argbase,args)!=SUCCESS)', - 'if(zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)') - - - function_pattern = re.compile('ZEND_NAMED_FUNCTION(.*?)\n}', re.DOTALL) - argcount_less_pattern = re.compile('if\(arg_count<(\d) \|\| arg_count>(\d)') - argcount_more_pattern = re.compile('if\(arg_count > (\d)\)') - - - def rep2(match): - arg1 = int(match.group(1)) - 1 - arg2 = int(match.group(2)) - 1 - return 'if(arg_count<%s || arg_count>%s' % (arg1, arg2) - - def rep3(match): - arg1 = int(match.group(1)) - 1 - return 'if(arg_count > %s)' % arg1 - - def rep(match): - m = match.group(0) - if not 'This function uses a this_ptr' in m: - return m - if not 'arg_count<' in m: - return m - lines = match.group(0).splitlines() - s = [] - for l in lines: - if l.startswith('if(arg_count<'): - l = argcount_less_pattern.sub(rep2, l) - elif l.startswith(' if(arg_count >'): - l = argcount_more_pattern.sub(rep3, l) - s.append(l) - - return ''.join(s) - - wrap = function_pattern.sub(rep, wrap) - - wrap = re.sub(r'zend_register_internal_class_ex(.*)NULL,NULL\)', - r'zend_register_internal_class_ex\1NULL,NULL TSRMLS_CC)', wrap) - - wrap = re.sub('zend_rsrc_list_get_rsrc_type(.*)lval *\)', - r'zend_rsrc_list_get_rsrc_type\1lval TSRMLS_CC)', wrap) -else: -# Bis for swig 1.3.33 -# (1) - begin = """ - } - - { - /* Wrap this return value */ -""" - end = """ - } -""" - i = wrap.find(begin) - while i >= 0: - j = wrap.find(end, i+len(begin)) + len(end) - segment = wrap[i:j] - segment = segment.replace(begin, """ - /* Wrap this return value */ -""") - segment = segment.replace(end, """ - } -""") - wrap = '%s%s%s' % (wrap[:i], segment, wrap[j:]) - i = wrap.find(begin, i + len(segment)) -# (2) - begin = 'swig_type_info *ty = SWIG_TypeDynamicCast(' - end = """ - } -""" - i = wrap.find(begin) - while i >= 0: - j = wrap.find(end, i+len(begin)) + len(end) - if j < len(end): # bails out if not found - i = wrap.find(begin, i + len(segment)) - break - segment = wrap[i:j] - if not 'object_init_ex' in segment: - i = wrap.find(begin, i + len(segment)) - continue - x = segment.find('object_init_ex(return_value,') + len('object_init_ex(return_value,') - y = segment.find(')', x) - segment = '%s%s%s' % (segment[:x], 'get_node_info_with_swig(ty)->php', segment[y:]) - wrap = '%s%s%s' % (wrap[:i], segment, wrap[j:]) - i = wrap.find(begin, i + len(segment)) - -print wrap diff --git a/php/tests/.cvsignore b/php/tests/.cvsignore deleted file mode 100644 index 22a4e729..00000000 --- a/php/tests/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in - diff --git a/php/tests/binding_tests.php b/php/tests/binding_tests.php deleted file mode 100755 index 5fba6d11..00000000 --- a/php/tests/binding_tests.php +++ /dev/null @@ -1,309 +0,0 @@ -#! /usr/bin/env php -<?php -# $Id$ -# -# PHP unit tests for Lasso library -# -# Copyright (C) 2004-2007 Entr'ouvert -# http://lasso.entrouvert.org -# -# Authors: See AUTHORS file in top-level directory. -# -# 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 - - -$ret = @dl('lasso.' . PHP_SHLIB_SUFFIX); -if ($ret == FALSE) { - print "lasso not found\n"; - exit(1); -} - -function test01() -{ - print "Create and delete nodes."; - - $authnRequest = new LassoLibAuthnRequest(); - $authnRequest = NULL; - - print ".. OK\n"; -} - -function test02() -{ - print "Get & set simple attributes of nodes."; - - $authnRequest = new LassoLibAuthnRequest(); - - # Test a string attribute. - assert($authnRequest->consent == NULL); - $authnRequest->consent = LassoLibConsentObtained; - assert($authnRequest->consent == LassoLibConsentObtained); - $authnRequest->consent = NULL; - assert($authnRequest->consent == NULL); - - # Test a renamed string attribute. But renaming doesn't work with current SWIG PHP binding. - assert($authnRequest->RelayState == NULL); - $authnRequest->RelayState = 'Hello World!'; - assert($authnRequest->RelayState == 'Hello World!'); - $authnRequest->RelayState = NULL; - assert($authnRequest->RelayState == NULL); - - # Test an integer attribute. - assert($authnRequest->majorVersion == 0); - $authnRequest->majorVersion = 314; - assert($authnRequest->majorVersion == 314); - - $authnRequest = NULL; - - print ".. OK\n"; -} - -function test03() -{ - print "Get & set attributes of nodes of type string list."; - - $authnRequest = new LassoLibAuthnRequest(); - - assert($authnRequest->respondWith == NULL); - - $respondWith = new LassoStringList(); - assert($respondWith->length() == 0); - $respondWith->append('first string'); - assert($respondWith->length() == 1); - assert($respondWith->getItem(0) == 'first string'); - assert($respondWith->getItem(0) == 'first string'); - $respondWith->append('second string'); - assert($respondWith->length() == 2); - assert($respondWith->getItem(0) == 'first string'); - assert($respondWith->getItem(1) == 'second string'); - $respondWith->append('third string'); - assert($respondWith->length() == 3); - assert($respondWith->getItem(0) == 'first string'); - assert($respondWith->getItem(1) == 'second string'); - assert($respondWith->getItem(2) == 'third string'); - $authnRequest->RespondWith = $respondWith; - # $authnRequest->RespondWith->getItem(0) doesnt work. It raises: - # Fatal error: Class 'lassolibauthnrequest' does not support overloaded method calls - $authnRequestRespondWith = $authnRequest->RespondWith; - assert($authnRequestRespondWith->getItem(0) == 'first string'); - assert($authnRequestRespondWith->getItem(1) == 'second string'); - assert($authnRequestRespondWith->getItem(2) == 'third string'); - assert($respondWith->getItem(0) == 'first string'); - assert($respondWith->getItem(1) == 'second string'); - assert($respondWith->getItem(2) == 'third string'); - $respondWith = NULL; - assert($authnRequestRespondWith->getItem(0) == 'first string'); - assert($authnRequestRespondWith->getItem(1) == 'second string'); - assert($authnRequestRespondWith->getItem(2) == 'third string'); - $respondWith = $authnRequest->RespondWith; - assert($respondWith->getItem(0) == 'first string'); - assert($respondWith->getItem(1) == 'second string'); - assert($respondWith->getItem(2) == 'third string'); - $respondWith = NULL; - assert($authnRequestRespondWith->getItem(0) == 'first string'); - assert($authnRequestRespondWith->getItem(1) == 'second string'); - assert($authnRequestRespondWith->getItem(2) == 'third string'); - $authnRequestRespondWith = NULL; - $authnRequest->RespondWith = NULL; - print_r($authnRequest->RespondWith); - assert($authnRequest->RespondWith == NULL); - - $authnRequest = NULL; - - print ".. OK\n"; -} - -function test04() -{ - print "Get & set attributes of nodes of type node list."; - - $response = new LassoSamlpResponse(); - - assert($response->assertion == NULL); - - $assertions = new LassoNodeList(); - assert($assertions->length() == 0); - $assertion1 = new LassoSamlAssertion(); - $assertion1->AssertionID = 'assertion 1'; - $assertions->append($assertion1); - assert($assertions->length() == 1); - $assertionsItem0 = $assertions->getItem(0); - assert($assertionsItem0->AssertionID == 'assertion 1'); - $assertionsItem0 = $assertions->getItem(0); - assert($assertionsItem0->AssertionID == 'assertion 1'); - $assertion2 = new LassoSamlAssertion(); - $assertion2->AssertionID = 'assertion 2'; - $assertions->append($assertion2); - assert($assertions->length() == 2); - $assertionsItem0 = $assertions->getItem(0); - assert($assertionsItem0->AssertionID == 'assertion 1'); - $assertionsItem1 = $assertions->getItem(1); - assert($assertionsItem1->AssertionID == 'assertion 2'); - $assertion3 = new LassoSamlAssertion(); - $assertion3->AssertionID = 'assertion 3'; - $assertions->append($assertion3); - assert($assertions->length() == 3); - $assertionsItem0 = $assertions->getItem(0); - assert($assertionsItem0->AssertionID == 'assertion 1'); - $assertionsItem1 = $assertions->getItem(1); - assert($assertionsItem1->AssertionID == 'assertion 2'); - $assertionsItem2 = $assertions->getItem(2); - assert($assertionsItem2->AssertionID == 'assertion 3'); - $response->assertion = $assertions; - $responseAssertion = $response->assertion; - $responseAssertionItem0 = $responseAssertion->getItem(0); - assert($responseAssertionItem0->AssertionID == 'assertion 1'); - $responseAssertion = $response->assertion; - $responseAssertionItem1 = $responseAssertion->getItem(1); - assert($responseAssertionItem1->AssertionID == 'assertion 2'); - $responseAssertion = $response->assertion; - $responseAssertionItem2 = $responseAssertion->getItem(2); - assert($responseAssertionItem2->AssertionID == 'assertion 3'); - $assertionsItem0 = $assertions->getItem(0); - assert($assertionsItem0->AssertionID == 'assertion 1'); - $assertionsItem1 = $assertions->getItem(1); - assert($assertionsItem1->AssertionID == 'assertion 2'); - $assertionsItem2 = $assertions->getItem(2); - assert($assertionsItem2->AssertionID == 'assertion 3'); - $assertions = NULL; - $responseAssertion = $response->assertion; - $responseAssertionItem0 = $responseAssertion->getItem(0); - assert($responseAssertionItem0->AssertionID == 'assertion 1'); - $responseAssertion = $response->assertion; - $responseAssertionItem1 = $responseAssertion->getItem(1); - assert($responseAssertionItem1->AssertionID == 'assertion 2'); - $responseAssertion = $response->assertion; - $responseAssertionItem2 = $responseAssertion->getItem(2); - assert($responseAssertionItem2->AssertionID == 'assertion 3'); - $assertions = $response->assertion; - $assertionsItem0 = $assertions->getItem(0); - assert($assertionsItem0->AssertionID == 'assertion 1'); - $assertionsItem1 = $assertions->getItem(1); - assert($assertionsItem1->AssertionID == 'assertion 2'); - $assertionsItem2 = $assertions->getItem(2); - assert($assertionsItem2->AssertionID == 'assertion 3'); - $assertions = NULL; - $responseAssertion = $response->assertion; - $responseAssertionItem0 = $responseAssertion->getItem(0); - assert($responseAssertionItem0->AssertionID == 'assertion 1'); - $responseAssertion = $response->assertion; - $responseAssertionItem1 = $responseAssertion->getItem(1); - assert($responseAssertionItem1->AssertionID == 'assertion 2'); - $responseAssertion = $response->assertion; - $responseAssertionItem2 = $responseAssertion->getItem(2); - assert($responseAssertionItem2->AssertionID == 'assertion 3'); - $response->assertion = NULL; - assert($response->assertion == NULL); - - $response = NULL; - - print ".. OK\n"; -} - -function test05() -{ - print "Get & set attributes of nodes of type XML list."; - - $authnRequest = new LassoLibAuthnRequest(); - - assert($authnRequest->extension == NULL); - - $actionString1 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> - <action>do 1</action> -</lib:Extension>'; - $actionString2 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> - <action>do 2</action> -</lib:Extension>'; - $actionString3 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> - <action>do 3</action> -</lib:Extension>'; - $extension = new LassoStringList(); - assert($extension->length() == 0); - $extension->append($actionString1); - assert($extension->length() == 1); - assert($extension->getItem(0) == $actionString1); - assert($extension->getItem(0) == $actionString1); - $extension->append($actionString2); - assert($extension->length() == 2); - assert($extension->getItem(0) == $actionString1); - assert($extension->getItem(1) == $actionString2); - $extension->append($actionString3); - assert($extension->length() == 3); - assert($extension->getItem(0) == $actionString1); - assert($extension->getItem(1) == $actionString2); - assert($extension->getItem(2) == $actionString3); - $authnRequest->extension = $extension; - # $authnRequest->extension->getItem(0) doesnt work. It raises: - # Fatal error: Class 'lassolibauthnrequest' does not support overloaded method calls - $authnRequestExtension = $authnRequest->extension; - assert($authnRequestExtension->getItem(0) == $actionString1); - assert($authnRequestExtension->getItem(1) == $actionString2); - assert($authnRequestExtension->getItem(2) == $actionString3); - assert($extension->getItem(0) == $actionString1); - assert($extension->getItem(1) == $actionString2); - assert($extension->getItem(2) == $actionString3); - $extension = NULL; - assert($authnRequestExtension->getItem(0) == $actionString1); - assert($authnRequestExtension->getItem(1) == $actionString2); - assert($authnRequestExtension->getItem(2) == $actionString3); - $extension = $authnRequest->extension; - assert($extension->getItem(0) == $actionString1); - assert($extension->getItem(1) == $actionString2); - assert($extension->getItem(2) == $actionString3); - $extension = NULL; - assert($authnRequestExtension->getItem(0) == $actionString1); - assert($authnRequestExtension->getItem(1) == $actionString2); - assert($authnRequestExtension->getItem(2) == $actionString3); - $authnRequestExtension = NULL; - $authnRequest->extension = NULL; - print_r($authnRequest->Extension); - assert($authnRequest->extension == NULL); - - $authnRequest = NULL; - - print ".. OK\n"; -} - -function test06() -{ - print "Get & set attributes of nodes of type node."; - - $login = new LassoLogin(new LassoServer()); - - assert($login->request == NULL); - $login->request = new LassoLibAuthnRequest(); - $loginRequest = $login->request; - $loginRequest->consent = LassoLibConsentObtained; - assert($loginRequest->consent == LassoLibConsentObtained); - $loginRequest = $login->request; - assert($loginRequest->consent == LassoLibConsentObtained); - $login->request = NULL; - assert($login->request == NULL); - - $login = NULL; - - print ".. OK\n"; -} - -lasso_init(); -test01(); -test02(); -test03(); -test04(); -test05(); -test06(); -lasso_shutdown(); - -?> diff --git a/php/tests/perfs.php b/php/tests/perfs.php deleted file mode 100755 index 7f3994bc..00000000 --- a/php/tests/perfs.php +++ /dev/null @@ -1,94 +0,0 @@ -#! /usr/bin/env php -<?php -# -# $Id$ -# -# PHP performance tests for Lasso library -# -# Copyright (C) 2004-2007 Entr'ouvert -# http://lasso.entrouvert.org -# -# Authors: See AUTHORS file in top-level directory. -# -# 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 - -$ret = @dl('lasso.' . PHP_SHLIB_SUFFIX); -if ($ret == FALSE) { - print "lasso not found\n"; - exit(1); -} - -function create_authnresponse($query) -{ - - $server = new LassoServer( - "../../tests/data/idp1-la/metadata.xml", - "../../tests/data/idp1-la/private-key-raw.pem", - NULL, - "../../tests/data/idp1-la/certificate.pem"); - - $server->addProvider(LASSO_PROVIDER_ROLE_SP, - "../../tests/data/sp1-la/metadata.xml", - "../../tests/data/sp1-la/public-key.pem", - "../../tests/data/ca1-la/certificate.pem"); - - $login = new LassoLogin($server); - - $login->processAuthnRequestMsg(substr(strstr($query, "?"),1)); - $login->validateRequestMsg(1, 1); - $login->buildAssertion(LASSO_SAML_AUTHENTICATION_METHOD_PASSWORD, - "later", "reauthnonorafter", "notbefore", "notonorafter"); - $login->buildAuthnResponseMsg(); - - return $login->msgBody; -} - -lasso_init(); - -$server = new LassoServer( - "../../tests/data/sp1-la/metadata.xml", - "../../tests/data/sp1-la/private-key-raw.pem", - NULL, - "../../tests/data/sp1-la/certificate.pem"); - -$server->addProvider(LASSO_PROVIDER_ROLE_IDP, - "../../tests/data/idp1-la/metadata.xml", - "../../tests/data/idp1-la/public-key.pem", - "../../tests/data/ca1-la/certificate.pem"); - -$login = new LassoLogin($server); - -printf("Generating 50 AuthnRequest...\n"); -for ($i=0; $i < 50; $i++) { - $login->initAuthnRequest("https://idp1/metadata", LASSO_HTTP_METHOD_REDIRECT); - - $request = $login->request; - $request->ForceAuthn = true; - $request->IsPassive = false; - $request->NameIDPolicy = LASSO_LIB_NAMEID_POLICY_TYPE_FEDERATED; - $request->ProtocolProfile = LASSO_LIB_PROTOCOL_PROFILE_BRWS_POST; - $login->buildAuthnRequestMsg(); -} - -$query = $login->msgUrl; -$authn_response_msg = create_authnresponse($query); - -printf("Processing 50 AuthnResponse...\n"); -for ($i=0; $i < 50; $i++) { - $login->processAuthnResponseMsg($authn_response_msg); - $login->acceptSso(); -} - -?> |
