2013-11-27 42 views
1

我對SOAP Web服務比較陌生,它似乎是一個基本的東西,但是我仍然無法找到解決它的方式。我有一個使用Spring WS和XWS安全性編寫的SOAP服務器。這些都是相關的豆類:用nonce創建WS WS摘要認證,創建挑戰

<bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor"> 
    <property name="policyConfiguration" 
      value="classpath:security-policy.xml"/> 
    <property name="callbackHandlers"> 
     <list> 
      <ref bean="passwordValidationHandler"/> 
     </list> 
    </property> 
</bean> 

<bean id="passwordValidationHandler" class="org.springframework.ws.soap.security.xwss.callback.SimplePasswordValidationCallbackHandler"> 
    <property name="users"> 
     <props> 
      <prop key="user">*****</prop> 
     </props> 
    </property> 
</bean> 

而下面是security-policy.xml

<xwss:SecurityConfiguration xmlns:xwss="http://java.sun.com/xml/ns/xwss/config"> 
    <xwss:RequireUsernameToken passwordDigestRequired="true" nonceRequired="true"/> 
    <xwss:UsernameToken digestPassword="true" useNonce="true"/> 
</xwss:SecurityConfiguration> 

的事情是,我想用隨機數以extablish摘要認證(即防止了攔截的請求一次性令牌從再次發送)。據我所知(這裏描述的是http://www.whitemesa.com/soapauth.html#S4),服務器應該創建一個質詢(我認爲是隨機數和時間戳),然後客戶端應該使用它的密碼和時間戳進行加密並將其發送回服務器進行驗證。這應該適用於每個請求。即使用戶發送空請求,服務器也應該提供挑戰。但在我的情況下,它不起作用。我錯過了什麼嗎?

回答

0

因爲它變成了,它不一定是服務器誰應該產生nonce。我在客戶端生成它,按照rules連接並散列它,然後發送到服務器。坦率地說,我只能通過調試Spring WS源並找到確切的身份驗證問題,找到錯誤的根源。