<?php
$t = md5(rand(0, 10000000));
-if (isset($_REQUEST)) {
- file_put_contents(__DIR__.'/log/log.' . $t . '.log', print_r($_REQUEST, true));
+if (isset($_POST) && count($_POST)) {
+ file_put_contents(__DIR__ . '/log/log.' . $t . '.log', print_r($_POST, true));
}
$basedir = '/LVMH/Internal-Control-Base-December-2020/';
require_once "vendor/autoload.php";
session_start();
-$needsAuth = empty($_SESSION['samlUserdata']);
+$needsAuth = !(isset($_SESSION['samlOK']) && $_SESSION['samlOK']);
$file = $_SERVER['CONTEXT_DOCUMENT_ROOT'] . $_SERVER['SCRIPT_URL'];
if (is_dir($file)) {
$samlsettings = [
'sp' => [
// Identifier of the SP entity (must be a URI)
- 'entityId' => $url,
+ 'entityId' => 'https://hosting.fluidbook.com/',
// Specifies info about where and how the <AuthnResponse> message MUST be
// returned to the requester, in this case our SP.
'assertionConsumerService' => array(
die('an error occured');
}
- if (!empty($_REQUEST['SAMLResponse']) && !empty($_REQUEST['RelayState'])) {
+ if (!empty($_POST['SAMLResponse']) && !empty($_POST['RelayState'])) {
$auth->processResponse(null);
$errors = $auth->getErrors();
if (empty($errors)) {
- file_put_contents(__DIR__.'/log/err.' . $t . '.log', print_r($errors, true));
// user has authenticated successfully
$needsAuth = false;
$_SESSION['samlUserdata'] = $auth->getAttributes();
+ $_SESSION['samlOK'] = true;
+ session_write_close();
+ file_put_contents(__DIR__ . '/log/ok.' . $t . '.log', print_r($_SESSION, true));
+ file_put_contents(__DIR__ . '/log/xml.' . $t . '.log', $auth->getLastResponseXML());
+ } else {
+ file_put_contents(__DIR__ . '/log/err.' . $t . '.log', print_r($errors, true) . "\n\n--\n\n" . print_r($auth->getLastErrorReason(), true) . "\n\n--\n\n" . print_r($auth->getLastErrorException(), true));
}
}