Ejemplo n.º 1
0
 /**
  * Authenticates user with identity
  *
  * @param \Vegas\Security\Authentication\GenericUserInterface $user
  * @param $credential
  * @throws \Vegas\Security\Authentication\Exception\IdentityNotFoundException
  * @return bool
  */
 public function authenticate(GenericUserInterface $user, $credential)
 {
     $userAttributes = $user->getAttributes();
     if (empty($userAttributes)) {
         throw new IdentityNotFoundException();
     }
     $this->store($user->getAttributes());
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Authenticates user with indicated credential
  *
  * @param \Vegas\Security\Authentication\GenericUserInterface $user
  * @param $credential
  * @throws \Vegas\Security\Authentication\Exception\InvalidCredentialException
  * @return bool
  */
 public function authenticate(GenericUserInterface $user, $credential)
 {
     $authenticationResult = $this->passwordManager->validate($credential, $user->getCredential());
     if (!$authenticationResult) {
         throw new InvalidCredentialException();
     }
     $this->store($user->getAttributes());
     return true;
 }