LSauthMethod_HTTP: add debug

This commit is contained in:
Benjamin Renard 2020-05-12 21:01:07 +02:00
parent b2ef404da5
commit 4ef0a8fb30

View file

@ -45,8 +45,13 @@ class LSauthMethod_HTTP extends LSauthMethod_basic {
* @retval Array|false Array of authentication data or False * @retval Array|false Array of authentication data or False
**/ **/
public function getAuthData() { public function getAuthData() {
if (!defined('LSAUTHMETHOD_HTTP_METHOD')) if (!defined('LSAUTHMETHOD_HTTP_METHOD')) {
self :: log_debug('No HTTP method defined: use PHP_AUTH as default.');
define('LSAUTHMETHOD_HTTP_METHOD', 'PHP_AUTH'); define('LSAUTHMETHOD_HTTP_METHOD', 'PHP_AUTH');
}
else {
self :: log_debug('HTTP method to retreive auth data is "'.LSAUTHMETHOD_HTTP_METHOD.'"');
}
switch(constant('LSAUTHMETHOD_HTTP_METHOD')) { switch(constant('LSAUTHMETHOD_HTTP_METHOD')) {
case 'AUTHORIZATION': case 'AUTHORIZATION':
@ -97,6 +102,7 @@ class LSauthMethod_HTTP extends LSauthMethod_basic {
public function authenticate() { public function authenticate() {
if ( (defined('LSAUTHMETHOD_HTTP_TRUST_WITHOUT_PASSWORD_CHALLENGE')) && (constant('LSAUTHMETHOD_HTTP_TRUST_WITHOUT_PASSWORD_CHALLENGE') === True)) { if ( (defined('LSAUTHMETHOD_HTTP_TRUST_WITHOUT_PASSWORD_CHALLENGE')) && (constant('LSAUTHMETHOD_HTTP_TRUST_WITHOUT_PASSWORD_CHALLENGE') === True)) {
// Return authObject without checking login/password by LDAP auth challenge // Return authObject without checking login/password by LDAP auth challenge
self :: log_debug('Trust HTTP authenticated user without password challenge');
return LSauthMethod :: authenticate(); return LSauthMethod :: authenticate();
} }
else { else {
@ -114,8 +120,10 @@ class LSauthMethod_HTTP extends LSauthMethod_basic {
**/ **/
public static function afterLogout() { public static function afterLogout() {
if (defined('LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL')) { if (defined('LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL')) {
self :: log_debug("Logout remote URL configured => redirect user to '".LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL."'.");
LSurl :: redirect(LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL); LSurl :: redirect(LSAUTHMETHOD_HTTP_LOGOUT_REMOTE_URL);
} }
self :: log_debug('No logout remote URL configured');
return true; return true;
} }