diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2005-01-08 14:01:55 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2005-01-08 14:01:55 +0000 |
commit | 3421a1f88ec972474623f24c960572ebfc0624c8 (patch) | |
tree | e1d0f336bba718a320fcf5f656c5ca6bab228c3e /php | |
parent | 1507aff943e0907f71413b0dffdd6538fa57f2fc (diff) | |
download | lasso-3421a1f88ec972474623f24c960572ebfc0624c8.tar.gz lasso-3421a1f88ec972474623f24c960572ebfc0624c8.tar.xz lasso-3421a1f88ec972474623f24c960572ebfc0624c8.zip |
port of perfs.c to PHP (it is surprisingly faster than the C version).
Diffstat (limited to 'php')
-rwxr-xr-x | php/tests/perfs.php | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/php/tests/perfs.php b/php/tests/perfs.php new file mode 100755 index 00000000..8ef834ff --- /dev/null +++ b/php/tests/perfs.php @@ -0,0 +1,74 @@ +#! /usr/bin/php +<?php + +$ret = @dl('lasso.' . PHP_SHLIB_SUFFIX); +if ($ret == FALSE) { + $ret = @dl('../.libs/lasso.' . PHP_SHLIB_SUFFIX); + if ($ret == FALSE) { + print "lasso not found\n"; + exit(); + } +} + +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->authnRequest; + $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(); +} + +?> |