OIDC test
This commit is contained in:
1 parent
fd79a027a2
commit
965d2d084a
9 files changed
+259
No files matched your search
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/config.php';
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use Fitness\OIDC\OIDC;
|
||||
|
||||
// Generate a cryptographically random state & nonce.
|
||||
$state = bin2hex(random_bytes(16));
|
||||
$nonce = bin2hex(random_bytes(16));
|
||||
|
||||
// Persist them in the session to validate later.
|
||||
$_SESSION['oidc_state'] = $state;
|
||||
$_SESSION['oidc_nonce'] = $nonce;
|
||||
|
||||
$oidc = new OIDC();
|
||||
header('Location: ' . $oidc->buildAuthUrl($state, $nonce));
|
||||
exit;
|
||||
Reference in new issue
Block a user