org.apache.xml.security.Init类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(543)

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

Init介绍

[英]This class does the configuration of the library. This includes creating the mapping of Canonicalization and Transform algorithms. Initialization is done by calling Init#init which should be done in any static block of the files of this library. We ensure that this call is only executed once.
[中]此类执行库的配置。这包括创建规范化和转换算法的映射。初始化是通过调用Init#Init来完成的,这应该在这个库的任何静态文件块中完成。我们确保此调用只执行一次。

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Initialize the xml signing environment and the bouncycastle provider
 */
protected static synchronized void initXmlProvider() {
  if (isInitialized) {
    return;
  }
  isInitialized = true;
  try {
    Init.init();
    RelationshipTransformService.registerDsigProvider();
    CryptoFunctions.registerBouncyCastle();
  } catch (Exception e) {
    throw new RuntimeException("Xml & BouncyCastle-Provider initialization failed", e);
  }
}

代码示例来源:origin: cloudfoundry/uaa

@BeforeAll
public static void initializeOpenSAML() throws Exception {
  if (!org.apache.xml.security.Init.isInitialized()) {
    DefaultBootstrap.bootstrap();
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** Constructor. */
public SignatureMarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method init
 *
 */
public static synchronized void init() {
  if (alreadyInitialized) {
    return;
  }
  InputStream is =
    AccessController.doPrivileged(
      (PrivilegedAction<InputStream>)
        () -> {
          String cfile =
            System.getProperty("org.apache.xml.security.resource.config");
          if (cfile == null) {
            return null;
          }
          return Init.class.getResourceAsStream(cfile);
        }
      );
  if (is == null) {
    dynamicInit();
  } else {
    fileInit(is);
  }
  alreadyInitialized = true;
}

代码示例来源:origin: org.opensaml/xmltooling

/** Constructor. */
public SignatureMarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

private DOMURIDereferencer() {
  // need to call org.apache.xml.security.Init.init()
  // before calling any apache security code
  Init.init();
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** Constructor. */
public SignatureUnmarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method getExceptionMessage
 *
 * @param msgID
 * @return message translated
 *
 */
public static String getExceptionMessage(String msgID) {
  try {
    return resourceBundle.getString(msgID);
  } catch (Throwable t) {
    if (org.apache.xml.security.Init.isInitialized()) {
      return "No message with ID \"" + msgID
      + "\" found in resource bundle \""
      + Constants.exceptionMessagesResourceBundleBase + "\"";
    }
    return I18n.NOT_INITIALIZED_MSG;
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-testsuite

public CanonXMLValueFactory()
  throws InvalidCanonicalizerException, ParserConfigurationException
{
  org.apache.xml.security.Init.init();
  c14n = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
}

代码示例来源:origin: org.opensaml/xmltooling

/** Constructor. */
public SignatureUnmarshaller() {
  if (!Init.isInitialized()) {
    log.debug("Initializing XML security library");
    Init.init();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method getExceptionMessage
 *
 * @param msgID
 * @param exArgs
 * @return message translated
 */
public static String getExceptionMessage(String msgID, Object exArgs[]) {
  try {
    return MessageFormat.format(resourceBundle.getString(msgID), exArgs);
  } catch (Throwable t) {
    if (org.apache.xml.security.Init.isInitialized()) {
      return "No message with ID \"" + msgID
      + "\" found in resource bundle \""
      + Constants.exceptionMessagesResourceBundleBase + "\"";
    }
    return I18n.NOT_INITIALIZED_MSG;
  }
}

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

public void init(ConfigurationContext configContext, AxisModule module)
    throws AxisFault {
  // Set up OpenSAML to use a DOM aware Axiom implementation
  // Axiom Parser pool is also set within the RampartSAMLBootstrap class.
  try {
    RampartSAMLBootstrap.bootstrap();
    // Initialize XML security
    org.apache.xml.security.Init.init();
  } catch (ConfigurationException ex) {
    throw new AxisFault("Failed to bootstrap OpenSAML", ex);
  }
}

代码示例来源:origin: org.opensaml/opensaml

/**
 * Initializes the Apache XMLSecurity libary.
 * 
 * @throws ConfigurationException thrown is there is a problem initializing the library
 */
protected static void initializeXMLSecurity() throws ConfigurationException {
  Logger log = getLogger();
  String lineBreakPropName = "org.apache.xml.security.ignoreLineBreaks";
  // Don't override if it was set explicitly
  if (System.getProperty(lineBreakPropName) == null) {
    System.setProperty(lineBreakPropName, "true");
  }
  if (!Init.isInitialized()) {
    log.debug("Initializing Apache XMLSecurity library");
    Init.init();
  }
}

代码示例来源:origin: org.apache.santuario/xmlsec

/**
 * Method getExceptionMessage
 *
 * @param msgID
 * @param originalException
 * @return message translated
 */
public static String getExceptionMessage(String msgID, Exception originalException) {
  try {
    Object exArgs[] = { originalException.getMessage() };
    return MessageFormat.format(resourceBundle.getString(msgID), exArgs);
  } catch (Throwable t) {
    if (org.apache.xml.security.Init.isInitialized()) {
      return "No message with ID \"" + msgID
      + "\" found in resource bundle \""
      + Constants.exceptionMessagesResourceBundleBase
      + "\". Original Exception was a "
      + originalException.getClass().getName() + " and message "
      + originalException.getMessage();
    }
    return I18n.NOT_INITIALIZED_MSG;
  }
}

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

org.apache.xml.security.Init.init();
if (!wasSet) {
  try {

代码示例来源:origin: net.shibboleth.metadata/aggregator-pipeline

/** {@inheritDoc} */
  @Override protected void doInitialize() throws ComponentInitializationException {
    super.doInitialize();

    if (verificationKey == null) {
      throw new ComponentInitializationException("Unable to initialize " + getId()
          + ", no verification key was specified");
    }

    validator = new XMLSignatureValidator(verificationKey,
        blacklistedDigests, blacklistedSignatureMethods, permittingEmptyReferences);

    if (!Init.isInitialized()) {
      Init.init();
    }
  }
}

代码示例来源:origin: net.shibboleth.metadata/aggregator-pipeline

super.doInitialize();
if (!Init.isInitialized()) {
  Init.isInitialized();

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

org.apache.xml.security.Init.init();
if (!wasSet) {
  try {

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

/**
 * Converts a {@link Document} representation of the SOAP Envelope into a Axiom representation.
 *
 * @param document The standard DOM representation of the SOAP Envelope
 * @return An {@link SOAPEnvelope} object containing the Axiom representation of the SOAP envelope, or <br>
 * <code>null</code> if the conversion fails
 */
public static SOAPEnvelope convertDOMSOAPEnvToAxiom(final Document document) {
  try {
    // If no security action is performed the Santuario may not have been initialized which causes the
    // XMLUtils.outputDOM to fail
    if (!org.apache.xml.security.Init.isInitialized())
      org.apache.xml.security.Init.init();
    // The call of the Document.normalizeDocument() method is to fix the exception described here:
    // http://apache-xml-project.6118.n7.nabble.com/Undeclared-namespace-prefix-quot-ds-quot-error-td36346.html
    document.normalizeDocument();
    final ByteArrayOutputStream os = new ByteArrayOutputStream();
    XMLUtils.outputDOM(document.getDocumentElement(), os, true);
    final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray());
    final SOAPModelBuilder stAXSOAPModelBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(bais, null);
    final SOAPEnvelope env = stAXSOAPModelBuilder.getSOAPEnvelope();
    env.build();
    return env;
  } catch (final Exception e) {
    // If anything goes wrong converting the document, just return null
    return null;
  }
}

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

org.apache.xml.security.Init.init();
if (!wasSet) {
  try {

相关文章