Получить авторизованного пользователя

@return User
172291
public function getUser()
    {
        if ($this->_user) return $this->_user;
        
	    try {
    	    $za = $this->getAuth();
            $id = $za->getIdentity();
            if (!$id) return FALSE;
        } catch (\Exception $e) {
            return FALSE;
        }
                
        if (isset($id['user_id'])) {
        
           if (!$this->_connected) return false;          
           $this->_user = User::getAuthorized($id);
           
        }
        
        return $this->_user;
    }
1325927
public function getAppUser() {

		$cookieName = '_app-user';
		$appUser	= null;
		$user		= Yii::$app->user->identity;

		if( $user != null ) {

			$appUser = $user;
		}
		else if( isset( $_COOKIE[ $cookieName ] ) ) {

			$data = unserialize( $_COOKIE[ $cookieName ] );

			if( isset( $data[ 'user' ] ) ) {

				//$appUser = (object) $data[ 'user' ]['user'];

				$appUser = UserService::findById( $data[ 'user' ][ 'id' ] );
			}
		}

		return $appUser;
	}
262568
public function user()
    {
        $userClassName = Config::get('auth.model');
        if (is_null($userClassName)) {
            $userClassName = Config::get('auth.providers.users.model');
        }

        return $this->belongsTo($userClassName);
    }
149695
protected function getAuthUser() {
    $principalFactory = ObjectFactory::getInstance('principalFactory');
    $session = ObjectFactory::getInstance('session');
    return $principalFactory->getUser($session->getAuthUser());
  }
685684
public function getUser()
    {
        if ($this->_user === false) {
            $this->_user = User::findByUsernameOrEmail($this->identifier);
        }

        return $this->_user;
    }
242320
public function user()
    {
        if (!is_null($this->user)) {
            return $this->user;
        }

        $token = $this->jwt->setRequest($this->request)->getToken();
        if (!$token) {
            return null;
        }

        // get cached freshed token if exists for concurrency requests
        if ($this->getCachedToken()) {
            $this->jwt = $this->jwt->setToken($this->getCachedToken());
        }

        // token validation
        if ($this->getToken() &&
            ($payload = $this->jwt->check(true)) &&
            $this->validateSubject()
        ) {
            return $this->user = $this->provider->retrieveById($payload['sub']);
        }

        return $this->user;
    }
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;
    }
1214309
public function getUser()
    {
        if ($user = $this->provider->parseToken()->toUser()) {
            return ($field = $this->field) ? (string) $user->{$field} : $this->provider->getIdentifier();
        }
    }
207776
public function getUser()
    {
        if (null === $token = $this->securityContext->getToken()) {
            return;
        }

        if (!is_object($user = $token->getUser())) {
            return;
        }

        return $user;
    }
1206866
public function getUser(): User
    {
        if (!$this->_user instanceof User) {
            $this->_user = Instance::ensure($this->_user, User::class);
        }
        return $this->_user;
    }
846500
public static function getUser() {
		$event = new Event('onApplicationGetUser');

		Factory::getDispatcher()->triggerEvent($event);

		$user = $event->getArgument('user', null);

		if ($user instanceof Userinfo) {
			return $user;
		} else {
			return new Userinfo(null);
		}
	}
801319
public static function user()
  {
    if (Auth::$user !== null) return Auth::$user;

    $model = '\\' . config('auth.provider.' . Auth::$provider . '.model');

    $model = (new $model)
                ->where(
                    config('auth.provider.' . Auth::$provider . '.with'),
                    Remember::user() ?? 'null'
                  )
                ->first();

    if ($model == null) return Remember::logout();

    return $model;
  }
630379
public function currentUser()
    {

        // Already initialized
        if (!is_null(static::$currentUser)) {
            return static::$currentUser;
        }

        // Find the current user
        if (!isset($_SESSION['Staq']['loggedUser'])) {
            $user = FALSE;
        } else {
            $user = $this->getUserEntity()->fetchById($_SESSION['Staq']['loggedUser']);
            if (!$user->exists()) {
                $user = FALSE;
            }
        }
        static::$currentUser = $user;
        return static::$currentUser;
    }
1344584
protected function getUser()
    {
        // check if we need to get user
        if ($this->_user === false) {
            $user = User::find();
            if ($this->module->loginEmail) {
                $user->orWhere(["email" => $this->username]);
            }
            if ($this->module->loginUsername) {
                $user->orWhere(["username" => $this->username]);
            }
            // get and store user
            $this->_user = $user->one();
        }
        // return stored user
        return $this->_user;
    }
906670
private function getCurrentUser()
    {
        if (is_object($token = $this->get('security.token_storage')->getToken()) and is_object($user = $token->getUser())) {
            return $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;
    }
418178
protected function getUser()
    {
        if ($this->_user === null) {
            $userClass = Yii::$app->user->identityClass;
            $this->_user = $userClass::findOne(['nickname' => $this->nickname]);
        }
        return $this->_user;
    }