<?php require_once __DIR__ . '/../../vendor/autoload.php'; if (isset($_GET['sso_error'])) { header("Location: error.php?sso_error=" . $_GET['sso_error'], true, 307); exit; } $broker = new Jasny\SSO\Broker(getenv('SSO_SERVER'), getenv('SSO_BROKER_ID'), getenv('SSO_BROKER_SECRET')); $broker->attach(true); $user = $broker->getUserInfo(); if (!$user) { header("Location: login.php", true, 307); exit; } ?> <!doctype html> <html> <head> <title><?php echo $broker->broker; ?> (Single Sign-On demo)</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="container"> <h1><?php echo $broker->broker; ?> <small>(Single Sign-On demo)</small></h1> <h3>Logged in</h3>
<?php require_once __DIR__ . '/../../lib/autoload.php'; $config = (include "config.php"); $broker = new Jasny\SSO\Broker($config['SSO_SERVER'], $config['SSO_BROKER_ID'], $config['SSO_BROKER_SECRET']); $broker->attach(); try { if (!empty($_GET['logout'])) { $broker->logout(); } elseif ($broker->getUserInfo() || $_SERVER['REQUEST_METHOD'] == 'POST' && $broker->login($_POST['username'], $_POST['password'])) { header("Location: index.php", true, 303); exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errmsg = "Login failed"; } } catch (Jasny\SSO\Exception $e) { $errmsg = $e->getMessage(); } ?> <!doctype html> <html> <head> <title><?php echo $broker->broker; ?> | Login (Single Sign-On demo)</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <style> h1 {