/**
  * setCredentialHashingStrategy
  *
  * Set the strategy used to hash and verify the users password.
  *
  * @param  AuthenticationEvent  $event  The authentication event.
  *
  * @return void
  */
 public function setCredentialHashingStrategy(AuthenticationEvent $event)
 {
     $adapter = $event->getAdapter();
     if (!$adapter instanceof PasswordStrategyAwareInterface) {
         return;
     }
     $adapter->setPasswordStrategy($this->passwordStrategy);
 }
 /**
  * prepareAdapterIdentity
  *
  * Inject the identity and credential values into the authentication adapter.
  *
  * @param AuthenticationEvent $event  The authentication event.
  */
 public function prepareValidatableAdapter(AuthenticationEvent $event)
 {
     $adapter = $event->getAdapter();
     if (!$adapter instanceof ValidatableAdapterInterface) {
         return;
     }
     $identity = $event->getParam($this->identityFieldName, false);
     $credential = $event->getParam($this->credentialFieldName, false);
     if (!empty($identity) && is_string($identity)) {
         $adapter->setIdentity($identity);
     }
     if (!empty($credential) && is_string($credential)) {
         $adapter->setCredential($credential);
     }
 }
 /**
  * onAuthenticate
  *
  * Perform the authentication action and stop event propagation
  * if the result returned is a success.
  *
  * @param AuthenticationEvent $event  The authentication event.
  */
 public function onAuthentication(AuthenticationEvent $event)
 {
     $result = $this->auth->authenticate();
     if ($result instanceof AuthResult) {
         $event->setResult($result);
         if (AuthResult::SUCCESS === $result->getCode() && $result->getIdentity()) {
             $event->stopPropagation(true);
             return;
         }
     }
 }