32 lines
807 B
PHP
32 lines
807 B
PHP
<?php
|
|
require_once 'vendor/autoload.php';
|
|
include 'config/config.php';
|
|
|
|
use Jumbojett\OpenIDConnectClient;
|
|
session_start();
|
|
|
|
if (getenv('AUTH_DISABLED') === 'true') {
|
|
$_SESSION['user_authenticated'] = true;
|
|
if (empty($_SESSION['user_name'])) { $_SESSION['user_name'] = 'localtest'; }
|
|
header('Location: index.php');
|
|
exit();
|
|
}
|
|
|
|
// OpenID Connect Client konfigurieren
|
|
|
|
$oidc = new OpenIDConnectClient(
|
|
$oidc_provider, // OpenID Provider URL
|
|
$oidc_client, // Client ID
|
|
$oidc_secret // Client Secret
|
|
);
|
|
|
|
// Weiterleitungen konfigurieren
|
|
|
|
$oidc->setRedirectURL($OIDC_REDIRECT_URL);
|
|
|
|
// Scopes als Array hinzufügen
|
|
$oidc->addScope(['openid', 'profile', 'email', 'groups']);
|
|
|
|
// Benutzer zur Authentifizierungsseite weiterleiten
|
|
$oidc->authenticate();
|
|
?>
|