org.apache.ws.security.message.WSSecTimestamp类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.apache.ws.security.message.WSSecTimestamp类的一些代码示例,展示了WSSecTimestamp类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WSSecTimestamp类的具体详情如下:
包路径:org.apache.ws.security.message.WSSecTimestamp
类名称:WSSecTimestamp

WSSecTimestamp介绍

[英]Builds a WS Timestamp and inserts it into the SOAP Envelope. Refer to the WS specification 1.0. chapter 10 / appendix A.2
[中]构建WS-Timestamp并将其插入SOAP信封。请参阅WS-specification 1.0。第10章/附录A.2

代码示例

代码示例来源:origin: org.apache.rampart/rampart-core

/**
 * @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");
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

/**
 * Adds a new <code>Timestamp</code> to a soap envelope.
 * 
 * A complete <code>Timestamp</code> is constructed and added to the
 * <code>wsse:Security</code> header.
 * 
 * @param doc The SOAP envelope as W3C document
 * @param secHeader The security header that hold this Timestamp
 * @return Document with Timestamp added
 * @throws Exception
 */
public Document build(Document doc, WSSecHeader secHeader) {
  log.debug("Begin add timestamp...");
  prepare(doc);
  prependToHeader(secHeader);
  return doc;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData)
    throws WSSecurityException {
    //
    // add the Timestamp to the SOAP Envelope
    //
    WSSecTimestamp timeStampBuilder = new WSSecTimestamp(reqData.getWssConfig());
    timeStampBuilder.setTimeToLive(handler.decodeTimeToLive(reqData, true));
    timeStampBuilder.build(doc, reqData.getSecHeader());
  }
}

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-common

wsSecHeader.insertSecurityHeader(soapPart);
WSSecTimestamp wsSecTimeStamp = new WSSecTimestamp();
wsSecTimeStamp.setTimeToLive(60);
wsSecTimeStamp.build(soapPart, wsSecHeader);
signParts.add(new WSEncryptionPart(soapConstants.getBodyQName()
    .getLocalPart(), soapConstants.getEnvelopeURI(), "Content"));
signParts.add(new WSEncryptionPart(wsSecTimeStamp.getId()));
List<Reference> referenceList = wsSecSignature.addReferencesToSign(
    signParts, wsSecHeader);

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.security.mgt

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

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

/**
 * Creates a Timestamp element.
 * 
 * The method prepares and initializes a WSSec Timestamp structure after the
 * relevant information was set. Before calling <code>prepare()</code> the
 * parameter such as <code>timeToLive</code> can be set if the default
 * value is not suitable.
 * 
 * @param doc The SOAP envelope as W3C document
 */
public void prepare(Document doc) {
  ts = new Timestamp(getWsConfig().isPrecisionInMilliSeconds(), doc, 
            getWsConfig().getCurrentTime(), timeToLive);
  String tsId = getWsConfig().getIdAllocator().createId("TS-", ts);
  ts.setID(tsId);
}

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-saml-sts

wsSecHeader.insertSecurityHeader(soapPart);
WSSecTimestamp wsSecTimeStamp = new WSSecTimestamp();
wsSecTimeStamp.setTimeToLive(60);
wsSecTimeStamp.build(soapPart, wsSecHeader);
    .getLocalPart(), soapConstants.getEnvelopeURI(), "Content"));
signParts.add(new WSEncryptionPart(bstId));
signParts.add(new WSEncryptionPart(wsSecTimeStamp.getId()));
List<Reference> referenceList = sign.addReferencesToSign(signParts,
    wsSecHeader);

代码示例来源:origin: org.apache.ws.security/wss4j

public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData)
    throws WSSecurityException {
    //
    // add the Timestamp to the SOAP Envelope
    //
    WSSecTimestamp timeStampBuilder = new WSSecTimestamp(reqData.getWssConfig());
    timeStampBuilder.setTimeToLive(handler.decodeTimeToLive(reqData, true));
    timeStampBuilder.build(doc, reqData.getSecHeader());
  }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.security.mgt

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

代码示例来源:origin: org.apache.ws.security/wss4j

/**
 * Creates a Timestamp element.
 * 
 * The method prepares and initializes a WSSec Timestamp structure after the
 * relevant information was set. Before calling <code>prepare()</code> the
 * parameter such as <code>timeToLive</code> can be set if the default
 * value is not suitable.
 * 
 * @param doc The SOAP envelope as W3C document
 */
public void prepare(Document doc) {
  ts = new Timestamp(getWsConfig().isPrecisionInMilliSeconds(), doc, 
            getWsConfig().getCurrentTime(), timeToLive);
  String tsId = getWsConfig().getIdAllocator().createId("TS-", ts);
  ts.setID(tsId);
}

代码示例来源:origin: be.fedict.eid-trust-service/eid-trust-service-xkms2-ws-impl

wsSecHeader.insertSecurityHeader(soapPart);
WSSecTimestamp wsSecTimeStamp = new WSSecTimestamp();
wsSecTimeStamp.setTimeToLive(0);
wsSecTimeStamp.build(soapPart, wsSecHeader);
sign.appendBSTElementToHeader(wsSecHeader);
Vector<WSEncryptionPart> signParts = new Vector<WSEncryptionPart>();
signParts.add(new WSEncryptionPart(wsSecTimeStamp.getId()));
SOAPConstants soapConstants = WSSecurityUtil
    .getSOAPConstants(soapPart.getDocumentElement());

代码示例来源:origin: wso2/carbon-identity-framework

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

代码示例来源:origin: org.apache.ws.security/wss4j

/**
 * Adds a new <code>Timestamp</code> to a soap envelope.
 * 
 * A complete <code>Timestamp</code> is constructed and added to the
 * <code>wsse:Security</code> header.
 * 
 * @param doc The SOAP envelope as W3C document
 * @param secHeader The security header that hold this Timestamp
 * @return Document with Timestamp added
 * @throws Exception
 */
public Document build(Document doc, WSSecHeader secHeader) {
  log.debug("Begin add timestamp...");
  prepare(doc);
  prependToHeader(secHeader);
  return doc;
}

相关文章