Ensure that a token is available in the request.

@throws \Tymon\JWTAuth\Exceptions\JWTException

@return \Tymon\JWTAuth\JWT
777846
protected function requireToken()
    {
        if (! $this->jwt->setRequest($this->getRequest())->getToken()) {
            throw new JWTException('Token could not be parsed from the request.');
        }

        return $this->jwt;
    }
965172
protected function registerJWTAuth()
    {
        $this->app->singleton('lia.jwt.auth', function ($app) {
            $auth = new JWTAuth(
                $app['lia.jwt.manager'],
                $app['lia.jwt.provider.user'],
                $app['lia.jwt.provider.auth'],
                $app['request']
            );

            return $auth->setIdentifier($this->config('identifier'));
        });
    }
323561
public function jwtToken($request = null)
    {
        $token = $this->getToken($request);
        if( ! $token) throw new NoTokenException('JWT token is required.');

        $driver = $this->makeDriver();
        $jwt = new JwtToken($driver);
        $jwt->setToken($token);

        return $jwt;
    }
1136256
protected function registerTokenParser()
    {
        $this->app->singleton('tymon.jwt.parser', function ($app) {
            $parser = new Parser(
                $app['request'],
                [
                    new AuthHeaders,
                    new QueryString,
                    new InputSource,
                    new RouteParams,
                    new Cookies,
                ]
            );

            $app->refresh('request', $parser, 'setRequest');

            return $parser;
        });
    }
367916
public function token()
    {
        $inputs = $this->getInputs();
        $headers = $this->headers();

        // Read token from request custom header
        if (isset($headers['X-Auth-Token'])) {
            return $headers['X-Auth-Token'];
        }

        // Read token from request input
        if (isset($inputs['token'])) {
            return $inputs['token'];
        }

        // Otherwise, return false
        return false;
    }
662482
protected function requireToken($token)
    {
        if ($token) {
            return $this->setToken($token);
        } elseif ($this->token) {
            return $this;
        } else {
            throw new JWTException('A token is required', 400);
        }
    }
39530
public function getToken()
    {
        if (! $this->token) {
            try {
                $this->parseToken();
            } catch (JwTException $e) {
                return false;
            }
        }

        return $this->token;
    }
241703
public function getRequestToken()
    {
        $token = false;

        foreach ($this->sources as $source) {
            if (($token = $source->getRequestToken()) !== false) {
                break;
            }
        }

        return $token;
    }
163148
protected function registerJWTProvider()
    {
        $this->registerNamshiProvider();
        $this->registerLcobucciProvider();

        $this->app->singleton('tymon.jwt.provider.jwt', function ($app) {
            return $this->getConfigInstance('providers.jwt');
        });
    }
971025
protected function getSigner()
    {
        if (! array_key_exists($this->algo, $this->signers)) {
            throw new JWTException('The given algorithm could not be found');
        }

        return new $this->signers[$this->algo];
    }
803343
public function authenticate()
    {
        $request = new Request($this->handler);
        $this->token = $request->execute(
            RequestMethods::HTTP_POST,
            $this->makeUrl(RequestMethods::DOMUSERP_API_PEDIDOVENDA . '/auth'),
            [
                'json' => [
                    'login'    => $this->username,
                    'password' => $this->password
                ]
            ]
        )->token;

        return $this;
    }
153341
function getToken()
    {
        if (! $this->token )
            $this->token = $this->exchangeToken();
        elseif (\Poirot\OAuth2Client\checkExpiry( $this->token->getDateTimeExpiration() ))
            $this->token = $this->exchangeToken();


        return $this->token;
    }
57503
protected function getToken()
    {
        $temp = $this->request->getSession()->get('oauth.temp');

        return $this->server->getTokenCredentials(
            $temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')
        );
    }
37563
public function getToken()
    {

        $request = new Request();

        if ($request->isPost() === true) {
            $this->token = $request->getPost('token', null, false);
        } else {
            $this->token = $request->getQuery('token', null, false);
        }

        return $this->token;
    }
1233359
public function getRequestToken()
    {
        // Nullify any request token we already have
        $this->storage->set(null, 'request_token');
        $url = API::API_URL . self::REQUEST_TOKEN_METHOD;
        $response = $this->fetch('POST', $url, '');
        $token = $this->parseTokenString($response['body']);
        $this->storage->set($token, 'request_token');
    }
268829
public function getAccessToken() {
        if (!is_null($this->_cachedAccessToken) &&
            $this->_cachedAccessToken->isValid()) {
            return $this->_cachedAccessToken;
        }

        $this->_cachedAccessToken = $this->acquireAccessToken();
        return $this->_cachedAccessToken;
    }
1091196
public function getJWT()
	{
		if($this->personalKeyPair === NULL)
			throw new \Exception("JWT cannot be built without the personalKey");
		
		// create and sign JWT
		$signer = new Sha512();
		
		$personalPrivateKey = PrivateKey::formatPEM($this->personalKeyPair->getPrivateKey());
		
		$token = (new Builder())
			->set('socialRecord', base64_encode($this->socialRecord->getJSONString()))
			->sign($signer, $personalPrivateKey)
			->getToken();
		
		return $token->__toString();
	}