LSauth: replace LSdebug by LSlog logger

This commit is contained in:
Benjamin Renard 2020-05-12 16:37:35 +02:00
parent e75abab737
commit 5660804ef7

View file

@ -20,6 +20,8 @@
******************************************************************************/ ******************************************************************************/
LSsession :: loadLSclass('LSlog_staticLoggerClass');
/** /**
* Gestion de l'authentification d'un utilisateur * Gestion de l'authentification d'un utilisateur
* *
@ -27,7 +29,7 @@
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
*/ */
class LSauth { class LSauth extends LSlog_staticLoggerClass {
static private $authData=NULL; static private $authData=NULL;
static private $authObject=NULL; static private $authObject=NULL;
@ -41,26 +43,26 @@ class LSauth {
); );
public static function start() { public static function start() {
LSdebug('LSauth :: start()'); self :: log_debug('start()');
// Load Config // Load Config
if (isset(LSsession :: $ldapServer['LSauth']) && is_array(LSsession :: $ldapServer['LSauth'])) { if (isset(LSsession :: $ldapServer['LSauth']) && is_array(LSsession :: $ldapServer['LSauth'])) {
self :: $config = LSsession :: $ldapServer['LSauth']; self :: $config = LSsession :: $ldapServer['LSauth'];
} }
if (!LSsession :: loadLSclass('LSauthMethod')) { if (!LSsession :: loadLSclass('LSauthMethod')) {
LSdebug('LSauth :: Failed to load LSauthMethod'); self :: log_debug('Failed to load LSauthMethod class');
return; return;
} }
if (!isset(self :: $config['method'])) { if (!isset(self :: $config['method'])) {
self :: $config['method']='basic'; self :: $config['method']='basic';
} }
$class='LSauthMethod_'.self :: $config['method']; $class='LSauthMethod_'.self :: $config['method'];
LSdebug('LSauth : provider -> '.$class); self :: log_debug('provider -> '.$class);
if (LSsession :: loadLSclass($class)) { if (LSsession :: loadLSclass($class)) {
self :: $provider = new $class(); self :: $provider = new $class();
if (!self :: $provider) { if (!self :: $provider) {
LSerror :: addErrorCode('LSauth_05',self :: $config['method']); LSerror :: addErrorCode('LSauth_05',self :: $config['method']);
} }
LSdebug('LSauth : Provider Started !'); self :: log_debug('Provider Started !');
return true; return true;
} }
else { else {
@ -70,7 +72,7 @@ class LSauth {
} }
public static function forceAuthentication() { public static function forceAuthentication() {
LSdebug('LSauth :: forceAuthentication()'); self :: log_debug('LSauth :: forceAuthentication()');
if (!is_null(self :: $provider)) { if (!is_null(self :: $provider)) {
self :: $authData = self :: $provider -> getAuthData(); self :: $authData = self :: $provider -> getAuthData();
if (self :: $authData) { if (self :: $authData) {
@ -78,7 +80,7 @@ class LSauth {
return self :: $authObject; return self :: $authObject;
} }
// No data : user has not filled the login form // No data : user has not filled the login form
LSdebug('LSauth : No data -> user has not filled the login form'); self :: log_debug('No data -> user has not filled the login form');
return; return;
} }
LSerror :: addErrorCode('LSauth_06'); LSerror :: addErrorCode('LSauth_06');