Code Duplication    Length = 20-24 lines in 2 locations

src/Surfnet/StepupGateway/GatewayBundle/Service/Gateway/FailedResponseService.php 2 locations

@@ 54-73 (lines=20) @@
51
     * @param ResponseContext $responseContext
52
     * @return SAMLResponse
53
     */
54
    public function sendLoaCannotBeGiven(ResponseContext $responseContext)
55
    {
56
        $originalRequestId = $responseContext->getInResponseTo();
57
58
        $logger = $this->samlLogger->forAuthentication($originalRequestId);
59
        $logger->notice('Loa cannot be given, creating Response with NoAuthnContext status');
60
61
        $response = $this->responseBuilder
62
            ->createNewResponse($responseContext)
63
            ->setResponseStatus(Constants::STATUS_RESPONDER, Constants::STATUS_NO_AUTHN_CONTEXT)
64
            ->get();
65
66
        $logger->notice(sprintf(
67
            'Responding to request "%s" with response based on response from the remote IdP with response "%s"',
68
            $responseContext->getInResponseTo(),
69
            $response->getId()
70
        ));
71
72
        return $response;
73
    }
74
75
    /**
76
     * Return a SAMLResponse indicating that the authentication is cancelled by the user.
@@ 81-104 (lines=24) @@
78
     * @param ResponseContext $responseContext
79
     * @return SAMLResponse
80
     */
81
    public function sendAuthenticationCancelledByUser(ResponseContext $responseContext)
82
    {
83
        $originalRequestId = $responseContext->getInResponseTo();
84
85
        $logger = $this->samlLogger->forAuthentication($originalRequestId);
86
        $logger->notice('Authentication was cancelled by the user, creating Response with AuthnFailed status');
87
88
        $response = $this->responseBuilder
89
            ->createNewResponse($responseContext)
90
            ->setResponseStatus(
91
                Constants::STATUS_RESPONDER,
92
                Constants::STATUS_AUTHN_FAILED,
93
                'Authentication cancelled by user'
94
            )
95
            ->get();
96
97
        $logger->notice(sprintf(
98
            'Responding to request "%s" with response based on response from the remote IdP with response "%s"',
99
            $responseContext->getInResponseTo(),
100
            $response->getId()
101
        ));
102
103
        return $response;
104
    }
105
106
    /**
107
     * @param ResponseContext $responseContext