private function abortSessionUsingResponse(Session $session, $response)
    {
        // $response needs to be a failure
        if (!isset($response[0]) || $response[0] !== 'FAILURE') {
            return false;
        }

        if (!isset($response[1]) || !is_object($response[1])) {
            // there are no other details to send - just fail it
            $session->abort(new \stdClass(), 'thruway.error.authentication_failure');
            return true;
        }

        $details = new \stdClass();
        if (isset($response[1]->details) && is_object($response[1]->details)) {
            $details = $response[1]->details;
        }

        $abortUri = 'thruway.error.authentication_failure';
        if (isset($response[1]->abort_uri) && is_scalar($response[1]->abort_uri)) {
            $abortUri = $response[1]->abort_uri;
        }

        $session->abort($details, $abortUri);
        return true;
    }