コード例 #1
0
ファイル: NoCredential.php プロジェクト: maniolek/auth
 /**
  * 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;
 }
コード例 #2
0
ファイル: Standard.php プロジェクト: maniolek/auth
 /**
  * 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;
 }