studidcard/index.php
Raphael Dannecker 48a5360d0d Initial commit
2025-02-25 16:10:55 +01:00

27 lines
738 B
PHP

<?php
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/config/config.php';
use Jumbojett\OpenIDConnectClient;
session_start();
$oidc = new OpenIDConnectClient($CONFIG['oidc']['url'],
$CONFIG['oidc']['clientid'],
$CONFIG['oidc']['secret']);
$oidc->setRedirectURL($CONFIG['baseurl'] . 'callback.php');
// check if user is logged in
if (isset($_SESSION['id_token'])) {
header('Location: card.php');
/*echo "Willkommen,";
echo '<br><a href="card.php">Ausweis anzeigen</a>';
echo '<br><a href="card.php?pdf=true" download="schuelerausweis.pdf">Ausweis download (pdf)</a>';
echo '<br><a href="logout.php">Abmelden</a>';*/
} else {
// redirect to keycloak login
$oidc->authenticate();
}
?>