Get the currently authenticated user.

@return \Illuminate\Contracts\Auth\Authenticatable|null
423251
public function user()
    {
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (!is_null($this->user)) {
            return $this->user;
        }
        $user = NULL;
        $token = $this->getTokenForRequest();
        if (!empty($token)) {
            $user = $this->retrieveByToken($token);
        }

        return $this->user = $user;
    }
1314446
public function authenticate()
	{
		$user=User::model()->find('LOWER(username)=?',array(strtolower($this->username)));
		if($user===null)
			$this->errorCode=self::ERROR_USERNAME_INVALID;
		else if(!$user->validatePassword($this->password))
			$this->errorCode=self::ERROR_PASSWORD_INVALID;
		else
		{
			$this->_id=$user->id;
			$this->username=$user->username;
			$this->errorCode=self::ERROR_NONE;
		}
		return $this->errorCode==self::ERROR_NONE;
	}
966746
public function getUser()
    {
        if (self::$_oActUser === null) {
            self::$_oActUser = false;
            $user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
            if ($user->loadActiveUser()) {
                self::$_oActUser = $user;
            }
        }

        return self::$_oActUser;
    }
382945
public function getUser()
    {
        if ( null === $this->_user && $this->userId )
        {
            $this->_user = $this->getUserMapper()
                                ->find( $this->userId );
        }

        return $this->_user;
    }
381830
public static function getCurrentUsername()
	{
		if ( is_array( self::$api_session ) ) {
			$auth = self::$api_session;
		} else {
			$auth = self::sessionRead();
		}
		return ( isset( $auth['username'] ) ) ? $auth['username'] : null;
	}
1284545
public function user()
    {
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (! is_null($this->user)) {
            return $this->user;
        }

        $user = null;

        // If a user ID was provided in the JWT, then
        // we should attempt to fetch their profile.
        if (! empty($this->id())) {
            $user = $this->provider->retrieveById($this->id());
        }

        return $this->user = $user;
    }
980640
protected function GetCurrentUser()
	{
		if (!$this->_cu)
		{
			require_once("verysimple/Authentication/Authenticator.php");
			
			$this->Phreezer->Observe("Loading CurrentUser from Session");
			$this->_cu = Authenticator::GetCurrentUser($this->GUID);

			if ($this->_cu )
			{
				if (get_class($this->_cu) == "__PHP_Incomplete_Class")
				{
					// this happens if the class used for authentication was not included before the session was started
					$tmp = print_r($this->_cu,1);
					$parts1 = explode("__PHP_Incomplete_Class_Name] => ",$tmp);
					$parts2 = explode("[",$parts1[1]);
					$name = trim($parts2[0]);

					Authenticator::ClearAuthentication($this->GUID);
					throw new Exception("The class definition used for authentication '$name' must be defined (included) before the session is started, for example in _app_config.php.");
				}
				else
				{
					// refresh the current user if the object supports it
					if (method_exists($this->_cu, 'Refresh')) $this->_cu->Refresh($this->Phreezer);
				}
			}
		}
		else
		{
			$this->Phreezer->Observe("Using previously loaded CurrentUser");
		}

		return $this->_cu;
	}
337914
public function getAuthenticate()
    {
        if ($this->authenticate === null) {
            $this->authenticate = new Authenticate($this->getSecretKey(), $this->getAccessKey());
        }
        return $this->authenticate;
    }
991320
public function user()
    {
        if ($this->loggedOut) {
            return NULL;
        }
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (!is_null($this->user)) {
            if ($this->session->get('expires_at') < Carbon::now()) {
                $this->logout();

                return NULL;
            }

            return $this->user;
        }
        // First we will try to load the user using the identifier in the session if
        // one exists. Otherwise we will check for a "remember me" cookie in this
        // request, and if one exists, attempt to retrieve the user using that.
        $id = $this->session->get($this->getName());
        $user = NULL;
        if (!is_null($id)) {
            $token = $this->validateToken($id);
            if (!$token) {
                return NULL;
            }
            $user = new User();
            if ($token->hasClaim('sub')) {
                $user->id = $token->getClaim('sub');
            }
            if ($token->hasClaim('name')) {
                $user->name = $token->getClaim('name');
            }
            if ($token->hasClaim('email')) {
                $user->email = $token->getClaim('email');
            }
            if ($token->hasClaim('roles')) {
                $user->roles = explode(' ', $token->getClaim('roles'));
            }
            if ($token->hasClaim('registries')) {
                $user->registries = explode(' ', $token->getClaim('registries'));
            }
            if ($token->hasClaim('cpf')) {
                $user->cpf = $token->getClaim('cpf');
            }
            if ($token->hasClaim('avatar')) {
                $user->avatar = $token->getClaim('avatar');
            }
            if ($user) {
                $this->fireAuthenticatedEvent($user);
            }
        }

        return $this->user = $user;
    }
1012580
public function user()
    {
        if (! $this->user) {
            $this->user = app(Users::class)->find(auth()->guard()->id());
        }

        return $this->user;
    }
985216
public function getAuthenticatedUser()
	{
		// Build the request path.
		$path = '/user';

		// Send the request.
		return $this->processResponse(
			$this->client->get($this->fetchUrl($path))
		);
	}
281477
public function getLoggedUser()
    {
        $credentials = $this->storage->getLoggedUser();

        return is_array($credentials) ? new User($credentials) : null;
    }
718908
public function getAuthor()
    {
        $user = null;

        if($this->hasProperty('created_by') && !empty($this->created_by)) {
            $user = $this->getObject('user.provider')->getUser($this->created_by);
        }

        return $user;
    }
699418
public function user()
    {
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (! is_null($this->user)) {
            return $this->user;
        }

        $user = null;

        if ($this->jwt->isHealthy()) {
            $id = $this->jwt->getId();
            $user = $this->provider->retrieveById($id);
        }

        return $this->user = $user;
    }
920367
public function getActiveUser()
    {
        if ($this->_oActiveUserObject === null) {
            $this->_oActiveUserObject = false;

            /** @var oxUser $oUser */
            $oUser = $this->getObjectFactory()->createOxidObject('oxUser');

            if ($oUser->loadActiveUser() === true) {
                $this->_oActiveUserObject = $oUser;
            }
        }

        return $this->_oActiveUserObject;
    }
144036
public function getCurrentUser()
    {
        if ($this->currentuser === null) {
            $hash = $this->getCurrentSessionHash();
            if ($hash === false) {
                return false;
            }

            $uid = $this->getSessionUID($hash);
            if ($uid === false) {
                return false;
            }

            $this->currentuser = $this->getUser($uid);
        }
        return $this->currentuser;
    }
1224224
public function getUser()
    {

        $resource = '/users/' . $this->userId;
        $response = $this->makeAuthenticatedApiRequest($resource);
        return $response->user;

    }