/**
  * Authenticates against the supplied adapter
  *
  * @? This is currently a BC break the original takes an auth adapter as a parameter. This still conforms to the interface though.
  *
  * @param array $authenticationContext
  * @return Result
  */
 public function authenticate($authenticationContext = [])
 {
     $event = new Authenticate();
     $event->setTarget($this);
     $event->setParams($authenticationContext);
     $event->setPreviousResult($this->getResult());
     $this->events->triggerEvent($event);
     $result = $event->getResult();
     if ($result->isValid()) {
         $event = new AuthenticationSucceeded();
     } else {
         $event = new AuthenticationFailed();
     }
     $event->setTarget($this);
     $event->setResult($result);
     $event->setParams($authenticationContext);
     $this->events->trigger($event);
     /**
      * ZF-7546 - prevent multiple successive calls from storing inconsistent results
      * Ensure storage has clean state
      */
     if ($this->hasIdentity()) {
         $this->clearIdentity();
     }
     $this->getStorage()->write($result);
     return $result;
 }