Package org.apache.ws.security.util

Examples of org.apache.ws.security.util.XmlSchemaDateFormat


                                             .writeSecurityTokenReference(writer,
                                                                     sct.getIdentifier(),
                                                                     tokenType));
            writer.writeEndElement();
           
            XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
            writer.writeStartElement(prefix, "Lifetime", namespace);
            writer.writeNamespace("wsu", WSConstants.WSU_NS);
            writer.writeStartElement("wsu", "Created", WSConstants.WSU_NS);
            writer.writeCharacters(fmt.format(created.getTime()));
            writer.writeEndElement();
           
            writer.writeStartElement("wsu", "Expires", WSConstants.WSU_NS);
            writer.writeCharacters(fmt.format(expires.getTime()));
            writer.writeEndElement();
            writer.writeEndElement();

            byte[] secret = SecureConversationTokenInterceptorProvider.writeProofToken(prefix,
                                            namespace,
View Full Code Here


    private void addLifetime(XMLStreamWriter writer) throws XMLStreamException {
        Date creationTime = new Date();
        Date expirationTime = new Date();
        expirationTime.setTime(creationTime.getTime() + (ttl * 1000));

        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        writer.writeStartElement("wst", "Lifetime", namespace);
        writer.writeStartElement("wsu", "Created", WSConstants.WSU_NS);
        writer.writeCharacters(fmt.format(creationTime));
        writer.writeEndElement();

        writer.writeStartElement("wsu", "Expires", WSConstants.WSU_NS);
        writer.writeCharacters(fmt.format(expirationTime));
        writer.writeEndElement();
        writer.writeEndElement();
    }
View Full Code Here

        }
       
        if (elementCreated != null) {
            String createdString = getCreated();
            if (createdString != null && !"".equals(createdString)) {
                DateFormat zulu = new XmlSchemaDateFormat();
                if (bspCompliant) {
                    zulu.setLenient(false);
                }
                try {
                    createdDate = zulu.parse(createdString);
                } catch (ParseException e) {
                    throw new WSSecurityException(
                        WSSecurityException.INVALID_SECURITY, "invalidTimestamp", null, e
                    );
                }
View Full Code Here

        if (elementCreated != null) {
            return;
        }
        DateFormat zulu = null;
        if (milliseconds) {
            zulu = new XmlSchemaDateFormat();
        } else {
            zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
            zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
        }
        elementCreated =
View Full Code Here

            return;
        }
       
        // Test for replay attacks
        Date created = timeStamp.getCreated();
        DateFormat zulu = new XmlSchemaDateFormat();
        String identifier = zulu.format(created) + "" + Arrays.hashCode(signatureValue);

        if (replayCache.contains(identifier)) {
            throw new WSSecurityException(
                WSSecurityException.INVALID_SECURITY,
                "invalidTimestamp",
View Full Code Here

                WSSecurityException.INVALID_SECURITY, "invalidTimestamp"
            )
        }

        // Parse the dates
        DateFormat zulu = new XmlSchemaDateFormat();
        if (bspCompliant) {
            zulu.setLenient(false);
        }
        try {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Current time: " + zulu.format(new Date()));
            }
            if (strCreated != null) {
                createdDate = zulu.parse(strCreated);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Timestamp created: " + zulu.format(createdDate));
                }
            }
            if (strExpires != null) {
                expiresDate = zulu.parse(strExpires);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Timestamp expires: " + zulu.format(expiresDate));
                }
            }
        } catch (ParseException e) {
            throw new WSSecurityException(
                WSSecurityException.INVALID_SECURITY, "invalidTimestamp", null, e
View Full Code Here

                WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":" + WSConstants.TIMESTAMP_TOKEN_LN
            );

        DateFormat zulu = null;
        if (milliseconds) {
            zulu = new XmlSchemaDateFormat();
        } else {
            zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
            zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
        }
        Element elementCreated =
View Full Code Here

        }
       
        if (elementCreated != null) {
            String createdString = getCreated();
            if (createdString != null && !"".equals(createdString)) {
                DateFormat zulu = new XmlSchemaDateFormat();
                if (bspCompliant) {
                    zulu.setLenient(false);
                }
                try {
                    createdDate = zulu.parse(createdString);
                } catch (ParseException e) {
                    throw new WSSecurityException(
                        WSSecurityException.INVALID_SECURITY, "invalidTimestamp", null, e
                    );
                }
View Full Code Here

        if (elementCreated != null) {
            return;
        }
        DateFormat zulu = null;
        if (milliseconds) {
            zulu = new XmlSchemaDateFormat();
        } else {
            zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
            zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
        }
        elementCreated =
View Full Code Here

        Element elementCreated =
            doc.createElementNS(
                WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":" + WSConstants.CREATED_LN
            );
        DateFormat zulu = new XmlSchemaDateFormat();
        Date createdDate = new Date();
        long currentTime = createdDate.getTime() + 30000;
        createdDate.setTime(currentTime);
        elementCreated.appendChild(doc.createTextNode(zulu.format(createdDate)));
        usernameTokenElement.appendChild(elementCreated);

        secHeader.getSecurityHeader().appendChild(usernameTokenElement);
       
        if (LOG.isDebugEnabled()) {
View Full Code Here

TOP

Related Classes of org.apache.ws.security.util.XmlSchemaDateFormat

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.