Code Duplication    Length = 9-11 lines in 2 locations

src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/SecondFactorController.php 1 location

@@ 62-70 (lines=9) @@
59
60
        /** @var SecondFactorService $service */
61
        $service = $this->get('surfnet_stepup_self_service_self_service.service.second_factor');
62
        if (!$service->identityHasSecondFactorOfStateWithId($identity->id, $state, $secondFactorId)) {
63
            $this->get('logger')->error(sprintf(
64
                'Identity "%s" tried to revoke "%s" second factor "%s", but does not own that second factor',
65
                $identity->id,
66
                $state,
67
                $secondFactorId
68
            ));
69
            throw new NotFoundHttpException();
70
        }
71
72
        switch ($state) {
73
            case 'unverified':

src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/SamlController.php 1 location

@@ 44-54 (lines=11) @@
41
        $secondFactorService = $this->get('surfnet_stepup_self_service_self_service.service.second_factor');
42
        $identity            = $this->getIdentity();
43
44
        if (!$secondFactorService->identityHasSecondFactorOfStateWithId($identity->id, 'vetted', $secondFactorId)) {
45
            $this->get('logger')->error(
46
                sprintf(
47
                    'Identity "%s" tried to test second factor "%s", but does not own that second factor or it is not vetted',
48
                    $identity->id,
49
                    $secondFactorId
50
                )
51
            );
52
53
            throw $this->createNotFoundException();
54
        }
55
56
        $loaResolutionService         = $this->get('surfnet_stepup.service.loa_resolution');
57
        $authenticationRequestFactory = $this->get('self_service.test_second_factor_authentication_request_factory');