[!!!][TASK] Always use logging in authentication processes 53/54253/7
authorBenni Mack <benni@typo3.org>
Mon, 2 Oct 2017 05:28:51 +0000 (07:28 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 4 Oct 2017 08:34:43 +0000 (10:34 +0200)
There are several checks within AuthenticationService, AbstractUserAuthentication
and AbstractService which can be dropped now that the Logging API is fully
configurable.

The following options have no effect anymore:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLog']
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLogBE']
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['writeDevLogFE']
$GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']

The following public properties have no effect anymore and are removed:
* AbstractUserAuthentication->writeDevLog
* AbstractService->writeDevLog

Resolves: #82639
Relates: #52694
Releases: master
Change-Id: I01a1319bb4f34da03980ce04d8d30b6fe510eae2
Reviewed-on: https://review.typo3.org/54253
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
18 files changed:
typo3/sysext/core/Classes/Authentication/AbstractAuthenticationService.php
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/core/Classes/Authentication/AuthenticationService.php
typo3/sysext/core/Classes/Service/AbstractService.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
typo3/sysext/core/Documentation/Changelog/master/Breaking-82639-LoggingActivatedForAuthenticationAndServiceClasses.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Deprecation-52694-DeprecatedGeneralUtilitydevLog.rst
typo3/sysext/core/Tests/Functional/Authentication/AuthenticationServiceTest.php
typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php
typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php
typo3/sysext/rsaauth/Classes/RsaAuthService.php

index 55ef657..71169c7 100644 (file)
@@ -71,15 +71,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
      *
      * @param string $mode Subtype of the service which is used to call the 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;
     }
 
     /**
index 3aa361c..c845c71 100644 (file)
@@ -328,15 +328,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
      */
     public $uc;
@@ -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;
     }
index 3bea763..a125cc5 100644 (file)
@@ -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;
index c10eb0d..f204c4f 100644 (file)
@@ -39,15 +39,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.
      */
     public $out = '';
@@ -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);
     }
 
     /**
index e34d6c2..1c5586d 100644 (file)
@@ -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) {
index fe2da94..cf1265a 100644 (file)
@@ -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,
index 66f1ded..0a30dec 100644 (file)
@@ -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 (file)
index 0000000..85def81
--- /dev/null
@@ -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
index 805f109..4761466 100644 (file)
@@ -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
index 15921f6..bd55e40 100644 (file)
@@ -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');
     }
index 11f147b..235b082 100644 (file)
@@ -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));
index 11b98a7..a98fdb3 100644 (file)
@@ -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);
index 8a6c5c0..511e986 100644 (file)
@@ -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);
     }
 
     /**
index 68c5f21..e90dbc7 100644 (file)
@@ -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;
     }
 
     /**
index a5f9882..65d637e 100644 (file)
@@ -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)
index ea6be08..3aedcc9 100644 (file)
@@ -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',
         ],
     ],
 
index 998e15f..783aeee 100644 (file)
@@ -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
 ];
index 3a6a2dd..4fa9e97 100644 (file)
@@ -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;