gpt4 book ai didi

org.apache.wss4j.dom.util.WSSecurityUtil.findWsseSecurityHeaderBlock()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 20:37:05 25 4
gpt4 key购买 nike

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

WSSecurityUtil.findWsseSecurityHeaderBlock介绍

[英]find a WS-Security header block for a given actor
[中]查找给定参与者的WS-Security头块

代码示例

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

/**
 * find the first ws-security header block <p/>
 *
 * @param doc the DOM document (SOAP request)
 * @param envelope the SOAP envelope
 * @param doCreate if true create a new WSS header block if none exists
 * @return the WSS header or null if none found and doCreate is false
 */
public static Element findWsseSecurityHeaderBlock(
  Document doc,
  Element envelope,
  boolean doCreate
) throws WSSecurityException {
  return findWsseSecurityHeaderBlock(doc, envelope, null, doCreate);
}

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

public void removeSecurityHeader() throws WSSecurityException {
  if (securityHeader == null) {
    if (doc == null) {
      throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
                     new Object[] {"The Document of WSSecHeader is null"});
    }
    securityHeader =
      WSSecurityUtil.findWsseSecurityHeaderBlock(
        doc, doc.getDocumentElement(), actor, false
      );
  }
  if (securityHeader != null) {
    Node parent = securityHeader.getParentNode();
    parent.removeChild(securityHeader);
  }
}

代码示例来源:origin: holodeck-b2b/Holodeck-B2B

/**
 * Gets the DOM representation of <code>wsse:Security</code> element that is the WS-Security header target to the
 * specified role/actor.
 *
 * @param target    The target of the security header which element should be retrieved
 * @param envelope  The DOM representation of the SOAP envelope
 * @return          The WS-Security element of the security header targeted to specified role/actor if contained
 *                  in the message,<br><code>null</code> otherwise
 */
public static Element getSecurityHeaderElement(final SecurityHeaderTarget target, final Document envelope) {
  Element wsSecHeader;
  try {
    wsSecHeader = WSSecurityUtil.findWsseSecurityHeaderBlock(envelope, envelope.getDocumentElement(),
                                 target.id(), false);
  } catch (WSSecurityException wse) {
    // Header block is not found
    wsSecHeader = null;
  }
  return wsSecHeader;
}

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

/**
 * Returns whether the security header is empty
 *
 * @return true if empty or if there is no security header
 *         false if non empty security header
 */
public boolean isEmpty() throws WSSecurityException {
  if (doc == null) {
    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
                   new Object[] {"The Document of WSSecHeader is null"});
  }
  if (securityHeader == null) {
    securityHeader =
      WSSecurityUtil.findWsseSecurityHeaderBlock(
        doc, doc.getDocumentElement(), actor, false
      );
  }
  if (securityHeader == null || securityHeader.getFirstChild() == null) {
    return true;
  }
  return false;
}

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

WSSecurityUtil.findWsseSecurityHeaderBlock(
  doc, doc.getDocumentElement(), actor, true
);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com