Example #1
0
 /**
  * Logs calls and results of the authenticate() method of the Authentication Manager
  *
  * @FLOW3\After("within(TYPO3\FLOW3\Security\Authentication\AuthenticationManagerInterface) && method(.*->authenticate())")
  * @param \TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint The current joinpoint
  * @return mixed The result of the target method if it has not been intercepted
  * @throws \Exception
  */
 public function logManagerAuthenticate(\TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint)
 {
     if ($joinPoint->hasException()) {
         $exception = $joinPoint->getException();
         $this->securityLogger->log('Authentication failed: "' . $exception->getMessage() . '" #' . $exception->getCode(), LOG_NOTICE);
         throw $exception;
     } elseif ($this->alreadyLoggedAuthenticateCall === FALSE) {
         if ($joinPoint->getProxy()->getSecurityContext()->getAccount() !== NULL) {
             $this->securityLogger->log('Successfully re-authenticated tokens for account "' . $joinPoint->getProxy()->getSecurityContext()->getAccount()->getAccountIdentifier() . '"', LOG_INFO);
         } else {
             $this->securityLogger->log('No account authenticated', LOG_INFO);
         }
         $this->alreadyLoggedAuthenticateCall = TRUE;
     }
 }