authencicateUser

@param $username

@return object
346747
public function authenticateUser($username)
    {
        if ($username)
        {
            $user = $this->userManager->findUserBy(['username' => $username]);

            if ($user)
            {
                $usernamePasswordToken = new UsernamePasswordToken($user->getUsername(), $user->getPlainPassword(), 'default', $user->getRoles());
                $this->tokenStorage->setToken($usernamePasswordToken);

                return $user;
            }
        }
        return false;
    }
577610
public function removeUser($userToken, $username)
    {
        $removeUserInput = new OneClickRemoveUserInput();
        $removeUserInput->tbkUser = $userToken;
        $removeUserInput->username = $username;

        return $this->service->removeUser($removeUserInput)->return;
    }
300638
public function getUserToken(string $userName) : string {
        if (isset($this->userToken[$userName])) {
            return $this->userToken[$userName];
        }
    }
394769
public function loadUserByUsername($username): User
    {
        foreach ($this->userRepositoryCollection->all() as $repository) {
            $user = $repository->findByUsername($username);

            if ($user instanceof User) {
                return $user;
            }
        }

        throw new UsernameNotFoundException(
            sprintf('Username "%s" does not exist.', $username)
        );
    }
528687
public function loadUserByUsername($username)
    {
        $user = $this->segmentalizer->loadUserByUsername($username);
        if (call_user_func($this->filter, $user)) {
            return $user;
        }
        throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
    }
812923
public function getByUsername ($username)
    {
        $entity = $this->er->findOneBy(array('username' => $username));

        if (NULL == $entity) {
            throw new Exception("User not found: username=$username");
        }

        return $this->getModel($entity);
    }
976726
public function userLogin($username, $password)
    {
        return $this->requestHandler->sendRequestAsync('POST', 'api/v4/users/login/',
            [
                'form_params' => [
                    'username' => $username,
                    'password' => $password
                ]
            ])->then(
            function ($result) {
                $this->requestHandler->setAccessTokenCredentials($result['tokenKey'], $result['tokenSecret']);
                return $result;
            }
        );
    }
202443
public static function find($username)
    {
        $user = json_decode(self::get("/users/{$username}")->getBody(), true);
        
        return new self($user);
    }
1055846
public function username($username = null)
    {
        if (func_num_args() === 0) {
            return $this->_username;
        }
        $this->_username = $username ?: null;
        return $this;
    }
652669
public static function userExists($username)
	{
		if ( ! is_array( self::$auth ) ) throw new Exception( 'Authentication not initialized' );
		return ( isset( self::$auth['users'][ $username ] ) );
	}
56210
public function authenticate($username, $password)
    {
        try {
            $user = $this->userProvider->loadUserByUsername($username);
        } catch (UsernameNotFoundException $e) {
            return null;
        }

        $valid = $this->encoderFactory->getEncoder($user)->isPasswordValid(
            $user->getPassword(),
            $password,
            $user->getSalt()
        );

        if ($valid) {
            return $user;
        }

        return null;
    }
214476
public static function user(array $authConfig, $username)
    {
        $model = $authConfig['model'];
        $fields = static::getFields($authConfig);

        if (is_array($fields) && count($fields) == 2) {
            return $model::where($fields[0], $username)->orWhere($fields[1], $username)->first();
        }

        return $model::where($fields[0], $username)->first();
    }
81224
public function createUser($username)
    {
        $user = new User();
        $user->setUsername($username);
        $violations = $this->validator->validate($user);
        if ($violations->count() > 0) {
            throw BadUsernameException::createFromViolations($violations);
        }

        return $user;
    }
1034384
public function getUser($username)
    {
        try {
            $response = $this->client->adminGetUser([
                'Username' => $username,
                'UserPoolId' => $this->userPoolId,
            ]);
            return $response;
        } catch (Exception $e) {
            throw CognitoResponseException::createFromCognitoException($e);
        }
    }
254649
public function findUserByUsername($username)
    {
        $qb = $this->createQueryBuilder('user')
            ->where('user.username=:username');

        $query = $qb->getQuery();
        $query->setParameter('username', $username);

        return $query->getSingleResult();
    }
694869
public function basicAuth($username, $password)
    {
        $this->auth = new BasicAuth($username, $password);
        return $this->auth;
    }
1002961
public function setBasicAuthentication($username = '', $password = '')
    {
        $this->basicAuthentication = [
            'username' => $username,
            'password' => $password
        ];
        $this->debug->info(__FUNCTION__, 'setBasicAuthentication: ', $this->basicAuthentication);

        return $this;
    }