@return \OAuth\UserData\Extractor\ExtractorInterface

@throws \OAuth\UserData\Exception\UndefinedExtractorException
550484
public function getExtractor($new = false)
    {
        if ($new || !$this->extractor) {
            $this->extractor = $this->app->make('oauth_extractor', [$this->getService()]);
        }

        return $this->extractor;
    }
149695
protected function getAuthUser() {
    $principalFactory = ObjectFactory::getInstance('principalFactory');
    $session = ObjectFactory::getInstance('session');
    return $principalFactory->getUser($session->getAuthUser());
  }
1258752
protected function getUser()
    {
        if (!$this->tokenStorage instanceof TokenStorageInterface) {
            throw new \LogicException('The SecurityBundle is not registered in your application.');
        }

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

        /*
         * @var TokenInterface
         */
        if (!is_callable([$token, 'getUser']) || !is_object($user = $token->getUser())) {
            // e.g. anonymous authentication
            return null;
        }

        return $user;
    }
1190942
public function addExtractor(ExtractorInterface $extractor): self
    {
        $this->extractors[$extractor->name()] = $extractor;

        return $this;
    }
1099442
public function getHandler()
    {
        if(!$this->_handler instanceof UserSessionHandlerInterface)
        {
            $this->_handler = $this->getObject($this->_handler);

            if(!$this->_handler instanceof UserSessionHandlerInterface)
            {
                throw new \UnexpectedValueException(
                    'Handler: '.get_class($this->_handler).' does not implement UserSessionHandlerInterface'
                );
            }
        }

        return $this->_handler;
    }
1345702
public function extract($object)
    {
        if (!$object instanceof UserBlock) {
            throw new \Exception('$object must be an instance of UserBlock');
        }
        /* @var $object UserBlock */
        $data = parent::extract($object);

        return $data;
    }
1050464
public function findAuthenticatedUser()
    {

        $token = $this->getSecurityTokenStorage()->getToken();

        if (null !== $token) {

            $user = $token->getUser();

            if (is_object($user) && $user instanceof UserInterface) {
                return $user;
            }

        }
        return null;
    }
531269
public function getAuthenticatedUser ()
    {
        $curUserEntity = $this->ServiceContainer->get('security.context')->getToken()->getUser();
        if (!is_object($curUserEntity)) {
            throw new Exception("No authenticated user found");
        }

        $CurUser = $this->getModelRepository('User')->getById($curUserEntity->getId());
        return $CurUser;
    }
1252462
public function getUser()
    {
        if ($user = $this->provider->user()) {
            return ($field = $this->field) ? (string) $user->{$field} : $user->getAuthIdentifier();
        }
    }
252859
protected function attemptAuthentication()
    {
        $extractor = $this->getExtractor();

        if (!$this->isValid()) {
            throw new Exception(
                'Invalid account, user cannot be logged in.');
        }

        $user_id = $this->getBoundUserID($extractor->getUniqueId());

        if ($user_id && $user_id > 0) {
            $user = User::loginByUserID($user_id);
            if ($user && !$user->isError()) {
                return $user;
            }
        }

        if ($extractor->supportsEmail() && $user = \UserInfo::getByEmail($extractor->getEmail())) {
            if ($user && !$user->isError()) {
                throw new Exception('A user account already exists for this email, please log in and attach from your account page.');
            }
        }

        if ($this->supportsRegistration()) {
            if ($extractor->getEmail() === null || empty($extractor->getEmail())) {

                /** @var FlashBagInterface $flashbag */
                $flashbag = $this->app->make('session')->getFlashBag();
                if ($this->supportsFullName()) {
                    $flashbag->set('fullName', $this->getFullName());
                } else {
                    $flashbag->set('firstName', $this->getFirstName());
                    $flashbag->set('lastName', $this->getLastName());
                }
                $flashbag->set('username', $this->getUsername());
                $flashbag->set('token', $this->getToken());


                $response = \Redirect::to('/login/callback/' . $this->getHandle() . '/handle_register/', id(new Token())->generate($this->getHandle() . '_register'));
                $response->send();
                exit;

            } else {
                $user = $this->createUser();

                return $user;
            }
        }

        return null;
    }
243893
public function extract($object)
    {
        $data = [];
        if ($object->getId() !== null) {
            $data['id'] = $object->getId();
        }
        $data['name'] = $object->getName();
        $data['isdefault'] = $object->isDefault() ? 1 : 0;
        return $data;
    }
394122
public function extract()
    {
        if ($this->extractedWorkDir !== null) {
            return;
        }
        if (!is_file($this->packageArchive)) {
            throw new UserMessageException(t('Archive not found: %s', $this->packageArchive));
        }
        try {
            $workDir = $this->getVolatileDirectory()->getPath();
            try {
                $this->app->make('helper/zip')->unzip($this->packageArchive, $workDir);
            } catch (\Exception $x) {
                throw new UserMessageException($x->getMessage());
            }
            $fs = $this->getVolatileDirectory()->getFilesystem();
            $dirs = array_filter($fs->directories($workDir), function ($dn) {
                return strpos(basename($dn), '.') !== 0;
            });
            if (count($dirs) === 1) {
                $someFile = false;
                foreach ($fs->files($workDir) as $fn) {
                    if (strpos(basename($fn), '.') !== 0) {
                        $someFile = true;
                        break;
                    }
                }
                if ($someFile === false) {
                    $workDir = $dirs[0];
                }
            }
        } catch (\Exception $x) {
            $this->volatileDirectory = null;
            throw $x;
        }
        $this->extractedWorkDir = $workDir;
    }
149292
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
    {
        $token = $this->userProvider->getDecodedToken($credentials['jwt']);
        $clientKey = $token->iss;

        if (!$clientKey) {
            throw new AuthenticationException(
                \sprintf('API Key "%s" does not exist.', $credentials['jwt'])
            );
        }

        /** @var TenantInterface|UserInterface $user */
        $user = $this->userProvider->loadUserByUsername($clientKey);
        if (\property_exists($token, 'sub')) {
            // for some reasons, when webhooks are called - field sub is undefined
            $user->setUsername($token->sub);
        }

        return $user;
    }
285267
public function getFieldsInQuery()
    {
        $query = isset($this->query['query']) ? $this->query['query'] : array();
        $sort = isset($this->query['sort']) ? $this->query['sort'] : array();

        $extractor = new FieldExtractor($query, $sort);
        return $extractor->getFields();
    }
1026915
protected function getUser()
    {
        /** @var OAuth2IdentityInterface $identityClass */
        $identityClass = Yii::$app->user->identityClass;

        $identityObject = Yii::createObject($identityClass);
        if (! $identityObject instanceof OAuth2IdentityInterface) {
            $this->errorServer(Yii::t('conquer/oauth2', 'OAuth2IdentityInterface is not implemented.'));
        }

        if ($this->_user === null) {
            $this->_user = $identityClass::findIdentityByUsername($this->username);
        }

        return $this->_user;
    }
1174427
public Extractor getExtractor() {
    try {
      this.rawSourceExtractor = getSource().getExtractor(this.taskState);
      boolean throttlingEnabled = this.taskState.getPropAsBoolean(ConfigurationKeys.EXTRACT_LIMIT_ENABLED_KEY,
          ConfigurationKeys.DEFAULT_EXTRACT_LIMIT_ENABLED);
      if (throttlingEnabled) {
        Limiter limiter = DefaultLimiterFactory.newLimiter(this.taskState);
        if (!(limiter instanceof NonRefillableLimiter)) {
          throw new IllegalArgumentException("The Limiter used with an Extractor should be an instance of "
              + NonRefillableLimiter.class.getSimpleName());
        }
        return new LimitingExtractorDecorator<>(this.rawSourceExtractor, limiter, this.taskState);
      }
      return this.rawSourceExtractor;
    } catch (IOException ioe) {
      throw new RuntimeException(ioe);
    }
  }
1197162
protected function _getAuth() {
		if ($this->auth) {
			return $this->auth;
		}

		$authAllow = Cache::read($this->getConfig('allowCacheKey'), $this->getConfig('cache'));
		if (!$authAllow) {
			//TOOD make refactor to collect data at runtime? Should not be necessary if AuthComponent is used properly.
			throw new Exception('Cache for Authentication data not found. This is required for `includeAuthentication` as true. Make sure you enabled TinyAuth.AuthComponent.');
		}

		$this->auth = $authAllow;

		return $authAllow;
	}