Package org.apache.ws.security.message

Examples of org.apache.ws.security.message.WSSecTimestamp


    protected WSSecTimestamp createTimestamp() {
        Collection<AssertionInfo> ais;
        ais = aim.get(SP12Constants.INCLUDE_TIMESTAMP);
        if (ais != null) {
            for (AssertionInfo ai : ais) {
                timestampEl = new WSSecTimestamp();
                timestampEl.prepare(saaj.getSOAPPart());
                ai.setAsserted(true);
            }                   
        }
        return timestampEl;
View Full Code Here


        bst.setEncodingType(BASE64_NS);
        bst.setToken("12345678".getBytes());
        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);
       
        Vector parts = new Vector();
        parts.add(new WSEncryptionPart(bst.getID()));
        parts.add(new WSEncryptionPart(timestamp.getId()));
        sign.setParts(parts);
       
        Document signedDoc = sign.build(doc, crypto, secHeader);
       
        if (LOG.isDebugEnabled()) {
View Full Code Here

    protected WSSecTimestamp createTimestamp() {
        Collection<AssertionInfo> ais;
        ais = aim.get(SP12Constants.INCLUDE_TIMESTAMP);
        if (ais != null) {
            for (AssertionInfo ai : ais) {
                timestampEl = new WSSecTimestamp();
                Object o = message.getContextualProperty(SecurityConstants.TIMESTAMP_TTL);
                int ttl = 300//default is 300 seconds
                if (o instanceof Number) {
                    ttl = ((Number)o).intValue();
                } else if (o instanceof String) {
View Full Code Here

            WSSecUsernameToken utBuilder = new WSSecUsernameToken();
            utBuilder.setPasswordType(WSConstants.PASSWORD_TEXT);
            utBuilder.setUserInfo(username, password);
            utBuilder.build(doc, secHeader);

            WSSecTimestamp tsBuilder = new WSSecTimestamp();
            tsBuilder.build(doc, secHeader);

            /**
             * Set the new SOAPEnvelope
             */
            msgCtx.setEnvelope(Axis2Util.getSOAPEnvelopeFromDOMDocument(doc, false));
View Full Code Here

     * @param rmd
     */
    protected void addTimestamp(RampartMessageData rmd) {
        log.debug("Adding timestamp");

        WSSecTimestamp timestampBuilder = new WSSecTimestamp();
        timestampBuilder.setWsConfig(rmd.getConfig());

        timestampBuilder.setTimeToLive(RampartUtil.getTimeToLive(rmd));

        // add the Timestamp to the SOAP Enevelope

        timestampBuilder.build(rmd.getDocument(), rmd.getSecHeader());

        if (log.isDebugEnabled()) {
            log.debug("Timestamp id: " + timestampBuilder.getId());
        }
        rmd.setTimestampId(timestampBuilder.getId());

        this.timestampElement = timestampBuilder.getElement();
        log.debug("Adding timestamp: DONE");
    }
View Full Code Here

    updateWssDocument( context, doc );
  }

  private static Element setWsTimestampToken( String ttl, Document doc )
  {
    WSSecTimestamp addTimestamp = new WSSecTimestamp();
    addTimestamp.setTimeToLive( Integer.parseInt( ttl ) );

    WSSConfig wsc = WSSConfig.getNewInstance();
    wsc.setPrecisionInMilliSeconds( false );
    wsc.setTimeStampStrict( false );
    addTimestamp.setWsConfig( wsc );

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

  public void process( WSSecHeader secHeader, Document doc, PropertyExpansionContext context )
  {
    if( timeToLive <= 0 )
      return;

    WSSecTimestamp timestamp = new WSSecTimestamp();
    timestamp.setTimeToLive( timeToLive );

    if( !strictTimestamp )
    {
      WSSConfig wsc = WSSConfig.getNewInstance();
      wsc.setPrecisionInMilliSeconds( false );
      wsc.setTimeStampStrict( false );
      timestamp.setWsConfig( wsc );
    }

    timestamp.build( doc, secHeader );
  }
View Full Code Here

      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      dbf.setNamespaceAware( true );
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse( new InputSource( new StringReader( req ) ) );
      WSSecTimestamp addTimestamp = new WSSecTimestamp();
      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

                ttl = Integer.parseInt((String)o);
            }
            if (ttl <= 0) {
                ttl = 300;
            }
            timestampEl = new WSSecTimestamp(wssConfig);
            timestampEl.setTimeToLive(ttl);
            timestampEl.prepare(saaj.getSOAPPart());
            for (AssertionInfo ai : ais) {
                ai.setAsserted(true);
            }                   
View Full Code Here

     * @param rmd
     */
    protected void addTimestamp(RampartMessageData rmd) {
        log.debug("Adding timestamp");
       
        WSSecTimestamp timestampBuilder = new WSSecTimestamp();
        timestampBuilder.setWsConfig(rmd.getConfig());

        timestampBuilder.setTimeToLive(RampartUtil.getTimeToLive(rmd));
       
        // add the Timestamp to the SOAP Enevelope

        timestampBuilder.build(rmd.getDocument(), rmd
                .getSecHeader());
       
        log.debug("Timestamp id: " + timestampBuilder.getId());

        rmd.setTimestampId(timestampBuilder.getId());
       
        this.timestampElement = timestampBuilder.getElement();
        log.debug("Adding timestamp: DONE");
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.security.message.WSSecTimestamp

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.