From: Vincent Vanwaelscappel Date: Tue, 22 Mar 2022 09:29:22 +0000 (+0100) Subject: wip #5074 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9c51ebe9e74375007e5c51a05125b1582f1fe9d1;p=fluidbook-hosting.git wip #5074 @1 --- diff --git a/.gitignore b/.gitignore index 2791407..ef9cd22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /LVMH-SSO/vendor/ /LVMH-SSO/d/ /LVMH-SSO/mf/ -/LVMH-SSO/index.html \ No newline at end of file +/LVMH-SSO/index.html +/VacheronSSO/vendor/ \ No newline at end of file diff --git a/VacheronSSO/.htaccess b/VacheronSSO/.htaccess index 0c1e92a..e021dea 100644 --- a/VacheronSSO/.htaccess +++ b/VacheronSSO/.htaccess @@ -1,4 +1,6 @@ RewriteEngine on -RewriteBase /test/Vacheron-Constantin/ +RewriteBase / +RewriteCond %{HTTP_HOST} hosting.fluidbook.com +RewriteRule ^(.*)$ https://cabinotiers.vacheron-constantin.com/$1 [R=301,L] RewriteRule ^_secure.php$ - [L] RewriteRule ^.*$ _secure.php [L,QSA] \ No newline at end of file diff --git a/VacheronSSO/_secure.php b/VacheronSSO/_secure.php index 8253dff..0f1816a 100644 --- a/VacheronSSO/_secure.php +++ b/VacheronSSO/_secure.php @@ -2,14 +2,21 @@ use GuzzleHttp\Client; +$logdir = __DIR__ . '/log/'; + +if (!file_exists($logdir)) { + mkdir($logdir, 0777, true); +} + $t = md5(rand(0, 10000000)); if (isset($_POST) && count($_POST)) { - file_put_contents(__DIR__ . '/log/log.' . $t . '.log', print_r($_POST, true)); + file_put_contents($logdir . 'log.' . $t . '.log', print_r($_POST, true)); } -$basedir = '/test/Vacheron-Constantin/'; -$base = 'https://hosting.fluidbook.com' . $basedir; -$metadata = 'https://login.microsoftonline.com/10c68b76-5682-4564-a75d-9ef796a2f318/federationmetadata/2007-06/federationmetadata.xml?appid=48b8e0f9-effd-41e9-b35e-6511459dee30'; +$basedir = '/'; +$base = 'https://cabinotiers.vacheron-constantin.com' . $basedir; +//$metadata = 'https://login.microsoftonline.com/10c68b76-5682-4564-a75d-9ef796a2f318/federationmetadata/2007-06/federationmetadata.xml?appid=48b8e0f9-effd-41e9-b35e-6511459dee30'; +$metadata = 'https://login.microsoftonline.com/94b3f1b2-8b3a-49e3-ba33-8b8fb6d18361/federationmetadata/2007-06/federationmetadata.xml?appid=fd419245-db40-4031-856e-de24fbe41d13'; $forbiddenext = ['php', 'htaccess', '_metadata']; foreach ($forbiddenext as $ext) { @@ -121,8 +128,8 @@ if ($needsAuth) { $_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()); + file_put_contents($logdir.'ok.' . $t . '.log', print_r($_SESSION, true)); + file_put_contents($logdir. 'xml.' . $t . '.log', $auth->getLastResponseXML()); if ($_POST['RelayState'] !== $base) { header('Location: ' . $_POST['RelayState'], true); @@ -130,7 +137,7 @@ if ($needsAuth) { } } 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)); + file_put_contents($logdir.'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)); } }