Initial commit
This commit is contained in:
commit
48a5360d0d
22 changed files with 1687 additions and 0 deletions
30
callback.php
Normal file
30
callback.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
require __DIR__ . '/config/config.php';
|
||||
|
||||
use Jumbojett\OpenIDConnectClient;
|
||||
|
||||
session_start();
|
||||
|
||||
// keycloak configuration
|
||||
$oidc = new OpenIDConnectClient($CONFIG['oidc']['url'],
|
||||
$CONFIG['oidc']['clientid'],
|
||||
$CONFIG['oidc']['secret']);
|
||||
$oidc->setRedirectURL($CONFIG['baseurl'] . 'callback.php');
|
||||
|
||||
// get token
|
||||
$oidc->authenticate();
|
||||
|
||||
// store user data in session
|
||||
$_SESSION['id_token'] = $oidc->getIdToken();
|
||||
foreach ($CONFIG['oidc']['mappings'] as $key => $value) {
|
||||
$_SESSION[$key] = $oidc->requestUserInfo($value);
|
||||
}
|
||||
|
||||
if (! $_SESSION['doe'] ) {
|
||||
$_SESSION['doe'] = $CONFIG['default_doe'];
|
||||
}
|
||||
|
||||
// redirect to home
|
||||
header('Location: card.php');
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue