Skip to content

Commit

Permalink
Improve AuthenticatorStatusValidators logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Apr 15, 2024
1 parent b20b070 commit 3381377
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Service/AuthenticatorStatusValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Surfnet\Webauthn\Exception\AuthenticatorStatusNotSupportedException;
use Webauthn\MetadataService\Statement\AuthenticatorStatus;
use Webauthn\MetadataService\Statement\StatusReport;
use function array_walk;

class AuthenticatorStatusValidator
{
Expand Down Expand Up @@ -56,18 +57,22 @@ public function validate(array $statusReports): void
{
$meetsRequirement = false;
$reportsProcessed = 0;
$reportLog = [];
foreach ($statusReports as $report) {
if (in_array($report->status, $this->allowedStatus)) {
$meetsRequirement = true;
}
$reportsProcessed++;
$reportLog[] = $report->status;
}

if (!$meetsRequirement) {
throw new AuthenticatorStatusNotSupportedException(
sprintf(
'Of the %d StatusReports tested, none met one of the required FIDO Certified statuses',
$reportsProcessed
'Of the %d StatusReports tested, none met one of the required FIDO Certified statuses. ' .
'Reports tested: "%s"',
$reportsProcessed,
implode(', ', $reportLog)
)
);
}
Expand Down

0 comments on commit 3381377

Please sign in to comment.