Example #1
0
  protected void sendHttpPostBindingRequest(
      String destination,
      Document samlDocument,
      String relayState,
      HttpServletResponse response,
      boolean willSendRequest)
      throws ProcessingException, IOException, ConfigurationException {
    String samlMessage =
        PostBindingUtil.base64Encode(DocumentUtil.getDocumentAsString(samlDocument));

    DestinationInfoHolder destinationHolder =
        new DestinationInfoHolder(destination, samlMessage, relayState);

    PostBindingUtil.sendPost(destinationHolder, response, willSendRequest);
  }
Example #2
0
  protected void sendToDestination(
      Document samlDocument,
      String relayState,
      String destination,
      HttpServletResponse response,
      boolean request)
      throws IOException, SAXException, GeneralSecurityException {
    if (!ignoreSignatures) {
      SAML2Signature samlSignature = new SAML2Signature();

      Node nextSibling = samlSignature.getNextSiblingOfIssuer(samlDocument);
      if (nextSibling != null) {
        samlSignature.setNextSibling(nextSibling);
      }
      KeyPair keypair = keyManager.getSigningKeyPair();
      samlSignature.signSAMLDocument(samlDocument, keypair);
    }
    String samlMessage =
        PostBindingUtil.base64Encode(DocumentUtil.getDocumentAsString(samlDocument));
    PostBindingUtil.sendPost(
        new DestinationInfoHolder(destination, samlMessage, relayState), response, request);
  }