OIDC test - test jumbojett oidc php app test 6

This commit is contained in:
matt committed 2026-10-23 04:53:37 -07:00
1 parent 933134e3b0
commit 6f8dd7bbe3
2 files changed
+12 -7

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ session_start();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head><title>Fitness – OIDC Demo</title></head> <head><title>Fitness - OIDC Demo</title></head>
<body> <body>
<?php if (!isset($_SESSION['user'])): ?> <?php if (!isset($_SESSION['user'])): ?>
<a href="/login.php"><button>Login with Authelia</button></a> <a href="/login.php"><button>Login with Authelia</button></a>
+11 -6
View File
@@ -4,20 +4,25 @@ require __DIR__ . '/vendor/autoload.php';
session_start(); session_start();
$oidc = new \Jumbojett\OpenIDConnectClient( $oidc = new \Jumbojett\OpenIDConnectClient(
'https://auth.matt-cloud.com/oidc', 'https://auth.matt-cloud.com/', // ***ISSUER***
'fitness-oidc', 'fitness-oidc',
'egebuqzZfVnjjBG9JDQ8tjW3TzV9gJurvT7qfB6c2SX2nPBNeaGycDfx4788QzJd' 'egebuqzZfVnjjBG9JDQ8tjW3TzV9gJurvT7qfB6c2SX2nPBNeaGycDfx4788QzJd'
); );
// Tell the client where the user should be redirected after Auth // If you’re on a dev environment with a self‑signed cert:
$oidc->setRedirectURL('https://fitness.matt-cloud.com/pgapi/auth/oidc/callback'); # $oidc->setVerifyPeer(false); // <-- DO NOT USE IN PRODUCTION
// If you want PKCE (recommended for public clients) // PKCE – optional but recommended for public clients
$oidc->setCodeChallengeMethod('S256'); $oidc->setCodeChallengeMethod('S256');
// Start the auth flow // Tell the client where to land after Auth
$oidc->setRedirectURL('https://fitness.matt-cloud.com/pgapi/auth/oidc/callback');
// Optional: hard‑code the discovery URL
$oidc->setDiscoveryEndpoint('https://auth.matt-cloud.com/.well-known/openid-configuration');
try { try {
$oidc->authenticate(); // will redirect to Authelia $oidc->authenticate(); // sends 302 → Authelia
} catch (Exception $e) { } catch (Exception $e) {
http_response_code(500); http_response_code(500);
echo 'Login failed: ' . $e->getMessage(); echo 'Login failed: ' . $e->getMessage();