Beispiel #1
0
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";
}