Java 密钥库 bean 使 HTTPS 地址不可访问

问题描述 投票:0回答:0

我正在尝试将应用程序从 WebSphere (8.5) 迁移到 WildFly (20)。我已经使用应用程序上下文来配置 Web 服务模板。我在其中使用了密钥库 bean。当我将应用程序部署到 WildFly 服务器时,无法访问 HTTPS 地址。 WildFly 上的其他应用程序出现错误。我的上下文如下所示。当我关闭下面的应用程序上下文时,应用程序 WSDL 变得可访问。我不确定在哪里检查。属于此应用程序的 WildFly 服务器上没有错误。有什么地方我应该检查 WildFly 配置吗?

<bean id="messageFactory"
    class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />

<bean id="logInterceptor"
    class="com.xxx.yyy.zzz.service.spring.log.SpringWsClientLogInterceptor" />

<bean id="ibsWSSecurityInterceptorTimestamp"
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="securementActions" value="Timestamp" />
    <property name="timestampPrecisionInMilliseconds"
        value="true" />
</bean>

<bean id="ibsWSSecurityInterceptorUsernameToken"
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="securementActions" value="UsernameToken" />
    <property name="securementUsername" value="${tks.username}" />
    <property name="securementPassword" value="${tks.password}" />
    <property name="securementUsernameTokenElements"
        value="Nonce Created" />
    <property name="securementPasswordType"
        value="PasswordDigest" />
</bean>

<bean id="ibsWSSecurityInterceptorEnc"
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="securementActions" value="Encrypt" />
    <property name="securementEncryptionUser"
        value="${encrypt.username}" />
    <property name="securementEncryptionSymAlgorithm"
        value="http://www.w3.org/2001/04/xmlenc#aes128-cbc" />
    <property name="securementEncryptionKeyTransportAlgorithm"
        value="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
    <property name="securementEncryptionParts"
        value="{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body" />
    <property name="securementEncryptionCrypto">
        <ref bean="keystore" />
    </property>
</bean>

<bean id="ibsWSSecurityInterceptorSign"
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="securementActions" value="Signature" />

    <property name="securementUsername"
        value="${securement.username}" />
    <property name="securementPassword"
        value="${securement.password}" />
    <property name="securementSignatureParts"
        value="{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken" />
    <property name="securementSignatureCrypto">
        <ref bean="keystore" />
    </property>
</bean>

<bean id="ibsWSSecurityInterceptorValidateRes"
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="validationActions"
        value="Signature Encrypt Timestamp" />

    <property name="validationSignatureCrypto">
        <ref bean="keystore" />
    </property>

    <property name="validationDecryptionCrypto">
        <ref bean="keystore" />
    </property>

    <property name="validationCallbackHandler">
        <bean
            class="org.springframework.ws.soap.security.wss4j.callback.KeyStoreCallbackHandler">
            <property name="privateKeyPassword"
                value="${validation.privatekey}" />
        </bean>
    </property>
</bean>

<bean id="keystore"
    class="org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean">
    <property name="keyStorePassword" value="${keystore.password}" />
    <property name="keyStoreLocation" value="${keystore.location}" />
</bean>

<bean id="marshaller"
    class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPath"
        value="com.xxx.yyyy.zzz.aaaa.wsutil.ws" />
</bean>

<bean id="ibsWebServiceTemplate"
    class="org.springframework.ws.client.core.WebServiceTemplate">
    <constructor-arg ref="messageFactory" />
    <property name="interceptors">
        <list>
            <ref bean="ibsWSSecurityInterceptorTimestamp" />
            <ref bean="ibsWSSecurityInterceptorUsernameToken" />
            <ref bean="ibsWSSecurityInterceptorEnc" />
            <ref bean="ibsWSSecurityInterceptorSign" />
            <ref bean="ibsWSSecurityInterceptorValidateRes" />
            <ref bean="logInterceptor" />
        </list>
    </property>
    <property name="marshaller" ref="marshaller" />
    <property name="unmarshaller" ref="marshaller" />
</bean>
java wildfly keystore applicationcontext
© www.soinside.com 2019 - 2024. All rights reserved.