getPassword() public method

This should be the encoded password. On authentication, a plain-text password will be salted, encoded, and then compared to this value.
public getPassword ( ) : string
return string The password
示例#1
0
 /**
  * Iterates over legacy SSO handlers, and pre-authenticates a user if a handler returns one.
  *
  * @param Request $request A Request instance
  *
  * @return array An array composed of the user and the credentials
  */
 protected function getPreAuthenticatedData(Request $request)
 {
     $kernelClosure = $this->legacyKernelClosure;
     /** @var \ezpKernelHandler $legacyKernel */
     $legacyKernel = $kernelClosure();
     $logger = $this->logger;
     $legacyUser = $legacyKernel->runCallback(function () use($logger) {
         foreach (eZINI::instance()->variable('UserSettings', 'SingleSignOnHandlerArray') as $ssoHandlerName) {
             $className = 'eZ' . $ssoHandlerName . 'SSOHandler';
             if (!class_exists($className)) {
                 if ($logger) {
                     $logger->error("Undefined legacy SSOHandler class: {$className}");
                 }
                 continue;
             }
             $ssoHandler = new $className();
             $ssoUser = $ssoHandler->handleSSOLogin();
             if (!$ssoUser instanceof eZUser) {
                 continue;
             }
             $logger->info("Matched user using eZ legacy SSO Handler: {$className}");
             return $ssoUser;
         }
     }, false, false);
     // No matched user with legacy.
     if (!$legacyUser instanceof eZUser) {
         return array('', '');
     }
     $user = new User($this->userService->loadUser($legacyUser->attribute('contentobject_id')), array('ROLE_USER'));
     return array($user, $user->getPassword());
 }
示例#2
0
 public function testConstruct()
 {
     $login = '******';
     $passwordHash = 'encoded_password';
     $apiUser = $this->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\User\\User')->setConstructorArgs(array(array('login' => $login, 'passwordHash' => $passwordHash, 'enabled' => true)))->getMockForAbstractClass();
     $roles = array('ROLE_USER');
     $user = new User($apiUser, $roles);
     $this->assertSame($apiUser, $user->getAPIUser());
     $this->assertSame($login, $user->getUsername());
     $this->assertSame($passwordHash, $user->getPassword());
     $this->assertSame($roles, $user->getRoles());
     $this->assertNull($user->getSalt());
     $this->assertTrue($user->isAccountNonExpired());
     $this->assertTrue($user->isAccountNonLocked());
     $this->assertTrue($user->isCredentialsNonExpired());
     $this->assertTrue($user->isEnabled());
 }