Example #1
0
 /**
  * 3D SECURE CALL STEP 2.
  * Verify the 3D secure results from the data posted by the users banks 3d page
  */
 public static function authenticate($connection)
 {
     // Gather and filter post data
     $TransactionId = isset($_POST['MD']) ? filter_var($_POST['MD'], FILTER_SANITIZE_STRING) : null;
     $PAResPayload = isset($_POST['PaRes']) ? filter_var($_POST['PaRes'], FILTER_SANITIZE_STRING) : null;
     // Call
     $client = new \SoapClient($connection->urls['3d']);
     // Execute
     $request = $client->authenticate($TransactionId, $PAResPayload);
     // Regardless of the result, an authorisation should occur at this stage.
     return $TransactionId;
 }
Example #2
0
//on envoie la date
//le array Security va contenir UsernameToken
$Security = array();
$Security["UsernameToken"] = new SoapVar($UsernameToken, SOAP_ENC_OBJECT, NULL, $wsse, "UsernameToken", $wsse);
$Security = new SoapVar($Security, SOAP_ENC_OBJECT, NULL, $wsse, "Security", $wsse);
//creation du header avec envoi de $security sur la fonction security
$Header = array();
$Header[] = new SoapHeader($wsse, "Security", $Security, $mustUnderstand, $actor);
//envoi du header, authentification automatique via la fonction security
$MooWSe_client->__setSoapHeaders(NULL);
$MooWSe_client->__setSoapHeaders($Header);
//affichage du header
//print_r_pre($Header);
//récupération d'un token par la fonction authenticate, sinon on imprime le dernier dialogue reseau et l'erreur
try {
    $token1 = $MooWSe_client->authenticate();
    //obtention d'un token (chaine aleatoire) si authentification réussie avec les donnees envoyees dans le header sinon msg d'erreur
} catch (SoapFault $fault) {
    echo getLastHTTPDialogue($MooWSe_client);
    // affiche requete et reponse avec le nom du client et le header SOAP
    trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
//appel du dernier dialogue réseau
echo getLastHTTPDialogue($MooWSe_client);
// affiche requete et reponse avec le nom du client et le header SOAP
//on imprime le token
echo "<pre>" . htmlspecialchars($token1) . "</pre>";
//=======================================================================================================================================================
//Deuxieme demande
// Moodle -> AGAP
//=======================================================================================================================================================
Example #3
0
// le destinataire est le premier récepteur
//$actor = "http://localhost/github/PGROU/testsCedric/testWStoken/server.php"; // le destinataire est ce récepteur (ne marche pas)
//$actor = ""; // le destinataire est le dernier récepteur (marche mais lance un warning)
$Username = $login;
$Password = $password;
$UsernameToken["Username"] = new SoapVar($Username, XSD_STRING, NULL, $wsse, NULL, $wsse);
$UsernameToken["Password"] = new SoapVar($Password, XSD_STRING, "PasswordDigest", $wsse, NULL, $wsse);
$Security = array();
$Security["UsernameToken"] = new SoapVar($UsernameToken, SOAP_ENC_OBJECT, NULL, $wsse, NULL, $wsse);
$Security = new SoapVar($Security, SOAP_ENC_OBJECT, NULL, $wsse, NULL, $wsse);
$Header = array();
$Header[] = new SoapHeader($wsse, "Security", $Security, $mustUnderstand, $actor);
$client->__setSoapHeaders(NULL);
$client->__setSoapHeaders($Header);
print_r_pre($Header);
$token = $client->authenticate();
echo getLastHTTPRequest($client);
echo $token . "<br/>\n";
$Security = array();
$Security["BinarySecurityToken"] = new SoapVar($token, XSD_STRING, NULL, $wsse, NULL, $wsse);
$Security = new SoapVar($Security, SOAP_ENC_OBJECT, NULL, $wsse, NULL, $wsse);
$Header = array();
$Header[] = new SoapHeader($wsse, "Security", $Security, $mustUnderstand, $actor);
$client->__setSoapHeaders(NULL);
$client->__setSoapHeaders($Header);
$var = "Machine";
$res = $client->hello(new SoapParam($var, "name"));
echo getLastHTTPRequest($client);
print $res . "<br/>\n";
sleep(2);
$var = "Machine2";