| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Webauthn\CeremonyStep; |
| 6 |
|
| 7 |
use Webauthn\Exception\AuthenticatorResponseVerificationException; |
| 8 |
|
| 9 |
final readonly class HostTopOriginValidator implements TopOriginValidator |
| 10 |
{ |
| 11 |
public function __construct( |
| 12 |
private string $host |
| 13 |
) { |
| 14 |
} |
| 15 |
|
| 16 |
public function validate(string $topOrigin): void |
| 17 |
{ |
| 18 |
$topOrigin === $this->host || throw AuthenticatorResponseVerificationException::create( |
| 19 |
'The top origin does not correspond to the host.' |
| 20 |
); |
| 21 |
} |
| 22 |
} |