Conditions | 6 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 8.048 |
Changes | 0 |
1 | <?php |
||
24 | 1 | public function verifyTrust(RegistrationResultInterface $registrationResult, ?MetadataInterface $metadata): void |
|
25 | { |
||
26 | 1 | $trusted = false; |
|
27 | 1 | $trustPath = $registrationResult->getVerificationResult()->getTrustPath(); |
|
28 | 1 | foreach ($this->voters as $voter) { |
|
29 | 1 | $vote = $voter->voteOnTrust($registrationResult, $trustPath, $metadata); |
|
30 | 1 | if ($vote->isTrusted()) { |
|
31 | 1 | $trusted = true; |
|
32 | } elseif ($vote->isUntrusted()) { |
||
33 | throw UntrustedException::createWithReason($vote->getReason()); |
||
34 | } elseif (!$vote->isAbstain()) { |
||
35 | throw new WebAuthnException('Unsupported vote type.'); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | 1 | if (!$trusted) { |
|
40 | throw UntrustedException::createWithReason('No voter trusted the registration.'); |
||
41 | } |
||
44 |