Code Duplication    Length = 25-29 lines in 2 locations

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

@@ 195-219 (lines=25) @@
192
        return $this->renderSamlResponse('consumeAssertion', $response);
193
    }
194
195
    public function sendLoaCannotBeGivenAction()
196
    {
197
        $responseContext = $this->getResponseContext();
198
        $originalRequestId = $responseContext->getInResponseTo();
199
200
        /** @var \Surfnet\SamlBundle\Monolog\SamlAuthenticationLogger $logger */
201
        $logger = $this->get('surfnet_saml.logger')->forAuthentication($originalRequestId);
202
        $logger->notice('Loa cannot be given, creating Response with NoAuthnContext status');
203
204
        /** @var \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseBuilder $responseBuilder */
205
        $responseBuilder = $this->get('gateway.proxy.response_builder');
206
207
        $response = $responseBuilder
208
            ->createNewResponse($responseContext)
209
            ->setResponseStatus(Constants::STATUS_RESPONDER, Constants::STATUS_NO_AUTHN_CONTEXT)
210
            ->get();
211
212
        $logger->notice(sprintf(
213
            'Responding to request "%s" with response based on response from the remote IdP with response "%s"',
214
            $responseContext->getInResponseTo(),
215
            $response->getId()
216
        ));
217
218
        return $this->renderSamlResponse('consumeAssertion', $response);
219
    }
220
221
    public function sendAuthenticationCancelledByUserAction()
222
    {
@@ 221-249 (lines=29) @@
218
        return $this->renderSamlResponse('consumeAssertion', $response);
219
    }
220
221
    public function sendAuthenticationCancelledByUserAction()
222
    {
223
        $responseContext = $this->getResponseContext();
224
        $originalRequestId = $responseContext->getInResponseTo();
225
226
        /** @var \Surfnet\SamlBundle\Monolog\SamlAuthenticationLogger $logger */
227
        $logger = $this->get('surfnet_saml.logger')->forAuthentication($originalRequestId);
228
        $logger->notice('Authentication was cancelled by the user, creating Response with AuthnFailed status');
229
230
        /** @var \Surfnet\StepupGateway\GatewayBundle\Saml\ResponseBuilder $responseBuilder */
231
        $responseBuilder = $this->get('gateway.proxy.response_builder');
232
233
        $response = $responseBuilder
234
            ->createNewResponse($responseContext)
235
            ->setResponseStatus(
236
                Constants::STATUS_RESPONDER,
237
                Constants::STATUS_AUTHN_FAILED,
238
                'Authentication cancelled by user'
239
            )
240
            ->get();
241
242
        $logger->notice(sprintf(
243
            'Responding to request "%s" with response based on response from the remote IdP with response "%s"',
244
            $responseContext->getInResponseTo(),
245
            $response->getId()
246
        ));
247
248
        return $this->renderSamlResponse('consumeAssertion', $response);
249
    }
250
251
    /**
252
     * @param string         $view