Get the currently authenticated user.

@return \Illuminate\Contracts\Auth\Authenticatable|null
551156
public function user()
    {
        if ($this->user !== null) {
            return $this->user;
        }

        if ($this->jwt->setRequest($this->request)->getToken() &&
            ($payload = $this->jwt->check(true)) &&
            $this->validateSubject()
        ) {
            return $this->user = $this->provider->retrieveById($payload['sub']);
        }
    }
1096791
public function getCurrentUser() {
    if (empty($this->currentUser)) {
      $this->currentUser = \Drupal::service('current_user');
    }
    return $this->currentUser;
  }
849555
public function getUser() {
        $session = $this->session_manager->session;

        if ($session && !$this->user) {
            $user_id = $session->get(Auth::getName());

            if ($user_id && is_null($this->user)) {
                $user_model = Config::get('auth.providers.users.model');

                if ($user_model) {
                    $this->user = $user_model::find($user_id);
                }
            } else {
                $this->user = null;
            }
        }

        return $this->user;
    }
434848
public function getLocaleFromAuthenticatedUser()
    {

        $user = $this->findAuthenticatedUser();

        return (null !== $user && $user->getLocale()) ? $user->getLocale() : 'es';
    }
90265
public function getuser(){
		if(empty($this->user)){
			return NULL;
			}
		bimport('users.general');
		$bu=BUsers::getInstance();
		$user=$bu->itemGet($this->user);
		return $user;
		}
1147027
public function getUser()
    {
        /** @var AbstractAdmin $admin */
        $admin = $this;

        $container = $admin->getContainer();

        if (!$container->has('security.token_storage')) {
            return null;
        }

        $tokenStorage = $container->get('security.token_storage');

        if (null === $token = $tokenStorage->getToken()) {
            return null;
        }

        if (!\is_object($user = $token->getUser())) {
            // e.g. anonymous authentication
            return null;
        }

        return $user;
    }
696524
public static function authenticate()
    {
        //if there is no username or password, fail
        if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
            return null;
        }

        // With a valid user and password, check the password is correct
        $data = [
            'Email' => $_SERVER['PHP_AUTH_USER'],
            'Password' => $_SERVER['PHP_AUTH_PW'],
        ];
        $request = Controller::curr()->getRequest();
        $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::LOGIN);
        $member = null;
        foreach ($authenticators as $authenticator) {
            $member = $authenticator->authenticate($data, $request);
            if ($member) {
                break;
            }
        }
        return $member;
    }
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;
    }
845650
public function getUser()
    {
        // Ensure we have the user info
        if ($this->user === null) {
            $this->exchangeCode();
        }

        if (! is_array($this->user)) {
            return null;
        }

        return $this->user;
    }
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;
    }
1041910
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->provider->retrieveByCredentials(
                array($this->storageKey => $token)
            );
        }

        return $this->user = $user;
    }
67097
static function currentUser()
    {
        $user = self::instance();
        if ( $user->isAnonymous() || $user->isEnabled() )
        {
            return $user;
        }
        self::logoutCurrent();
        return self::instance();
    }
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;
    }
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;
    }
433162
public function user()
	{
		if ($this->loggedOut)
		{
			return null;
		}

		if (!is_null($this->user))
		{
			return $this->user;
		}

		return $this->user = wp_get_current_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;
	}
1224224
public function getUser()
    {

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

    }