Examples of XmlSchemaDateFormat


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

        currentTime -= timeToLive * 1000;
        validCreation.setTime(new Date(currentTime));

        if (doDebug) {
      log.debug("Preparing to verify the timestamp");
      DateFormat zulu = new XmlSchemaDateFormat();
      log.debug("Validation of Timestamp: Current time is "
          + zulu.format(Calendar.getInstance().getTime()));
      log.debug("Validation of Timestamp: Valid creation is "
          + zulu.format(validCreation.getTime()));
      if (timestamp.getCreated() != null) {
        log.debug("Validation of Timestamp: Timestamp created is "
            + zulu.format(timestamp.getCreated().getTime()));
      }
    }
        // Validate the time it took the message to travel
        // if (timestamp.getCreated().before(validCreation) ||
        // !timestamp.getCreated().equals(validCreation)) {
View Full Code Here

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

        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"));
        }
        Calendar rightNow = Calendar.getInstance();
View Full Code Here

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

        currentTime -= timeToLive * 1000;
        validCreation.setTime(new Date(currentTime));

        if (doDebug) {
            log.debug("Preparing to verify the timestamp");
            DateFormat zulu = new XmlSchemaDateFormat();
            log.debug("Validation of Timestamp: Current time is "
                    + zulu.format(Calendar.getInstance().getTime()));
            log.debug("Validation of Timestamp: Valid creation is "
                    + zulu.format(validCreation.getTime()));
            if (timestamp.getCreated() != null) {
                log.debug("Validation of Timestamp: Timestamp created is "
                        + zulu.format(timestamp.getCreated().getTime()));
            }
        }
        // Validate the time it took the message to travel
        // if (timestamp.getCreated().before(validCreation) ||
        // !timestamp.getCreated().equals(validCreation)) {
View Full Code Here

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

                    customElements.add((Element) currentChild);
                }
            }
        }

        DateFormat zulu = new XmlSchemaDateFormat();;
       
        try {
          if (strCreated != null) {
                created = Calendar.getInstance();
            created.setTime(zulu.parse(strCreated));
          }
          if (strExpires != null) {
                expires = Calendar.getInstance();
            expires.setTime(zulu.parse(strExpires));
          }
        } catch (ParseException e) {
            throw new WSSecurityException(WSSecurityException.INVALID_SECURITY,
                    "invalidTimestamp",
                    null, e);
View Full Code Here

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

                WSConstants.WSU_NS,
                WSConstants.WSU_PREFIX);

        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"));
        }
View Full Code Here

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

    public void handleTimestamp(Timestamp timestamp) throws WSSecurityException {
    if (log.isDebugEnabled()) {
      log.debug("Preparing to verify the timestamp");

      DateFormat zulu = new XmlSchemaDateFormat();

      log.debug("Current time: "
          + zulu.format(Calendar.getInstance().getTime()));
      if (timestamp.getCreated() != null) {
        log.debug("Timestamp created: "
            + zulu.format(timestamp.getCreated().getTime()));
      }
      if (timestamp.getExpires() != null) {
        log.debug("Timestamp expires: "
            + zulu.format(timestamp.getExpires().getTime()));
      }
    }

    // Validate whether the security semantics have expired
    Calendar rightNow = Calendar.getInstance();
View Full Code Here

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

        currentTime -= timeToLive * 1000;
        validCreation.setTime(new Date(currentTime));

        if (doDebug) {
      log.debug("Preparing to verify the timestamp");
      DateFormat zulu = new XmlSchemaDateFormat();
      log.debug("Validation of Timestamp: Current time is "
          + zulu.format(Calendar.getInstance().getTime()));
      log.debug("Validation of Timestamp: Valid creation is "
          + zulu.format(validCreation.getTime()));
      if (timestamp.getCreated() != null) {
        log.debug("Validation of Timestamp: Timestamp created is "
            + zulu.format(timestamp.getCreated().getTime()));
      }
    }
        // Validate the time it took the message to travel
        // if (timestamp.getCreated().before(validCreation) ||
        // !timestamp.getCreated().equals(validCreation)) {
View Full Code Here

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

        try {
            Element createdElem =
                DOMUtils.getFirstChildWithName(lifetimeElem,
                                                WSConstants.WSU_NS,
                                                WSConstants.CREATED_LN);
            DateFormat zulu = new XmlSchemaDateFormat();
           
            this.created = zulu.parse(DOMUtils.getContent(createdElem));

            Element expiresElem =
                DOMUtils.getFirstChildWithName(lifetimeElem,
                                                WSConstants.WSU_NS,
                                                WSConstants.EXPIRES_LN);
            this.expires = zulu.parse(DOMUtils.getContent(expiresElem));
        } catch (ParseException e) {
            //shouldn't happen
        }
    }
View Full Code Here

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

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

        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        writer.writeStartElement("wst", "Lifetime", namespace);
        writer.writeNamespace("wsu", WSConstants.WSU_NS);
        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

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

            Lifetime lifetime = new Lifetime();
            Date creationTime = new Date();
            Date expirationTime = new Date();
            expirationTime.setTime(creationTime.getTime() + ttlMs);

            XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
            lifetime.setCreated(fmt.format(creationTime));
            lifetime.setExpires(fmt.format(expirationTime));

            providerParameters.getTokenRequirements().setLifetime(lifetime);
        }

        TokenProviderResponse providerResponse = samlTokenProvider.createToken(providerParameters);
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.