OIDC test - test jumbojett oidc php app
This commit is contained in:
1 parent
a759eb206f
commit
97a31db020
6 files changed
+79
-98
No files matched your search
+22
-9
@@ -1,15 +1,28 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/config.php';
|
||||
|
||||
// Destroy the PHP session.
|
||||
// logout.php
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
session_start();
|
||||
|
||||
$oidc = new \Jumbojett\OpenIDConnectClient(
|
||||
'https://auth.matt-cloud.com/oidc',
|
||||
'fitness-oidc',
|
||||
'egebuqzZfVnjjBG9JDQ8tjW3TzV9gJurvT7qfB6c2SX2nPBNeaGycDfx4788QzJd'
|
||||
);
|
||||
|
||||
// Build the end‑session endpoint (back‑channel logout)
|
||||
$logoutUrl = $oidc->getLogoutEndpoint(); // e.g. https://auth.matt-cloud.com/logout
|
||||
|
||||
// Include the post‑logout redirect URI
|
||||
$logoutUrl .= '?post_logout_redirect_uri=' . urlencode('https://fitness.matt-cloud.com/');
|
||||
|
||||
// Optionally pass the ID‑token hint so the OP can immediately terminate the session
|
||||
if (isset($_SESSION['user']['id_token'])) {
|
||||
$logoutUrl .= '&id_token_hint=' . urlencode($_SESSION['user']['id_token']);
|
||||
}
|
||||
|
||||
// Destroy the local session first
|
||||
session_destroy();
|
||||
|
||||
// Redirect the user to Authelia’s logout endpoint.
|
||||
// Authelia will clean its session and then redirect back.
|
||||
$logoutUrl = OIDC_LOGOUT_ENDPOINT
|
||||
. '?post_logout_redirect_uri=' . urlencode(OIDC_POST_LOGOUT_REDIRECT_URI);
|
||||
|
||||
// Redirect the browser
|
||||
header('Location: ' . $logoutUrl);
|
||||
exit;
|
||||
Reference in new issue
Block a user