FEAT_BOOKSTACK_SSO

This commit is contained in:
velz 2025-06-03 11:01:03 +05:30
parent 5e8adfc72d
commit c409b958b7
2 changed files with 24 additions and 1 deletions

View File

@ -536,7 +536,7 @@ $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrol
// Ticketing System End's
$routes->get("autobookstackLogin", "RestAuthenticationController::bookstackLoginToken");
//BDSReports
$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');

View File

@ -505,5 +505,28 @@ class RestAuthenticationController extends AdminController
}
// TokenController.php
public function bookstackLoginToken()
{
// $user = session()->get('user');
// $secret = getenv('BOOKSTACK_TOKEN_SECRET');
$user = 'staff@staff.com';
$secret = '5a8c1e9b18e6a94f724f6a6b36b6f26d9eec0e4a15e88b6e3e2d5efad23a8f4f';
$payload = [
'email' => $user,
'name' => 'Hi',
'exp' => time() + 60 // expires in 1 minute
];
$token = base64_encode(json_encode($payload));
$signature = hash_hmac('sha256', $token, $secret);
$url = 'https://localhost/PHP828APPS/manual/bookstack/public/autologin?token=' . urlencode($token) . '&sig=' . $signature;
return redirect()->to($url);
}
}