diff --git a/typo3/sysext/core/Classes/Authentication/AbstractAuthenticationService.php b/typo3/sysext/core/Classes/Authentication/AbstractAuthenticationService.php index 55ef65758cc5eb6c7cb56f73cfef7c49c00e9a69..71169c7937cf2e918352751bb1dc4cebd26d3d55 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractAuthenticationService.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractAuthenticationService.php @@ -70,15 +70,6 @@ class AbstractAuthenticationService extends AbstractService */ public $writeAttemptLog = false; - /** - * Write additional log entries - * - * Specifically useful during development of authentication services - * - * @var bool - */ - public $writeDevLog = false; - /** * Initialize authentication service * @@ -97,7 +88,6 @@ class AbstractAuthenticationService extends AbstractService $this->db_user = $this->getServiceOption('db_user', $authInfo['db_user'], false); $this->db_groups = $this->getServiceOption('db_groups', $authInfo['db_groups'], false); $this->writeAttemptLog = $this->pObj->writeAttemptLog; - $this->writeDevLog = $this->pObj->writeDevLog; } /** diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 3aa361c2427e95790427d4e4acb27e8abc10fd7d..c845c71b9232fb537e86354fa00bd468bc4c9ea0 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -327,15 +327,6 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface */ public $svConfig = []; - /** - * Write additional log entries - * - * Specifically useful during development of authentication services - * - * @var bool - */ - public $writeDevLog = false; - /** * @var array */ @@ -380,19 +371,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface if (empty($this->loginType)) { throw new Exception('No loginType defined, should be set explicitly by subclass', 1476045345); } - // Enable dev logging if set - if ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLog']) { - $this->writeDevLog = true; - } - if ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLog' . $this->loginType]) { - $this->writeDevLog = true; - } - if ((bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) { - $this->writeDevLog = true; - } - if ($this->writeDevLog) { - $this->logger->debug('## Beginning of auth logging.'); - } + $this->logger->debug('## Beginning of auth logging.'); // Init vars. $mode = ''; $this->newSessionID = false; @@ -496,10 +475,10 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface } else { throw new Exception('Cookie was not set since HTTPS was forced in $TYPO3_CONF_VARS[SYS][cookieSecure].', 1254325546); } - if ($this->writeDevLog) { - $devLogMessage = ($isRefreshTimeBasedCookie ? 'Updated Cookie: ' : 'Set Cookie: ') . $this->id; - $this->logger->debug($devLogMessage . ($cookieDomain ? ', ' . $cookieDomain : '')); - } + $this->logger->debug( + ($isRefreshTimeBasedCookie ? 'Updated Cookie: ' : 'Set Cookie: ') + . $this->id . ($cookieDomain ? ', ' . $cookieDomain : '') + ); } } @@ -584,16 +563,12 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface $activeLogin = false; // Indicates if an active authentication failed (not auto login) $this->loginFailure = false; - if ($this->writeDevLog) { - $this->logger->debug('Login type: ' . $this->loginType); - } + $this->logger->debug('Login type: ' . $this->loginType); // The info array provide additional information for auth services $authInfo = $this->getAuthInfoArray(); // Get Login/Logout data submitted by a form or params $loginData = $this->getLoginFormData(); - if ($this->writeDevLog) { - $this->logger->debug('Login data', $loginData); - } + $this->logger->debug('Login data', $loginData); // Active logout (eg. with "logout" button) if ($loginData['status'] === 'logout') { if ($this->writeStdLog) { @@ -620,9 +595,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface // Active login (eg. with login form). if (!$haveSession && $loginData['status'] === 'login') { $activeLogin = true; - if ($this->writeDevLog) { - $this->logger->debug('Active login (eg. with login form)'); - } + $this->logger->debug('Active login (eg. with login form)'); // check referrer for submitted login values if ($this->formfield_status && $loginData['uident'] && $loginData['uname']) { $httpHost = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'); @@ -646,18 +619,16 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface $activeLogin = true; } - if ($this->writeDevLog) { - if ($haveSession) { - $this->logger->debug('User session found', [ - $this->userid_column => $authInfo['userSession'][$this->userid_column], - $this->username_column => $authInfo['userSession'][$this->username_column], - ]); - } else { - $this->logger->debug('No user session found'); - } - if (is_array($this->svConfig['setup'])) { - $this->logger->debug('SV setup', $this->svConfig['setup']); - } + if ($haveSession) { + $this->logger->debug('User session found', [ + $this->userid_column => $authInfo['userSession'][$this->userid_column], + $this->username_column => $authInfo['userSession'][$this->username_column], + ]); + } else { + $this->logger->debug('No user session found'); + } + if (is_array($this->svConfig['setup'])) { + $this->logger->debug('SV setup', $this->svConfig['setup']); } // Fetch user if ... @@ -671,12 +642,10 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface foreach ($this->getAuthServices($subType, $loginData, $authInfo) as $serviceObj) { if ($row = $serviceObj->getUser()) { $tempuserArr[] = $row; - if ($this->writeDevLog) { - $this->logger->debug('User found', [ - $this->userid_column => $row[$this->userid_column], - $this->username_column => $row[$this->username_column], - ]); - } + $this->logger->debug('User found', [ + $this->userid_column => $row[$this->userid_column], + $this->username_column => $row[$this->username_column], + ]); // User found, just stop to search for more if not configured to go on if (!$this->svConfig['setup'][$this->loginType . '_fetchAllUsers']) { break; @@ -684,13 +653,12 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface } } - if ($this->writeDevLog && $this->svConfig['setup'][$this->loginType . '_alwaysFetchUser']) { + if ($this->svConfig['setup'][$this->loginType . '_alwaysFetchUser']) { $this->logger->debug($this->loginType . '_alwaysFetchUser option is enabled'); } - if ($this->writeDevLog && empty($tempuserArr)) { + if (empty($tempuserArr)) { $this->logger->debug('No user found by services'); - } - if ($this->writeDevLog && !empty($tempuserArr)) { + } else { $this->logger->debug(count($tempuserArr) . ' user records found by services'); } } @@ -701,19 +669,15 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface $tempuser = $authInfo['userSession']; // User is authenticated because we found a user session $authenticated = true; - if ($this->writeDevLog) { - $this->logger->debug('User session used', [ - $this->userid_column => $authInfo['userSession'][$this->userid_column], - $this->username_column => $authInfo['userSession'][$this->username_column], - ]); - } + $this->logger->debug('User session used', [ + $this->userid_column => $authInfo['userSession'][$this->userid_column], + $this->username_column => $authInfo['userSession'][$this->username_column], + ]); } // Re-auth user when 'auth'-service option is set if ($this->svConfig['setup'][$this->loginType . '_alwaysAuthUser']) { $authenticated = false; - if ($this->writeDevLog) { - $this->logger->debug('alwaysAuthUser option is enabled'); - } + $this->logger->debug('alwaysAuthUser option is enabled'); } // Authenticate the user if needed if (!empty($tempuserArr) && !$authenticated) { @@ -721,9 +685,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface // Use 'auth' service to authenticate the user // If one service returns FALSE then authentication failed // a service might return 100 which means there's no reason to stop but the user can't be authenticated by that service - if ($this->writeDevLog) { - $this->logger->debug('Auth user', $tempuser); - } + $this->logger->debug('Auth user', $tempuser); $subType = 'authUser' . $this->loginType; foreach ($this->getAuthServices($subType, $loginData, $authInfo) as $serviceObj) { @@ -772,7 +734,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface ); // The login session is started. $this->loginSessionStarted = true; - if ($this->writeDevLog && is_array($this->user)) { + if (is_array($this->user)) { $this->logger->debug('User session finally read', [ $this->userid_column => $this->user[$this->userid_column], $this->username_column => $this->user[$this->username_column], @@ -824,16 +786,14 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface // If there were a login failure, check to see if a warning email should be sent: if ($this->loginFailure && $activeLogin) { - if ($this->writeDevLog) { - $this->logger->debug( - 'Call checkLogFailures', - [ - 'warningEmail' => $this->warningEmail, - 'warningPeriod' => $this->warningPeriod, - 'warningMax' => $this->warningMax - ] - ); - } + $this->logger->debug( + 'Call checkLogFailures', + [ + 'warningEmail' => $this->warningEmail, + 'warningPeriod' => $this->warningPeriod, + 'warningMax' => $this->warningMax + ] + ); // Hook to implement login failure tracking methods if ( @@ -879,7 +839,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface $serviceObj->initAuth($subType, $loginData, $authInfo, $this); yield $serviceObj; } - if ($this->writeDevLog && $serviceChain) { + if ($serviceChain) { $this->logger->debug($subType . ' auth services called: ' . $serviceChain); } } @@ -924,9 +884,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface */ public function createUserSession($tempuser) { - if ($this->writeDevLog) { - $this->logger->debug('Create session ses_id = ' . $this->id); - } + $this->logger->debug('Create session ses_id = ' . $this->id); // Delete any session entry first $this->getSessionBackend()->remove($this->id); // Re-create session entry @@ -985,9 +943,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface */ public function fetchUserSession($skipSessionUpdate = false) { - if ($this->writeDevLog) { - $this->logger->debug('Fetch session ses_id = ' . $this->id); - } + $this->logger->debug('Fetch session ses_id = ' . $this->id); try { $sessionRecord = $this->getSessionBackend()->get($this->id); } catch (SessionNotFoundException $e) { @@ -1044,9 +1000,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface */ public function logoff() { - if ($this->writeDevLog) { - $this->logger->debug('logoff: ses_id = ' . $this->id); - } + $this->logger->debug('logoff: ses_id = ' . $this->id); // Release the locked records BackendUtility::lockRecords(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'])) { @@ -1200,9 +1154,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface if (!is_array($variable)) { $variable = $this->uc; } - if ($this->writeDevLog) { - $this->logger->debug('writeUC: ' . $this->userid_column . '=' . (int)$this->user[$this->userid_column]); - } + $this->logger->debug('writeUC: ' . $this->userid_column . '=' . (int)$this->user[$this->userid_column]); GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->user_table)->update( $this->user_table, ['uc' => serialize($variable)], @@ -1299,9 +1251,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface { $this->sessionData[$key] = $data; $this->user['ses_data'] = serialize($this->sessionData); - if ($this->writeDevLog) { - $this->logger->debug('setAndSaveSessionData: ses_id = ' . $this->id); - } + $this->logger->debug('setAndSaveSessionData: ses_id = ' . $this->id); $updatedSession = $this->getSessionBackend()->update( $this->id, ['ses_data' => $this->user['ses_data']] @@ -1352,9 +1302,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface { $loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['loginSecurityLevel']) ?: 'normal'; $passwordTransmissionStrategy = $passwordTransmissionStrategy ?: $loginSecurityLevel; - if ($this->writeDevLog) { - $this->logger->debug('Login data before processing', $loginData); - } + $this->logger->debug('Login data before processing', $loginData); $serviceChain = ''; $subType = 'processLoginData' . $this->loginType; $authInfo = $this->getAuthInfoArray(); @@ -1376,9 +1324,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface } if ($isLoginDataProcessed) { $loginData = $processedLoginData; - if ($this->writeDevLog) { - $this->logger->debug('Processed login data', $processedLoginData); - } + $this->logger->debug('Processed login data', $processedLoginData); } return $loginData; } diff --git a/typo3/sysext/core/Classes/Authentication/AuthenticationService.php b/typo3/sysext/core/Classes/Authentication/AuthenticationService.php index 3bea763e205549aa4a74602773a175c0ded86635..a125cc5cad292f16f73744e057dde5d766ff2992 100644 --- a/typo3/sysext/core/Classes/Authentication/AuthenticationService.php +++ b/typo3/sysext/core/Classes/Authentication/AuthenticationService.php @@ -70,12 +70,10 @@ class AuthenticationService extends AbstractAuthenticationService 'REMOTE_HOST' => $this->authInfo['REMOTE_HOST'], ]); } else { - if ($this->writeDevLog) { - $this->logger->debug('User found', [ - $this->db_user['userid_column'] => $user[$this->db_user['userid_column']], - $this->db_user['username_column'] => $user[$this->db_user['username_column']] - ]); - } + $this->logger->debug('User found', [ + $this->db_user['userid_column'] => $user[$this->db_user['userid_column']], + $this->db_user['username_column'] => $user[$this->db_user['username_column']] + ]); } return $user; } @@ -110,9 +108,7 @@ class AuthenticationService extends AbstractAuthenticationService 'REMOTE_HOST' => $this->authInfo['REMOTE_HOST'], ]); } - if ($this->writeDevLog) { - $this->logger->debug('Password not accepted: ' . $this->login['uident']); - } + $this->logger->debug('Password not accepted: ' . $this->login['uident']); } // Checking the domain (lockToDomain) if ($OK && $user['lockToDomain'] && $user['lockToDomain'] !== $this->authInfo['HTTP_HOST']) { @@ -164,9 +160,7 @@ class AuthenticationService extends AbstractAuthenticationService } $groups = array_unique($groups); if (!empty($groups)) { - if ($this->writeDevLog) { - $this->logger->debug('Get usergroups with id: ' . implode(',', $groups)); - } + $this->logger->debug('Get usergroups with id: ' . implode(',', $groups)); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable($this->db_groups['table']); if (!empty($this->authInfo['showHiddenRecords'])) { @@ -198,9 +192,7 @@ class AuthenticationService extends AbstractAuthenticationService $groupDataArr[$row['uid']] = $row; } } else { - if ($this->writeDevLog) { - $this->logger->debug('No usergroups found.'); - } + $this->logger->debug('No usergroups found.'); } } return $groupDataArr; diff --git a/typo3/sysext/core/Classes/Service/AbstractService.php b/typo3/sysext/core/Classes/Service/AbstractService.php index c10eb0d4053241e7fe9eba2efd7241cd5821692a..f204c4f11a47483709c7ccbdfc3b6600b5686460 100644 --- a/typo3/sysext/core/Classes/Service/AbstractService.php +++ b/typo3/sysext/core/Classes/Service/AbstractService.php @@ -38,15 +38,6 @@ abstract class AbstractService implements LoggerAwareInterface */ public $error = []; - /** - * Write additional log entries - * - * Specifically useful during development of authentication services - * - * @var bool - */ - public $writeDevLog = false; - /** * @var string The output content. That's what the services produced as result. */ @@ -164,10 +155,7 @@ abstract class AbstractService implements LoggerAwareInterface public function devLog($msg, $severity = 0, $dataVar = false) { GeneralUtility::logDeprecatedFunction(); - if ($this->writeDevLog) { - $message = $this->info['serviceKey'] . ': ' . $msg; - $this->logger->debug($message, (array)$dataVar); - } + $this->logger->debug($this->info['serviceKey'] . ': ' . $msg, (array)$dataVar); } /** diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index e34d6c2c68d70506b9eddfde5a51470f52b759ac..1c5586d33fe10cb11e76c7a9e10e458e14efba71 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -3837,7 +3837,7 @@ class GeneralUtility public static function devLog($msg, $extKey, $severity = 0, $dataVar = false) { static::logDeprecatedFunction(); - if ((bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG'] && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'])) { + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'])) { $params = ['msg' => $msg, 'extKey' => $extKey, 'severity' => $severity, 'dataVar' => $dataVar]; $fakeThis = false; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'] as $hookMethod) { diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index fe2da9404d5705f97eda8ee35cb1c91267cd0949..cf1265a249391cbeb96e5d0957e3a4de86af4db7 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -77,7 +77,6 @@ return [ 'recursiveDomainSearch' => false, 'trustedHostsPattern' => 'SERVER_NAME', 'devIPmask' => '127.0.0.1,::1', - 'enable_DLOG' => false, 'ddmmyy' => 'd-m-y', 'hhmm' => 'H:i', 'USdateFormat' => false, diff --git a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml index 66f1dede20a9d275d405151cfe064ac9f0d9bc1a..0a30dec5130717819e7b70fd04fd9319cb42f708 100644 --- a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml +++ b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml @@ -105,9 +105,6 @@ SYS: devIPmask: type: text description: 'Defines a list of IP addresses which will allow development-output to display. The debug() function will use this as a filter. See the function <code>\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP()</code> for details on syntax. Setting this to blank value will deny all. Setting to "*" will allow all.' - enable_DLOG: - type: bool - description: 'Whether the developer log is enabled. This option has been deprecated in favor of the Logging API, and will be removed in TYPO3 v10. Do not depend on it.' ddmmyy: type: text description: 'Format of Date-Month-Year - see PHP-function <a href="http://php.net/date" target="_blank">date()</a>' diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst new file mode 100644 index 0000000000000000000000000000000000000000..85def8160f8f51a47eb6c1dcaab66018f32b2ff5 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst @@ -0,0 +1,46 @@ +.. include:: ../../Includes.txt + +=========================================================================== +Breaking: #82639 - Logging activated for authentication and Service classes +=========================================================================== + +See :issue:`82639` + +Description +=========== + +Due to the introduction of TYPO3's Logging API in several places, it is now common to use the logging +API without further options. + +Therefore the following configuration options have been removed: + +- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLog']` +- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLogBE']` +- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLogFE']` +- :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']` + +The following public properties have no effect anymore and have been removed: + +- :php:`AbstractUserAuthentication->writeDevLog` +- :php:`AbstractService->writeDevLog` + + +Impact +====== + +Setting any of the options does not have any effect anymore on logging. + + +Affected Installations +====================== + +Installations running with `EXT:devlog` or further extensions setting any of the options above. + + +Migration +========= + +Instead of using the mentioned options, TYPO3's Logging API can be configured as stated in the +official documentation to write the logging messages to various places. + +.. index:: LocalConfiguration, PHP-API, FullyScanned diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst index 805f10913bacd0ae2e631879d133d5d37061bf6b..47614664d6540fc9f66d636556b59511520597a8 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst @@ -15,7 +15,6 @@ Additionally these PHP symbols have been deprecated as well: - :php:`TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_*` constants - :php:`TYPO3\CMS\Core\Service\AbstractService::devLog()` -- :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']` - :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog']` .. index:: LocalConfiguration, PHP-API, NotScanned diff --git a/typo3/sysext/core/Tests/Functional/Authentication/AuthenticationServiceTest.php b/typo3/sysext/core/Tests/Functional/Authentication/AuthenticationServiceTest.php index 15921f60194f2222c69506166534e4ffe57c85bd..bd55e4095f71905bedc8a2b3ff0d772ee3c68d6b 100644 --- a/typo3/sysext/core/Tests/Functional/Authentication/AuthenticationServiceTest.php +++ b/typo3/sysext/core/Tests/Functional/Authentication/AuthenticationServiceTest.php @@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\Authentication; * * The TYPO3 project - inspiring people to share! */ +use Psr\Log\NullLogger; use TYPO3\CMS\Core\Authentication\AuthenticationService; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; @@ -30,6 +31,7 @@ class AuthenticationServiceTest extends \TYPO3\TestingFramework\Core\Functional\ protected function setUp() { $this->subject = new AuthenticationService(); + $this->subject->setLogger(new NullLogger()); parent::setUp(); $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml'); } diff --git a/typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php b/typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php index 11f147bff60a72f2b48803bfacc03b3dcb3b4e63..235b0823fbc7f27d88f2615f9caa04e264ae0773 100644 --- a/typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php +++ b/typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php @@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Authentication; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; +use Psr\Log\NullLogger; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; @@ -104,6 +105,7 @@ class BackendUserAuthenticationTest extends UnitTestCase $GLOBALS['BE_USER'] = $this->getMockBuilder(BackendUserAuthentication::class)->getMock(); $GLOBALS['BE_USER']->user = ['uid' => $this->getUniqueId()]; + $GLOBALS['BE_USER']->setLogger(new NullLogger()); /** @var BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject $subject */ $subject = $this->getMockBuilder(BackendUserAuthentication::class) @@ -111,6 +113,7 @@ class BackendUserAuthenticationTest extends UnitTestCase ->disableOriginalConstructor() ->getMock(); + $subject->setLogger(new NullLogger()); $subject->logoff(); } @@ -266,6 +269,7 @@ class BackendUserAuthenticationTest extends UnitTestCase ->setMethods(['dummy']) ->disableOriginalConstructor() ->getMock(); + $subject->setLogger(new NullLogger()); $subject->userTS = $completeConfiguration; $actualConfiguration = $subject->getTSConfig($objectString); @@ -341,6 +345,7 @@ class BackendUserAuthenticationTest extends UnitTestCase ->method('isAdmin') ->will($this->returnValue(false)); + $subject->setLogger(new NullLogger()); $subject->userTS = [ 'permissions.' => [ 'file.' => [ @@ -849,6 +854,7 @@ class BackendUserAuthenticationTest extends UnitTestCase $subject = $this->getMockBuilder(BackendUserAuthentication::class) ->setMethods(['isAdmin']) ->getMock(); + $subject->setLogger(new NullLogger()); $subject->expects($this->any()) ->method('isAdmin') ->will($this->returnValue($admin)); diff --git a/typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php b/typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php index 11b98a7f5e9c3ac136aac20655f7052c328f68f2..a98fdb3e6ac21e88c8e30cff13695b93a3a01e2a 100644 --- a/typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php +++ b/typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php @@ -278,15 +278,13 @@ class FrontendUserAuthentication extends AbstractUserAuthentication $this->TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultUserTSconfig']; // Get the info data for auth services $authInfo = $this->getAuthInfoArray(); - if ($this->writeDevLog) { - if (is_array($this->user)) { - $this->logger->debug('Get usergroups for user', [ - $this->userid_column => $this->user[$this->userid_column], - $this->username_column => $this->user[$this->username_column] - ]); - } else { - $this->logger->debug('Get usergroups for "anonymous" user'); - } + if (is_array($this->user)) { + $this->logger->debug('Get usergroups for user', [ + $this->userid_column => $this->user[$this->userid_column], + $this->username_column => $this->user[$this->username_column] + ]); + } else { + $this->logger->debug('Get usergroups for "anonymous" user'); } $groupDataArr = []; // Use 'auth' service to find the groups for the user @@ -302,16 +300,14 @@ class FrontendUserAuthentication extends AbstractUserAuthentication } unset($serviceObj); } - if ($this->writeDevLog) { - if ($serviceChain) { - $this->logger->debug($subType . ' auth services called: ' . $serviceChain); - } - if (empty($groupDataArr)) { - $this->logger->debug('No usergroups found by services'); - } - if (!empty($groupDataArr)) { - $this->logger->debug(count($groupDataArr) . ' usergroup records found by services'); - } + if ($serviceChain) { + $this->logger->debug($subType . ' auth services called: ' . $serviceChain); + } + if (empty($groupDataArr)) { + $this->logger->debug('No usergroups found by services'); + } + if (!empty($groupDataArr)) { + $this->logger->debug(count($groupDataArr) . ' usergroup records found by services'); } // Use 'auth' service to check the usergroups if they are really valid foreach ($groupDataArr as $groupData) { @@ -324,12 +320,10 @@ class FrontendUserAuthentication extends AbstractUserAuthentication $serviceObj->initAuth($subType, [], $authInfo, $this); if (!$serviceObj->authGroup($this->user, $groupData)) { $validGroup = false; - if ($this->writeDevLog) { - $this->logger->debug($subType . ' auth service did not auth group', [ - 'uid ' => $groupData['uid'], - 'title' => $groupData['title'] - ]); - } + $this->logger->debug($subType . ' auth service did not auth group', [ + 'uid ' => $groupData['uid'], + 'title' => $groupData['title'] + ]); break; } unset($serviceObj); diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 8a6c5c0dcaabee417e8048115b8e503c83f1b128..511e9863565ffd0e7d6ad7fe5721771c481d627d 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -981,9 +981,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface if (!empty($gr_array) && !$this->loginAllowedInBranch_mode) { $this->gr_list .= ',' . implode(',', $gr_array); } - if ($this->fe_user->writeDevLog) { - $this->logger->debug('Valid usergroups for TSFE: ' . $this->gr_list); - } + $this->logger->debug('Valid usergroups for TSFE: ' . $this->gr_list); } /** diff --git a/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php b/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php index 68c5f2135ac9ac82c41cd3a58f8ebff513e714fd..e90dbc7f94da638c1038b8c2729a583e18c41f67 100644 --- a/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php @@ -49,7 +49,6 @@ class FrontendUserAuthenticationTest extends UnitTestCase protected function setUp() { $this->singletonInstances = GeneralUtility::getSingletonInstances(); - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLog'] = false; } /** diff --git a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php index a5f98827efb7d8ff61275a9d7980bddc3870dfb4..65d637e36ce03155c996a24fd53811befe5e4fef 100644 --- a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php +++ b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php @@ -109,6 +109,11 @@ class SilentConfigurationUpgradeService 'SYS/dbClientCompress', // #82430 'SYS/syslogErrorReporting', + // #82639 + 'SYS/enable_DLOG', + 'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLog', + 'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLogBE', + 'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLogFE', ]; public function __construct(ConfigurationManager $configurationManager = null) diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php index ea6be089675113fc95f401d67e3cf6830f3bb9ef..3aedcc9302b9b486b35b26beb648b4c706ed8216 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php @@ -56,7 +56,22 @@ return [ ], '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'enable_DLOG\']' => [ 'restFiles' => [ - 'Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst', + 'Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst', + ], + ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_userauth.php\'][\'writeDevLog\']' => [ + 'restFiles' => [ + 'Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst', + ], + ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_userauth.php\'][\'writeDevLogFE\']' => [ + 'restFiles' => [ + 'Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst', + ], + ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_userauth.php\'][\'writeDevLogBE\']' => [ + 'restFiles' => [ + 'Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst', ], ], diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php index 998e15f5ab343ef80f0b974e48f3881fac462e82..783aeee5c6162a0b8b92d4a862297326d5730c48 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php @@ -204,5 +204,16 @@ return [ 'Breaking-82629-TceDbOptionsPrErrAndUPTRemoved.rst', ], ], + 'TYPO3\CMS\Core\Authentication\AbstractUserAuthentication->writeDevLog' => [ + 'restFiles' => [ + 'Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst', + ], + ], + 'TYPO3\CMS\Core\Service\AbstractService->writeDevLog' => [ + 'restFiles' => [ + 'Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst', + ], + ], + // Deprecated public properties ]; diff --git a/typo3/sysext/rsaauth/Classes/RsaAuthService.php b/typo3/sysext/rsaauth/Classes/RsaAuthService.php index 3a6a2dde90966a507dce0276836159a0502c741e..4fa9e97f258693bdd6ac34668fcf49ec56b27904 100644 --- a/typo3/sysext/rsaauth/Classes/RsaAuthService.php +++ b/typo3/sysext/rsaauth/Classes/RsaAuthService.php @@ -66,14 +66,10 @@ class RsaAuthService extends AuthenticationService $loginData['uident_text'] = $decryptedPassword; $isProcessed = true; } else { - if ($this->pObj->writeDevLog) { - $this->logger->debug('Process login data: Failed to RSA decrypt password'); - } + $this->logger->debug('Process login data: Failed to RSA decrypt password'); } } else { - if ($this->pObj->writeDevLog) { - $this->logger->debug('Process login data: passwordTransmissionStrategy has been set to "rsa" but no rsa encrypted password has been found.'); - } + $this->logger->debug('Process login data: passwordTransmissionStrategy has been set to "rsa" but no rsa encrypted password has been found.'); } } return $isProcessed;