/** * @param Firewall $firewall * * @dataProvider firewallProvider */ public function testAuthenticateFalse($firewall) { $user = new User(); $user->populate('kent', 'batman', [new Role('ROLE_SUPERHERO')]); $login = new Login('kent', 'superman'); $this->assertFalse($user->authenticate($login, $firewall)); }
/** * Get the user from user provided for the given instance of Login object. * NOTE: The method gets the users based on his username only, password is not verified, this is part of * the authentication process. * * @param Login $login Instance of Login object. * * @return UserAbstract * @throws UserNotFoundException */ public function getUser(Login $login) { $username = $login->getUsername(); if (!isset($this->users[$username]) || !$this->isArray($this->users[$username])) { throw new UserNotFoundException('User "' . $username . '" was not found.'); } $userData = $this->users[$username]; $user = new User(); $user->populate($username, $userData['password'], $userData['roles'], false); return $user; }