Skip to content

Commit a274cc5

Browse files
committed
Support deprecated u2f support in projection
This is done to prevent failing replays
1 parent 83ef80e commit a274cc5

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

ci/qa/phpstan-baseline.neon

+7-2
Original file line numberDiff line numberDiff line change
@@ -2660,14 +2660,19 @@ parameters:
26602660
count: 2
26612661
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/RecoveryTokenProjector.php
26622662

2663+
-
2664+
message: "#^Cannot access property \\$secondFactorIdentifier on Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Entity\\\\UnverifiedSecondFactor\\|null\\.$#"
2665+
count: 1
2666+
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php
2667+
26632668
-
26642669
message: "#^Parameter \\#1 \\$secondFactor of method Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Repository\\\\UnverifiedSecondFactorRepository\\:\\:remove\\(\\) expects Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Entity\\\\UnverifiedSecondFactor, Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Entity\\\\UnverifiedSecondFactor\\|null given\\.$#"
2665-
count: 2
2670+
count: 3
26662671
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php
26672672

26682673
-
26692674
message: "#^Parameter \\#1 \\$secondFactor of method Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Repository\\\\VerifiedSecondFactorRepository\\:\\:remove\\(\\) expects Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Entity\\\\VerifiedSecondFactor, Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Entity\\\\VerifiedSecondFactor\\|null given\\.$#"
2670-
count: 3
2675+
count: 4
26712676
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php
26722677

26732678
-

src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ public function applyGssfPossessionProvenAndVerifiedEvent(GssfPossessionProvenAn
154154

155155
public function applyEmailVerifiedEvent(EmailVerifiedEvent $event): void
156156
{
157-
$unverified = $this->unverifiedRepository->find($event->secondFactorId->getSecondFactorId());
158-
if (is_null($unverified)) {
157+
if ($event->secondFactorType->isU2f()) {
158+
// u2f is deprecated so those events shouldn't be handled anymore
159159
return;
160160
}
161+
$unverified = $this->unverifiedRepository->find($event->secondFactorId->getSecondFactorId());
161162

162163
$verified = new VerifiedSecondFactor();
163164
$verified->id = $event->secondFactorId->getSecondFactorId();
@@ -250,10 +251,12 @@ protected function applyCompliedWithUnverifiedSecondFactorRevocationEvent(
250251

251252
protected function applyVerifiedSecondFactorRevokedEvent(VerifiedSecondFactorRevokedEvent $event): void
252253
{
253-
$verifiedSecondFactor = $this->verifiedRepository->find($event->secondFactorId->getSecondFactorId());
254-
if (is_null($verifiedSecondFactor)) {
254+
if ($event->secondFactorType->isU2f()) {
255+
// u2f is deprecated so those events shouldn't be handled anymore
255256
return;
256257
}
258+
$verifiedSecondFactor = $this->verifiedRepository->find($event->secondFactorId->getSecondFactorId());
259+
257260
$this->verifiedRepository->remove($verifiedSecondFactor);
258261
}
259262

0 commit comments

Comments
 (0)