getPassword() public method

Returns the password used to authenticate the user.
public getPassword ( ) : string
return string The password
コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function checkAuthentication(AccountInterface $account, UsernamePasswordToken $token)
 {
     $user = $token->getUser();
     if ($user instanceof AccountInterface) {
         if ($account->getPassword() !== $user->getPassword()) {
             throw new BadCredentialsException('The credentials were changed from another session.');
         }
     } else {
         if (!($presentedPassword = (string) $token->getCredentials())) {
             throw new BadCredentialsException('Bad credentials');
         }
         if (!$this->passwordEncoder->isPasswordValid($account->getPassword(), $presentedPassword, $account->getSalt())) {
             throw new BadCredentialsException('Bad credentials');
         }
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function checkAuthentication(AccountInterface $account, UsernamePasswordToken $token)
 {
     if (!($presentedPassword = (string) $token->getCredentials())) {
         throw new BadCredentialsException('Bad credentials');
     }
     if (!$this->passwordEncoder->isPasswordValid($account->getPassword(), $presentedPassword, $account->getSalt())) {
         throw new BadCredentialsException('Bad credentials');
     }
 }
コード例 #3
0
ファイル: User.php プロジェクト: naderman/UserBundle
    /**
     * Implementation of AccountInterface.
     *
     * @param AccountInterface $account
     * @return boolean
     */
    public function equals(AccountInterface $account)
    {
        if (!$account instanceof User) {
            return false;
        }

        if ($this->password !== $account->getPassword()) {
            return false;
        }
        if ($this->getSalt() !== $account->getSalt()) {
            return false;
        }
        if ($this->usernameCanonical !== $account->getUsernameCanonical()) {
            return false;
        }
        if ($this->isAccountNonExpired() !== $account->isAccountNonExpired()) {
            return false;
        }
        if (!$this->locked !== $account->isAccountNonLocked()) {
            return false;
        }
        if ($this->isCredentialsNonExpired() !== $account->isCredentialsNonExpired()) {
            return false;
        }
        if ($this->enabled !== $account->isEnabled()) {
            return false;
        }

        return true;
    }