function test03() { echo "Get and set a list of xmlNode*... "; $server = new LassoServer(DATA_DIR . "sp1-la/metadata.xml", DATA_DIR . "sp1-la/private-key-raw.pem", NULL, DATA_DIR . "sp1-la/certificate.pem"); $server->addProvider(LASSO_PROVIDER_ROLE_IDP, DATA_DIR . "idp1-la/metadata.xml", DATA_DIR . "idp1-la/public-key.pem", DATA_DIR . "idp1-la/certificate.pem"); $login = new LassoLogin($server); $login->initAuthnRequest(); $requestAuthnContext = new LassoLibRequestAuthnContext(); $extension1 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> <action>do</action> </lib:Extension>'; $extension2 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> <action2>do action 2</action2><action3>do action 3</action3> </lib:Extension>'; $extensionList = array($extension1, $extension2); $login->request->extension = $extensionList; assert($login->request->extension == $extensionList); assert($login->request->extension[0] == $extension1); assert($login->request->extension[1] == $extension2); echo "OK.\n"; }
function test05() { echo "Conversion of a lib:AuthnRequest with an AuthnContext into a query and back... "; $spServer = new LassoServer(DATA_DIR . "sp1-la/metadata.xml", DATA_DIR . "sp1-la/private-key-raw.pem", NULL, DATA_DIR . "sp1-la/certificate.pem"); $spServer->addProvider(LASSO_PROVIDER_ROLE_IDP, DATA_DIR . "idp1-la/metadata.xml", DATA_DIR . "idp1-la/public-key.pem", DATA_DIR . "idp1-la/certificate.pem"); $spLogin = new LassoLogin($spServer); $spLogin->initAuthnRequest(); $requestAuthnContext = new LassoLibRequestAuthnContext(); $requestAuthnContext->authnContextClassRef = array(LASSO_LIB_AUTHN_CONTEXT_CLASS_REF_PASSWORD); assert($requestAuthnContext->authnContextClassRef[0] == LASSO_LIB_AUTHN_CONTEXT_CLASS_REF_PASSWORD); $spLogin->request->requestAuthnContext = $requestAuthnContext; assert(!is_null($spLogin->request->requestAuthnContext)); $spLogin->request->protocolProfile = LASSO_LIB_PROTOCOL_PROFILE_BRWS_ART; assert($spLogin->request->protocolProfile == LASSO_LIB_PROTOCOL_PROFILE_BRWS_ART); $spLogin->buildAuthnRequestMsg(); assert(!is_null($spLogin->msgUrl)); assert($spLogin->msgUrl != ""); $idpServer = new LassoServer(DATA_DIR . "idp1-la/metadata.xml", DATA_DIR . "idp1-la/private-key-raw.pem", NULL, DATA_DIR . "idp1-la/certificate.pem"); $idpServer->addProvider(LASSO_PROVIDER_ROLE_IDP, DATA_DIR . "sp1-la/metadata.xml", DATA_DIR . "sp1-la/public-key.pem", DATA_DIR . "sp1-la/certificate.pem"); $idpLogin = new LassoLogin($idpServer); list($urlBase, $authnRequestQuery) = split("\\?", $spLogin->msgUrl, 2); assert($authnRequestQuery != ""); $idpLogin->processAuthnRequestMsg($authnRequestQuery); assert(!is_null($idpLogin->request)); assert(!is_null($idpLogin->request->requestAuthnContext)); assert($idpLogin->request->requestAuthnContext != ""); assert(sizeof($idpLogin->request->requestAuthnContext->authnContextClassRef) == 1); assert($idpLogin->request->requestAuthnContext->authnContextClassRef[0] == LASSO_LIB_AUTHN_CONTEXT_CLASS_REF_PASSWORD); echo "OK.\n"; }