This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
spkitlasso/endpoints/saml2.php

60 lines
1.7 KiB
PHP

<?php
require_once('spkitlasso/lassospkit_saml2_endpoint.inc.php');
class MyEndPoint extends LassoSPKitSaml2Endpoint {
function dispatchAndExit() {
try {
parent::dispatchAndExit();
} catch (Exception $e) {
$exceptionText = $e->__toString();
$lines = explode("\n",$exceptionText);
foreach ($lines as $line) {
lassospkit_errlog($line);
}
die('There was an error, shoot yourself !');
}
}
function assertionConsumer() {
$ret = parent::assertionConsumer();
if ($ret == 0) {
$r = $this->relayState;
echo "Ouais on est loggé, aller <a href='$r'>$r</a>";
} else {
echo "Une erreur lasso s'est produite de code $ret" . strError($ret);
}
}
function sloBrws() {
$ret = parent::sloBrws();
$this->handleSlo($ret);
}
function sloSoap() {
$ret = parent::sloSoap();
$this->handleSlo($ret);
}
function handleSlo($ret) {
if ($ret) {
lassospkit_errlog("Demande de slo échoué: $ret");
} else {
lassospkit_errlog("Demande de slo réussie: $ret");
}
}
function nameIdManagementBrws() {
$ret = parent::nameIdManagementBrws();
$this->handleNid($ret);
}
function nameIdManagementSoap() {
$ret = parent::nameIdManagementSoap();
$this->handleNid($ret);
}
function handleNid($ret) {
if ($ret) {
error_log('Erreur lors du nid: ' . $ret . ': ' . strError($ret));
}
}
}
$endpoint = new MyEndpoint();
$endpoint->dispatchAndExit();