Package org.apache.wss4j.dom.util

Examples of org.apache.wss4j.dom.util.XmlSchemaDateFormat.format()


        creationTime.setTime(creationTime.getTime() + (60L * 2L * 1000L));
        Date expirationTime = new Date();
        expirationTime.setTime(creationTime.getTime() + (requestedLifetime * 1000L));
        Lifetime lifetime = new Lifetime();
        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        lifetime.setCreated(fmt.format(creationTime));
        lifetime.setExpires(fmt.format(expirationTime));
        providerParameters.getTokenRequirements().setLifetime(lifetime);   
       
        assertTrue(samlTokenProvider.canHandleToken(WSConstants.WSS_SAML2_TOKEN_TYPE));
        try {
View Full Code Here


        Date expirationTime = new Date();
        expirationTime.setTime(creationTime.getTime() + (requestedLifetime * 1000L));
        Lifetime lifetime = new Lifetime();
        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        lifetime.setCreated(fmt.format(creationTime));
        lifetime.setExpires(fmt.format(expirationTime));
        providerParameters.getTokenRequirements().setLifetime(lifetime);   
       
        assertTrue(samlTokenProvider.canHandleToken(WSConstants.WSS_SAML2_TOKEN_TYPE));
        try {
            samlTokenProvider.createToken(providerParameters);
View Full Code Here

        // Set expected lifetime to 1 minute
        Date creationTime = new Date();
        creationTime.setTime(creationTime.getTime() + (60L * 2L * 1000L));
        Lifetime lifetime = new Lifetime();
        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        lifetime.setCreated(fmt.format(creationTime));
        providerParameters.getTokenRequirements().setLifetime(lifetime);   
       
        assertTrue(samlTokenProvider.canHandleToken(WSConstants.WSS_SAML2_TOKEN_TYPE));

        TokenProviderResponse providerResponse = samlTokenProvider.createToken(providerParameters);
View Full Code Here

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

        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();
    }

    protected void addAppliesTo(XMLStreamWriter writer, String appliesTo) throws XMLStreamException {
View Full Code Here

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

        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();
    }

    protected void addAppliesTo(XMLStreamWriter writer, String appliesTo) throws XMLStreamException {
View Full Code Here

            lifetime = 300L;
        }
        expirationTime.setTime(creationTime.getTime() + (lifetime * 1000L));

        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        created.setValue(fmt.format(creationTime));
        expires.setValue(fmt.format(expirationTime));
       
        LifetimeType lifetimeType = QNameConstants.WS_TRUST_FACTORY.createLifetimeType();
        lifetimeType.setCreated(created);
        lifetimeType.setExpires(expires);
View Full Code Here

        }
        expirationTime.setTime(creationTime.getTime() + (lifetime * 1000L));

        XmlSchemaDateFormat fmt = new XmlSchemaDateFormat();
        created.setValue(fmt.format(creationTime));
        expires.setValue(fmt.format(expirationTime));
       
        LifetimeType lifetimeType = QNameConstants.WS_TRUST_FACTORY.createLifetimeType();
        lifetimeType.setCreated(created);
        lifetimeType.setExpires(expires);
        return lifetimeType;
View Full Code Here

        }
       
        // 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.ErrorCode.INVALID_SECURITY,
                "invalidTimestamp",
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.