Update v1.0.6
This commit is contained in:
33
vendor/tymon/jwt-auth/src/Validators/TokenValidator.php
vendored
Normal file
33
vendor/tymon/jwt-auth/src/Validators/TokenValidator.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Tymon\JWTAuth\Validators;
|
||||
|
||||
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
|
||||
|
||||
class TokenValidator extends AbstractValidator
|
||||
{
|
||||
/**
|
||||
* Check the structure of the token
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function check($value)
|
||||
{
|
||||
$this->validateStructure($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenInvalidException
|
||||
* @return boolean
|
||||
*/
|
||||
protected function validateStructure($token)
|
||||
{
|
||||
if (count(explode('.', $token)) !== 3) {
|
||||
throw new TokenInvalidException('Wrong number of segments');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user