Skip to content

Commit

Permalink
Support deprecated u2f support in projection
Browse files Browse the repository at this point in the history
 This is done to prevent failing replays
  • Loading branch information
pablothedude committed Dec 9, 2024
1 parent 83ef80e commit a274cc5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 7 additions & 2 deletions ci/qa/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2660,14 +2660,19 @@ parameters:
count: 2
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/RecoveryTokenProjector.php

-
message: "#^Cannot access property \\$secondFactorIdentifier on Surfnet\\\\StepupMiddleware\\\\ApiBundle\\\\Identity\\\\Entity\\\\UnverifiedSecondFactor\\|null\\.$#"
count: 1
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php

-
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\\.$#"
count: 2
count: 3
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php

-
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\\.$#"
count: 3
count: 4
path: ../../src/Surfnet/StepupMiddleware/ApiBundle/Identity/Projector/SecondFactorProjector.php

-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ public function applyGssfPossessionProvenAndVerifiedEvent(GssfPossessionProvenAn

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

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

protected function applyVerifiedSecondFactorRevokedEvent(VerifiedSecondFactorRevokedEvent $event): void
{
$verifiedSecondFactor = $this->verifiedRepository->find($event->secondFactorId->getSecondFactorId());
if (is_null($verifiedSecondFactor)) {
if ($event->secondFactorType->isU2f()) {
// u2f is deprecated so those events shouldn't be handled anymore
return;
}
$verifiedSecondFactor = $this->verifiedRepository->find($event->secondFactorId->getSecondFactorId());

$this->verifiedRepository->remove($verifiedSecondFactor);
}

Expand Down

0 comments on commit a274cc5

Please sign in to comment.