Code Duplication    Length = 25-29 lines in 2 locations

src/Surfnet/StepupGateway/GatewayBundle/Controller/GatewayController.php 2 locations

@@ 230-254 (lines=25) @@
227
        return $this->renderSamlResponse('consumeAssertion', $response);
228
    }
229
230
    public function sendLoaCannotBeGivenAction()
231
    {
232
        $responseContext = $this->getResponseContext();
233
        $originalRequestId = $responseContext->getInResponseTo();
234
235
        /** @var \Surfnet\SamlBundle\Monolog\SamlAuthenticationLogger $logger */
236
        $logger = $this->get('surfnet_saml.logger')->forAuthentication($originalRequestId);
237
        $logger->notice('Loa cannot be given, creating Response with NoAuthnContext status');
238
239
        /** @var \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseBuilder $responseBuilder */
240
        $responseBuilder = $this->get('gateway.proxy.response_builder');
241
242
        $response = $responseBuilder
243
            ->createNewResponse($responseContext)
244
            ->setResponseStatus(Constants::STATUS_RESPONDER, Constants::STATUS_NO_AUTHN_CONTEXT)
245
            ->get();
246
247
        $logger->notice(sprintf(
248
            'Responding to request "%s" with response based on response from the remote IdP with response "%s"',
249
            $responseContext->getInResponseTo(),
250
            $response->getId()
251
        ));
252
253
        return $this->renderSamlResponse('consumeAssertion', $response);
254
    }
255
256
    public function sendAuthenticationCancelledByUserAction()
257
    {
@@ 256-284 (lines=29) @@
253
        return $this->renderSamlResponse('consumeAssertion', $response);
254
    }
255
256
    public function sendAuthenticationCancelledByUserAction()
257
    {
258
        $responseContext = $this->getResponseContext();
259
        $originalRequestId = $responseContext->getInResponseTo();
260
261
        /** @var \Surfnet\SamlBundle\Monolog\SamlAuthenticationLogger $logger */
262
        $logger = $this->get('surfnet_saml.logger')->forAuthentication($originalRequestId);
263
        $logger->notice('Authentication was cancelled by the user, creating Response with AuthnFailed status');
264
265
        /** @var \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseBuilder $responseBuilder */
266
        $responseBuilder = $this->get('gateway.proxy.response_builder');
267
268
        $response = $responseBuilder
269
            ->createNewResponse($responseContext)
270
            ->setResponseStatus(
271
                Constants::STATUS_RESPONDER,
272
                Constants::STATUS_AUTHN_FAILED,
273
                'Authentication cancelled by user'
274
            )
275
            ->get();
276
277
        $logger->notice(sprintf(
278
            'Responding to request "%s" with response based on response from the remote IdP with response "%s"',
279
            $responseContext->getInResponseTo(),
280
            $response->getId()
281
        ));
282
283
        return $this->renderSamlResponse('consumeAssertion', $response);
284
    }
285
286
    /**
287
     * @param string         $view