Skip to content
Snippets Groups Projects
Verified Commit 4a469b02 authored by Damien's avatar Damien
Browse files

FEAT #13695 TIME 0:20 Cas logout

parent 2fb02d66
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,7 @@ $app->add(function (\Slim\Http\Request $request, \Slim\Http\Response $response, ...@@ -55,6 +55,7 @@ $app->add(function (\Slim\Http\Request $request, \Slim\Http\Response $response,
$app->get('/authenticationInformations', \SrcCore\controllers\AuthenticationController::class . ':getInformations'); $app->get('/authenticationInformations', \SrcCore\controllers\AuthenticationController::class . ':getInformations');
$app->get('/validUrl', \SrcCore\controllers\AuthenticationController::class . ':getValidUrl'); $app->get('/validUrl', \SrcCore\controllers\AuthenticationController::class . ':getValidUrl');
$app->post('/authenticate', \SrcCore\controllers\AuthenticationController::class . ':authenticate'); $app->post('/authenticate', \SrcCore\controllers\AuthenticationController::class . ':authenticate');
$app->get('/authenticate/logout', \SrcCore\controllers\AuthenticationController::class . ':logout');
$app->get('/authenticate/token', \SrcCore\controllers\AuthenticationController::class . ':getRefreshedToken'); $app->get('/authenticate/token', \SrcCore\controllers\AuthenticationController::class . ':getRefreshedToken');
//Initialize //Initialize
......
...@@ -308,6 +308,17 @@ class AuthenticationController ...@@ -308,6 +308,17 @@ class AuthenticationController
return $response->withStatus(204); return $response->withStatus(204);
} }
public function logout(Request $request, Response $response)
{
$loggingMethod = CoreConfigModel::getLoggingMethod();
if ($loggingMethod['id'] == 'cas') {
AuthenticationController::casDisconnection();
}
return $response->withStatus(204);
}
private static function standardConnection(array $args) private static function standardConnection(array $args)
{ {
$login = $args['login']; $login = $args['login'];
...@@ -429,6 +440,32 @@ class AuthenticationController ...@@ -429,6 +440,32 @@ class AuthenticationController
return ['login' => $login]; return ['login' => $login];
} }
private static function casDisconnection()
{
$casConfiguration = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/cas_config.xml']);
$version = (string)$casConfiguration->CAS_VERSION;
$hostname = (string)$casConfiguration->WEB_CAS_URL;
$port = (string)$casConfiguration->WEB_CAS_PORT;
$uri = (string)$casConfiguration->WEB_CAS_CONTEXT;
$certificate = (string)$casConfiguration->PATH_CERTIFICATE;
\phpCAS::setDebug();
\phpCAS::setVerbose(true);
\phpCAS::client(constant($version), $hostname, (int)$port, $uri, $version != 'CAS_VERSION_3_0');
if (!empty($certificate)) {
\phpCAS::setCasServerCACert($certificate);
} else {
\phpCAS::setNoCasServerValidation();
}
\phpCAS::setFixedServiceURL(UrlController::getCoreUrl() . 'dist/index.html');
\phpCAS::setNoClearTicketsFromUrl();
\phpCAS::logout();
return true;
}
public function getRefreshedToken(Request $request, Response $response) public function getRefreshedToken(Request $request, Response $response)
{ {
$queryParams = $request->getQueryParams(); $queryParams = $request->getQueryParams();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment