Package org.apache.ws.security.message

Examples of org.apache.ws.security.message.WSSecTimestamp.build()


        WSSecHeader secHeader = new WSSecHeader();
        secHeader.insertSecurityHeader(doc);
       
        WSSecTimestamp timestamp = new WSSecTimestamp();
        timestamp.setTimeToLive(-1);
        Document createdDoc = timestamp.build(doc, secHeader);

        if (LOG.isDebugEnabled()) {
            String outputString =
                org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(createdDoc);
            LOG.debug(outputString);
View Full Code Here


        bst.setID("Id-" + bst.hashCode());
        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
       
        WSSecTimestamp timestamp = new WSSecTimestamp();
        timestamp.setTimeToLive(600);
        timestamp.build(doc, secHeader);
       
        WSSecSignature sign = new WSSecSignature();
        sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
        sign.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
       
View Full Code Here

        builder.setTimeToLive(-1);
       
        Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
        WSSecHeader secHeader = new WSSecHeader();
        secHeader.insertSecurityHeader(doc);       
        Document timestampedDoc = builder.build(doc, secHeader);
       
        try {
            verify(timestampedDoc);
            fail("Failure expected on an expired message");
        } catch (WSSecurityException ex) {
View Full Code Here

                "Content");
        parts.add(encP);
       
        WSSecTimestamp timestamp = new WSSecTimestamp();
        timestamp.setTimeToLive(600);
        timestamp.build(doc, secHeader);
        parts.add(new WSEncryptionPart(timestamp.getId()));

        builder.setParts(parts);
        builder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
View Full Code Here

        builder.setTimeToLive(-1);
       
        Document doc = unsignedEnvelope.getAsDocument();
        WSSecHeader secHeader = new WSSecHeader();
        secHeader.insertSecurityHeader(doc);       
        Document timestampedDoc = builder.build(doc, secHeader);
       
        try {
            verify(timestampedDoc);
        } catch (WSSecurityException ex) {
            assertTrue(ex.getErrorCode() == 8);
View Full Code Here

        wsc.setTimeStampStrict(false);
        addTimestamp.setWsConfig(wsc);

        WSSecHeader secHeader = new WSSecHeader();
        secHeader.insertSecurityHeader(doc);
        addTimestamp.build(doc, secHeader);
        return addTimestamp.getElement();
    }

    private static Element setWssUsernameToken(String username, String password, String pwType, Document doc)
            throws WSSecurityException {
View Full Code Here

            wsc.setPrecisionInMilliSeconds(false);
            wsc.setTimeStampStrict(false);
            timestamp.setWsConfig(wsc);
        }

        timestamp.build(doc, secHeader);
    }

    public String getTimeToLive() {
        return String.valueOf(timeToLive);
    }
View Full Code Here

            addTimestamp.setTimeToLive(ttl);

            StringWriter writer = new StringWriter();
            WSSecHeader secHeader = new WSSecHeader();
            secHeader.insertSecurityHeader(doc);
            XmlUtils.serializePretty(addTimestamp.build(doc, secHeader), writer);
            request.setRequestContent(writer.toString());
        } catch (Exception e1) {
            UISupport.showErrorMessage(e1);
        }
    }
View Full Code Here

  public static DOMSource timestamp(final Document document) throws WSSecurityException {
    WSSecHeader header = new WSSecHeader();
    header.insertSecurityHeader(document);

    WSSecTimestamp timestamp = new WSSecTimestamp();
    Document stamped = timestamp.build(document, header);
    DOMSource domSource = new DOMSource(stamped);
    return domSource;
  }

  public static DOMSource usernameToken(final Document document, final WSS4JCredential credential) throws WSSecurityException {
View Full Code Here

    public void addWssTimestamp(WSSecHeader header) {
        logger.info("Adding the Timestamp");
        WSSecTimestamp ts = new WSSecTimestamp();
        ts.setWsConfig(wsConfig);
        ts.setTimeToLive(timeToLive);
        ts.build(requestDoc, header);
    }
   
    public void addWssUserNameToken(WSSecHeader header) {
        logger.info("Adding the UserNameToken");
        WSSecUsernameToken token = new WSSecUsernameToken();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.