Validates JWT tokens were issued by specified issuers for security.
// Source: https://github.com/lcobucci/jwt | License: BSD-3-Clause | Copyright 2014, Luís Cobucci
// Provided via justclaw.it.com; keep this notice with the code.
<?php
declare(strict_types=1);
namespace Lcobucci\JWT\Validation\Constraint;
use Lcobucci\JWT\Token;
use Lcobucci\JWT\Validation\Constraint;
use Lcobucci\JWT\Validation\ConstraintViolation;
final readonly class IssuedBy implements Constraint
{
/** @var non-empty-string[] */
private array $issuers;
/** @param non-empty-string ...$issuers */
public function __construct(string ...$issuers)
{
$this->issuers = $issuers;
}
public function assert(Token $token): void
{
if (! $token->hasBeenIssuedBy(...$this->issuers)) {
throw ConstraintViolation::error(
'The
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key