fix
This commit is contained in:
parent
13d763a2d4
commit
4c059d1452
|
@ -16,5 +16,5 @@ class InvalidClaimException extends JWTException
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $statusCode = 400;
|
protected $statusCode = 401;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,5 @@ class TokenInvalidException extends JWTException
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
protected $statusCode = 400;
|
protected $statusCode = 401;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ class JWTAuth
|
||||||
{
|
{
|
||||||
if (! $token = $this->parseAuthHeader($header, $method)) {
|
if (! $token = $this->parseAuthHeader($header, $method)) {
|
||||||
if (! $token = $this->request->query($query, false)) {
|
if (! $token = $this->request->query($query, false)) {
|
||||||
throw new JWTException('The token could not be parsed from the request', 400);
|
throw new JWTException('The token could not be parsed from the request', 401);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class GetUserFromToken extends BaseMiddleware
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, \Closure $next)
|
||||||
{
|
{
|
||||||
if (! $token = $this->auth->setRequest($request)->getToken()) {
|
if (! $token = $this->auth->setRequest($request)->getToken()) {
|
||||||
return $this->respond('tymon.jwt.absent', 'token_not_provided', 400);
|
return $this->respond('tymon.jwt.absent', 'token_not_provided', 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -72,11 +72,11 @@ class PayloadValidator extends AbstractValidator
|
||||||
protected function validateTimestamps(array $payload)
|
protected function validateTimestamps(array $payload)
|
||||||
{
|
{
|
||||||
if (isset($payload['nbf']) && Utils::timestamp($payload['nbf'])->isFuture()) {
|
if (isset($payload['nbf']) && Utils::timestamp($payload['nbf'])->isFuture()) {
|
||||||
throw new TokenInvalidException('Not Before (nbf) timestamp cannot be in the future', 400);
|
throw new TokenInvalidException('Not Before (nbf) timestamp cannot be in the future', 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($payload['iat']) && Utils::timestamp($payload['iat'])->isFuture()) {
|
if (isset($payload['iat']) && Utils::timestamp($payload['iat'])->isFuture()) {
|
||||||
throw new TokenInvalidException('Issued At (iat) timestamp cannot be in the future', 400);
|
throw new TokenInvalidException('Issued At (iat) timestamp cannot be in the future', 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils::timestamp($payload['exp'])->isPast()) {
|
if (Utils::timestamp($payload['exp'])->isPast()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user