Repository URL to install this package:
|
Version:
1.0.0 ▾
|
<?php
/*
* This file is part of jwt-auth.
*
* (c) Sean Tymon <tymon148@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Modules\Core\Services;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTAuth;
class JWT extends JWTAuth
{
/**
* Check that the token is valid.
*
* @return bool
*/
public function check()
{
try {
$this->checkOrFail();
} catch (JWTException $e) {
return false;
}
return true;
}
/**
* Alias to get the payload, and as a result checks that
* the token is valid i.e. not expired or blacklisted.
*
* @throws \Tymon\JWTAuth\Exceptions\JWTException
*
* @return \Tymon\JWTAuth\Payload
*/
public function checkOrFail()
{
return $this->getPayload();
}
/**
* Alias for getPayload().
*
* @return \Tymon\JWTAuth\Payload
*/
public function payload()
{
return $this->getPayload();
}
/**
* Unset the current token.
*
* @return $this
*/
public function unsetToken()
{
$this->token = null;
return $this;
}
}