Files
hyperf_rbac_framework_serve…/app/Lib/Jwt/AccessTokenConstraint.php
2025-09-12 15:23:08 +08:00

16 lines
377 B
PHP

<?php
namespace App\Lib\Jwt;
use Lcobucci\JWT\Token;
use Lcobucci\JWT\Validation\Constraint;
use Lcobucci\JWT\Validation\ConstraintViolation;
class AccessTokenConstraint implements Constraint
{
public function assert(Token $token): void
{
if (! $token->isRelatedTo('refresh')) throw ConstraintViolation::error('Token is not a refresh token', $this);
}
}