/** * 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; }
/** * 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; }