Package org.wijiscommons.ssaf

Examples of org.wijiscommons.ssaf.ServiceResponseInfo


            deletionRequestFolderUri.replace(
                NominalUriPartNames.DELETION_REQUEST.toString(),
                NominalUriPartNames.NEXT_MESSAGE.toString());
       

        ServiceResponseInfo serviceResponseInfo = jmsTemplateWrapper
                .deleteHeadMessageOnRequest(reqeust
                    .getDocumentElement(),
                    queueName, messageDir);

        DOMSource domSource = createResponse(reqeust, serviceResponseInfo);
View Full Code Here


        Document document = message.getBody(Document.class);
       
        Exception exception = (Exception) exchange
                .getProperty(DeadLetterChannel.EXCEPTION_CAUSE_PROPERTY);

        ServiceResponseInfo serviceResponseInfo = new ServiceResponseInfo();
        serviceResponseInfo.noteExceptionAsProblem(exception, true, true);
       
        DOMSource domSource;
        try
        {
            domSource = createResponse(document, serviceResponseInfo);
View Full Code Here

    HttpServletRequest request = (HttpServletRequest) message
        .get(AbstractHTTPDestination.HTTP_REQUEST);

    // Check the certificate submitted by client
    ServiceResponseInfo sb = SecurityHelperMethods.checkClientCert(request,
        getX509CRLLocation());

    // get input document type
    Element inputDocumentElement = DropOffHelperMethods
        .getInputDocumentType(message);

    String clientsideID = null;
    String recordURI = null;
    String mailBoxURI = null;

    // get the attribute values from inputDocument
    if (inputDocumentElement != null)
    {
      HashMap<String, String> attributesMap = SSAFUtil
          .getMessageAttributes(inputDocumentElement);
      clientsideID = attributesMap.get("clientsideID");
      recordURI = attributesMap.get("recordURI");
      mailBoxURI = attributesMap.get("dropoffMailBoxURI");
    }
    else
    {
      sb.noteError("Input document did not match with any of excepted types");
      Drop_OffUtil.throwFault(recordURI, clientsideID, null, sb,
          SSAFErrorTypes.REQUEST_INVALID, mailBoxURI, null);
    }

    // Throw a Fault if cert is invalid
    if (sb.isErrorResponse())
    {
      Drop_OffUtil.throwFault(recordURI, clientsideID, null, sb,
          SSAFErrorTypes.REQUEST_USER_UNAUTHORIZED, mailBoxURI,
          inputDocumentElement);
    }
    // go ahead if cert is valid
    else
    {
      X509Certificate certs[] = (X509Certificate[]) request
          .getAttribute("javax.servlet.request.X509Certificate");

      String dnInCanonicalForm = certs[0].getSubjectX500Principal()
          .getName("CANONICAL");
      log.info("DN in Cert: " + dnInCanonicalForm);

      X509Name x509NameArgument = new X509Name(dnInCanonicalForm);
      String commonNameInCert = DNUtil.getCommonName(x509NameArgument);
      log.debug("Common Name in Cert: " + commonNameInCert);

      // Check if user is authenticated to MailBox
      sb = Drop_OffUtil.isUserAuthenticated(mailBoxURI, commonNameInCert,
          authenticateMailBoxURIs);

      if (sb.isErrorResponse())
      {
        sb.noteError("User is not authenticated to use this particular mailbox");
        Drop_OffUtil  .throwFault(
                recordURI,
                clientsideID,
                null,
                sb, SSAFErrorTypes.REQUEST_USER_UNAUTHORIZED,
                mailBoxURI, inputDocumentElement);
      }

      // If incoming request is for drop off operation add saml Assertion
      if (inputDocumentElement != null && DropOffHelperMethods.isDropOffRequest(message))
      {
        Document dropOffInputDocument = inputDocumentElement
            .getOwnerDocument();

        Document inputDocumentModified = Drop_OffUtil.addSamlAssertion(
            dropOffInputDocument, commonNameInCert, recordURI,
            clientsideID, mailBoxURI);

        // Sign the document only if it is a drop off
        // request.Normalize the inputDocument document before
        // signing it, If not XmlSignature validation fails.
        try
        {
          inputDocumentModified.normalizeDocument();
          xmlSignature.signDocument(inputDocumentModified);
        }
        catch (Exception e)
        {
          log.error("There was a problem while singing the xml document");
          sb.noteError("There was a problem while signing the xml document");

          Drop_OffUtil  .throwFault(
                  recordURI,
                  clientsideID,
                  null,
View Full Code Here

    assertEquals("/home/lakshmi/ssaf/mailboxes/mailbox_name/drop_off/fail_box/54321response.xml", fileAbsolutePath);
  }

  public void testPollForAFile()
  {
    ServiceResponseInfo sb = new ServiceResponseInfo();
    Element polledFiledDocElement = Drop_OffUtil.pollForAFile(
        "/home/lakshmi/ssaf/mailboxes/mailbox_name", "54321",
        "recordURI", sb, null, 5, 1000);
    assertNotNull(polledFiledDocElement);
  }
View Full Code Here

    assertNotNull(polledFiledDocElement);
  }

  public void testIsUserAuthenticated()
  {
    ServiceResponseInfo sb = Drop_OffUtil.isUserAuthenticated("mailBox_name", "lakshmi.doa.wistate.us", mailBoxProperties);
    if(!sb.isErrorResponse())
    {
      assertNull(sb);
    }
    // To fail
    ServiceResponseInfo sb1 = Drop_OffUtil.isUserAuthenticated("mailBox_name", "lakshmi.wistate.us", mailBoxProperties);
    if(sb1.isErrorResponse())
    {
      assertNotNull(sb1);
    }
  }
View Full Code Here

    System.out.println("Element returned : "+ DomUtils.getStringFromDocument(reponseDocElement.getOwnerDocument()));
  }

  public void testLookForConfirmationFileWithClientSideID()
  {
    ServiceResponseInfo sb = new ServiceResponseInfo();
    Element reponseDocElement = Drop_OffUtil
        .lookForConfirmationFileWithClientSideID("54321",
            "/home/lakshmi/ssaf/mailboxes/mailbox_name", null, sb);
   
    System.out.println("Confirmation Element returned : "+ DomUtils.getStringFromDocument(reponseDocElement.getOwnerDocument()));
View Full Code Here

    System.out.println("Confirmation Element returned : "+ DomUtils.getStringFromDocument(reponseDocElement.getOwnerDocument()));
  }

  public void testLookForConfirmationFileWithMessageID()
  {
    ServiceResponseInfo sb = new ServiceResponseInfo();
    File confirmationFile = Drop_OffUtil
        .lookForConfirmationFileWithMessageID("301",
            "/home/lakshmi/ssaf/mailboxes/mailbox_name", null, sb);
    assertTrue(confirmationFile.exists());
  }
View Full Code Here

  }


  public void testDeleteAFile()
  {
    ServiceResponseInfo sb = new ServiceResponseInfo();
    File fileToDelete = new File("/home/lakshmi/ssaf/mailboxes/mailbox_name/drop_off/fail_box/54321response_error.xml");
    boolean deletedAFile = DropOffHelperMethods.deleteAFile(fileToDelete, sb);
    assertTrue(deletedAFile);
  }
View Full Code Here

    ExceptionMapper<TestException>
{

  public Response toResponse(TestException ex)
  {
    ServiceResponseInfo sb = new ServiceResponseInfo();

    sb.noteMessage("mailbox_nominal_uri attribute in incoming request "
        + "document is not specified properly");
   
    Element errorDocumentElement = Drop_OffUtil.createDropOffErrorMessage(
        "TestRecordURI", null, null, null,
        SSAFErrorTypes.REQUEST_INVALID, "mailBoxName", null);
   
    FaultDescription faultDescription = new FaultDescription();
    faultDescription.setAny(errorDocumentElement);

    FatalFault fault = new FatalFault(sb.getMergedMessages(),
        faultDescription);
    //throw new Fault(fault);

    return Response.status(404).entity(
        DomUtils.getStringFromDocument(errorDocumentElement
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Element getInputDocumentType(SoapMessage message)
  {
    Element inputDocumentElement = null;
    List<Object> myList = message.getContent(List.class);
    ServiceResponseInfo sb = new ServiceResponseInfo();

    for (Object object : myList)
    {
      // check what type of document is coming in.
      switch(SSAFWebservicesEnum.valueOfClassName(object.getClass().getName()))
      {
        case DROPOFF:
        {
          DropOff dropOff = (DropOff) object;
          Element docElement = (Element) dropOff.getAny();

          if ((docElement != null)
              && (docElement.getLocalName()
                  .equalsIgnoreCase(SSAFNodes.message_envelope
                      .getLocalName()))
              && (docElement.getNamespaceURI()
                  .equalsIgnoreCase(SSAFNodes.message_envelope
                      .getNamespace())))
          {
            inputDocumentElement = docElement;
            log.info("Incoming request document is of type DropOff");
          }
          else
          {   // throw FatalFault if incoming DropOff request does not
            // Contain expected ssaf:message element.
            sb.noteError("DropOff incoming request document does not contain " +
              "ssaf:message element which is required");
            Drop_OffUtil  .throwFault(
                    null,
                    null,
                    null,
                    sb, SSAFErrorTypes.REQUEST_INVALID,
                    null, docElement);
          }
          break;
        }
        case CHECKCONFIRMATION:
        {
          CheckConfirmation checkConfirmation = (CheckConfirmation) object;
          Element docElement = (Element) checkConfirmation.getAny();
         
          if ((docElement != null)
              && (docElement.getLocalName()
                  .equalsIgnoreCase(SSAFNodes.view_confirmation_response
                      .getLocalName()))
              && (docElement.getNamespaceURI()
                  .equalsIgnoreCase(SSAFNodes.view_confirmation_response
                      .getNamespace())))
          {
            inputDocumentElement = docElement;
            log.info("Incoming request document is of type CheckConfirmation");
          }
          else
          {
            // throw FatalFault if incoming CheckConfirmation request does not
            // Contain expected drop-off:view_confirmation_response element.
            sb.noteError("CheckConfirmation incoming request document does not contain " +
                "drop-off:view_confirmation_response element which is required");
            Drop_OffUtil.throwFault(
                    null,
                    null,
                    null,
                    sb, SSAFErrorTypes.REQUEST_INVALID,
                    null, docElement);
          }
          break;
        }
        case CHECKDROPOFFSTATUS:
        {
          CheckDropOffStatus checkError = (CheckDropOffStatus) object;
          Element docElement = (Element) checkError.getAny();

          if ((docElement != null)
              && (docElement.getLocalName()
                  .equalsIgnoreCase(SSAFNodes.view_response_message
                      .getLocalName()))
              && (docElement.getNamespaceURI()
                  .equalsIgnoreCase(SSAFNodes.view_response_message
                      .getNamespace())))
          {
            inputDocumentElement = docElement;
            log.info("Incoming request document is of type CheckDropOffStatus");
          }
          else
          {
            // throw FatalFault if incoming CheckDropOffStatus request does not
            // Contain expected drop-off:view_response_message element.
            sb.noteError("CheckDropOffStatus incoming request document does not contain " +
            "drop-off:view_response_message element which is required");
            Drop_OffUtil  .throwFault(
                    null,
                    null,
                    null,
                    sb, SSAFErrorTypes.REQUEST_INVALID,
                    null, docElement);
          }
          break;
        }
        case GETRESPONSES:
        {
          GetResponses getResponses = (GetResponses) object;
          Element docElement = (Element) getResponses.getAny();
          if ((docElement != null)
              && (docElement.getLocalName()
                  .equalsIgnoreCase(SSAFNodes.get_responses
                      .getLocalName()))
              && (docElement.getNamespaceURI()
                  .equalsIgnoreCase(SSAFNodes.get_responses
                      .getNamespace())))
          {
            inputDocumentElement = docElement;
            log.info("Incoming request document is of type GetResponses");
          }
          else
          {
            // throw FatalFault if incoming GetResponses request does not contian expected
            // drop-off:get_reponses element.
            sb.noteError("GetResponses incoming request document does not contain " +
            "drop-off:get_reponses element which is required");
            Drop_OffUtil.throwFault(
                    null,
                    null,
                    null,
                    null, SSAFErrorTypes.REQUEST_INVALID,
                    null, docElement);
          }
          break;
        }
        case DELETEERROR:
        {
          DeleteError deleteError = (DeleteError) object;
          Element docElement = (Element) deleteError.getAny();
          if ((docElement != null)
              && (docElement.getLocalName()
                  .equalsIgnoreCase(SSAFNodes.error_message_to_delete
                      .getLocalName()))
              && (docElement.getNamespaceURI()
                  .equalsIgnoreCase(SSAFNodes.error_message_to_delete
                      .getNamespace())))
          {
            inputDocumentElement = docElement;
            log.info("Incoming request document is of type DeleteError");
          }
          else
          {
            // throw FatalFault if incoming DeleteError request does not contain expected
            // drop-off:error_message_to_delete element.
            sb.noteError("DeleteError incoming request document does not contain " +
            "drop-off:error_message_to_delete element which is required");
            Drop_OffUtil.throwFault(
                    null,
                    null,
                    null,
                    null, SSAFErrorTypes.REQUEST_INVALID,
                    null, docElement);
          }
          break;
        }
        case DELETECONFIRMATION:
        {
          DeleteConfirmation deleteConfirmation = (DeleteConfirmation) object;
          Element docElement = (Element) deleteConfirmation.getAny();

          if ((docElement != null)
              && (docElement.getLocalName()
                  .equalsIgnoreCase(SSAFNodes.confirmation_messages_to_delete
                      .getLocalName()))
              && (docElement.getNamespaceURI()
                  .equalsIgnoreCase(SSAFNodes.confirmation_messages_to_delete
                      .getNamespace())))
          {
            inputDocumentElement = docElement;
            log.info("Incoming request document is of type DeleteConfirmation");
          }
          else
          {
            // throw FatalFault if incoming DeleteConfirmatio request does not contain
            // expected drop-off:confirmation_messages_to_delete element.
            sb.noteError("DeleteConfirmation incoming request document does not contain " +
            "drop-off:confirmation_messages_to_delete element which is required");
            Drop_OffUtil.throwFault(
                    null,
                    null,
                    null,
View Full Code Here

TOP

Related Classes of org.wijiscommons.ssaf.ServiceResponseInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.