/** * Performs an authentication attempt * * @return \Zend\Authentication\Result * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface If authentication cannot be performed */ public function authenticate() { $result = $this->provider->resolve($this->getIdentity()); if (!$result->isValid()) { return $result; } /* @var $identities \SilexCMF\ZendAuthentication\User\UserInterface[] */ $identities = $result->getIdentity(); $identities = !is_array($identities) ? [$identities] : $identities; foreach ($identities as $identity) { $isPasswordValid = $this->encoder->isPasswordValid($identity->getPassword(), $this->getCredential(), $identity->getSalt()); if ($isPasswordValid) { return Result::success($identity); } } return Result::failureCredentialInvalid(); }