$metadata = 'https://login.microsoftonline.com/10c68b76-5682-4564-a75d-9ef796a2f318/federationmetadata/2007-06/federationmetadata.xml?appid=48b8e0f9-effd-41e9-b35e-6511459dee30';
}
-session_start();
+if (session_status() !== PHP_SESSION_ACTIVE) {
+ session_start();
+}
+
$needsAuth = !(isset($_SESSION['samlOK']) && $_SESSION['samlOK']);
if (isset($_GET['return'])) {
try {
$auth = new Auth($samlsettings);
+
} catch (Exception $e) {
http_response_code(500);
print_r($e);
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));
}
} else {
- $auth->login();
+ $auth->login(null, [], true);
}
}