문제

나을 개발하기 위해 노력하고 독립 Java web 서비스 클라이언트와 JAX-WS(지하철)에 사용하는 WS-Security 사용자 이름으로 토큰 인증(암호화,난스 및 타임스탬프)그리고 타임 스탬프 검증와 함께 WS-Addressing over SSL.

WSDL 제가 작업하를 정의하지 않는 어떠한 보안 정책 정보를 제공합니다.나는 할 수 없었을 정확히 파악하는 방법을 추가 이 헤더 정보(올바른 방법으로 할 때)WSDL 을 포함하지 않습니다.대부분의 예를 발견했을 사용하여 지하철의 주위에 회귀를 사용하여 Netbeans 자동으로 생성하려면 이에서 WSDL 도움이되지 않는다면 추천합니다.내가 보았으로 WSIT,XWSS,etc.없이 많은 명확성이나 방향입니다.JBoss WS 지하철 유망 보았지 많은 행운을 아직 찾을 수 있습니다.

누군가는 이러한 경험을 또는 제안이 있에서 이러한 작업을 수행하는 방법?도를 가리키는 나에게 올바른 방향으로 도움이 될 것입니다.나는 이에 제한되지 않는다는 특정의 기술보다 다른 이야 합 Java 기반으로합니다.

도움이 되었습니까?

해결책

나는 끝까지 파악이 문제만에 갔을 다른 방향으로 그렇게했다.나의 솔루션을 사용하여 기술설 2.1 및 JAX-WS 구현,조합의 힘 기술설과 기존 스프링 인프라 내가 이미 있었습니다.처음에는 회의적이었기 때문에 다양한 항아리에 필요한 기술설,그러나 결국 그것이 제공하는 최고의 간단한 솔루션입니다.

에 적응하는 예제에서 서 처음으로 웹사이트에 대한 클라이언트 구성, 사용하는 사용자 정의 기술설 JAXWS 네임스페이스 내에서 봄과 사용되는 Interceptor 사용자 이름 토큰 인증(암호화,난스 및 타임스탬프)그리고 타임 스탬프를 확인합니다.만 다른 단계이 작품을 만드는 나의 자신의 비밀번호 콜백을 처리기에 대해 실행되는 각각의 아웃바운드 비누 요청을 합니다.

SSL 구성,내가 다시 돌아 기술설 및 SSL 지원을 통해 도관, 지만,나는 찾을 수 있습 SSL 정 http:conduit 이름을 사용하여 일반적인 목적은 하나 추천하지 않는 생산을 위한 환경입니다.

아래의 예는 내 config 파일에 있습니다.

봄 config 파일

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:sec="http://cxf.apache.org/configuration/security"
    xmlns:http="http://cxf.apache.org/transports/http/configuration"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:cxf="http://cxf.apache.org/core"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
    http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

    <context:property-placeholder location="meta/my.properties" />
    <context:component-scan base-package="com.foo" />

    <import resource="remoting.xml" />
    <jaxws:client id="myWebService" address="${my.endpointAddress}"
                  serviceClass="com.foo.my.ServicePortType">

<!-- Testing only, adds logging of entire message in and out -->
<jaxws:outInterceptors>
    <ref bean="TimestampUsernameToken_Request" />
    <ref bean="logOutbound" />
</jaxws:outInterceptors>
<jaxws:inInterceptors>
        <ref bean="logInbound" />
    </jaxws:inInterceptors>
    <jaxws:inFaultInterceptors>
        <ref bean="logOutbound" />
    </jaxws:inFaultInterceptors>

<!-- Production settings -->
<!--
    <jaxws:outInterceptors> <ref bean="TimestampUsernameToken_Request" />
    </jaxws:outInterceptors>
    -->
</jaxws:client >



<!--
    CXF Interceptors for Inbound and Outbound messages
    Used for logging and adding Username token / Timestamp Security Header to SOAP message
-->
<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
<bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />

<bean id="TimestampUsernameToken_Request" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
    <constructor-arg>
        <map>
            <entry key="action" value="UsernameToken Timestamp" />
            <entry key="user" value="${my.group}.${my.userId}" />
            <entry key="passwordType" value="PasswordDigest" />
            <entry key="passwordCallbackClass" value="com.foo.my.ClientPasswordHandler" />
        </map>
    </constructor-arg>
</bean>

<!--
    http:conduit namespace is used to configure SSL using keystores, etc
    *.http-conduit works but CXF says its only supposed to be for temporary use (not production),
    well until the correct way works, we're going to use it.
-->
<http:conduit name="*.http-conduit">
    <http:tlsClientParameters   
                  secureSocketProtocol="SSL">
                  <!--
          <sec:trustManagers>
        <sec:keyStore type="JKS"
                         password="${my.truststore.password}"
                         file="${my.truststore.file}" />
                  </sec:trustManagers>
                  -->
                  <sec:keyManagers keyPassword="${my.keystore.password}">
                    <sec:keyStore type="JKS"
                         password="${my.keystore.password}"
                         file="${my.keystore.file}" />
                  </sec:keyManagers>

                  <!-- Cipher suites filters specify the cipher suite to allow/disallow in SSL communcation  -->
                  <sec:cipherSuitesFilter>
                    <sec:include>.*_WITH_3DES_.*</sec:include>
                    <sec:include>.*_EXPORT_.*</sec:include>
                    <sec:include>.*_EXPORT1024_.*</sec:include
                    <sec:include>.*_WITH_DES_.*</sec:include
                    <sec:exclude>.*_WITH_NULL_.*</sec:exclude
                    <sec:exclude>.*_DH_anon_.*</sec:exclude>
                  </sec:cipherSuitesFilter>
    </http:tlsClientParameters>
</http:conduit>
</beans>

Java 클라이언트 비밀번호 처리기:

import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.log4j.Logger;
import org.apache.ws.security.WSPasswordCallback;


/**
 * <p>
 * Provides a callback handler for use processing outbound/inbound SOAP messages.
 * ClientPasswordHandler sets the password used in the WS-Security UsernameToken 
 * SOAP header.
 * 
 * </p>
 * 
 * Created: Apr 1, 2009
 * @author Jared Knipp
 * 
 */
public final class ClientPasswordHandler implements CallbackHandler {
    protected static Logger log = Logger.getLogger(ClientPasswordHandler.class);

    private static final PropertyManager PROPS = PropertyManager.getInstance();
    private static String PASSWORD = PROPS.getPassword();
    private static boolean IS_PASSWORD_CLEAR = PROPS.getIsClearPassword();

    /**
     * Client password handler call back.  This method is used to provide
     * additional outbound (or could be inbound also) message processing.
     * 
     * Here the method sets the password used in the UsernameToken SOAP security header
     * element in the SOAP header of the outbound message.  For our purposes the clear 
     * text password is SHA1 hashed first before it is hashed again along with the nonce and 
     * current timestamp in the security header.
     */
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        if(log.isDebugEnabled()) { log.debug("Setting password for UsernameToken"); }
        WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];


        // Check to see if the password is already Hashed via SHA1, if not then hash it first
        if(IS_PASSWORD_CLEAR) {
            synchronized(this) {
                PASSWORD = PasswordDigestUtil.doPasswordDigest(PASSWORD);
                IS_PASSWORD_CLEAR = false;
                PROPS.setIsClearPassword(IS_PASSWORD_CLEAR);
                PROPS.setPassword(PASSWORD);
                PROPS.saveProperties();
            }
        }

        pc.setPassword(PASSWORD);
    }
}

다른 팁

항이 있는 경우에 없 WSDL,당신은 확실히 그것의 서비스에 의해 설명 WSDL?WSDL 제공하는 것을 의미하는 데 필요한 모든 정보를 설명하는 서비스를 포함한 보안 정책을 사용하는 데 필요한 서비스입니다.

어떤 플랫폼았다 WSDL 에서 오는가?가능 WSDL 지 않은 완전한 설명?예를 들어,그것은이 될 수 있는 WSDL d 에서 또 다른 WSDL 제공하 보안 정보가 들어 있습니다.

가 여기 게시물을 구성하는 방법을 설명하는 클라이언트와 서버에서 처음으로 WS-Security: JAX-WS 웹 서비스로 봄과 기술설

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top