Install: Generate keypair for JWT authentication

pull/5865/head
Angel Fernando Quiroz Campos 1 month ago
parent a460914ada
commit 241889250f
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 3
      public/main/install/index.php
  2. 22
      public/main/install/install.lib.php
  3. 5
      public/main/install/migrate.php

@ -586,7 +586,8 @@ if (isset($_POST['step2'])) {
$campusForm,
$allowSelfReg,
$allowSelfRegProf,
$installationProfile
$installationProfile,
$kernel
);
error_log('Finish installation');
} else {

@ -15,6 +15,7 @@ use Doctrine\Migrations\Configuration\Migration\PhpFile;
use Doctrine\Migrations\DependencyFactory;
use Doctrine\Migrations\Query\Query;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\DependencyInjection\Container as SymfonyContainer;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\Console\Input\ArrayInput;
@ -1484,7 +1485,8 @@ function finishInstallationWithContainer(
$siteName,
$allowSelfReg,
$allowSelfRegProf,
$installationProfile = ''
$installationProfile = '',
\Chamilo\Kernel $kernel
) {
Container::setContainer($container);
Container::setLegacyServices($container);
@ -1536,6 +1538,7 @@ function finishInstallationWithContainer(
);
lockSettings();
updateDirAndFilesPermissions();
executeLexikKeyPair($kernel);
}
/**
@ -1927,3 +1930,20 @@ function executeMigration(): array
return $resultStatus;
}
/**
* @throws Exception
*/
function executeLexikKeyPair(\Chamilo\Kernel $kernel): void
{
$application = new Application($kernel);
$application->setAutoExit(false);
$input = new ArrayInput([
'command' => 'lexik:jwt:generate-keypair',
]);
$output = new NullOutput();
$application->run($input, $output);
}

@ -23,6 +23,11 @@ if (file_exists($logFile)) {
if (!$response['status']) {
http_response_code(500); // Return a 500 Internal Server Error if migration failed
} else {
$kernel = new \Chamilo\Kernel('dev', true);
$kernel->boot();
executeLexikKeyPair($kernel);
}
$response = [

Loading…
Cancel
Save