This commit is contained in:
Evgeny Kuchuk 2020-05-05 23:45:15 +03:00
parent 13d763a2d4
commit 4c059d1452
5 changed files with 6 additions and 6 deletions

View File

@ -16,5 +16,5 @@ class InvalidClaimException extends JWTException
/**
* @var int
*/
protected $statusCode = 400;
protected $statusCode = 401;
}

View File

@ -16,5 +16,5 @@ class TokenInvalidException extends JWTException
/**
* @var int
*/
protected $statusCode = 400;
protected $statusCode = 401;
}

View File

@ -201,7 +201,7 @@ class JWTAuth
{
if (! $token = $this->parseAuthHeader($header, $method)) {
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);
}
}

View File

@ -26,7 +26,7 @@ class GetUserFromToken extends BaseMiddleware
public function handle($request, \Closure $next)
{
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 {

View File

@ -72,11 +72,11 @@ class PayloadValidator extends AbstractValidator
protected function validateTimestamps(array $payload)
{
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()) {
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()) {