2013-06-26 54 views
1

我正在使用WSO2 Identity Server的4.1.0版。我已經使用了WSO2 AuthenticationAdmin服務(localhost:9443/services/AuthenticationAdmin)來登錄,檢查身份驗證器等。還有一個「註銷」操作。WSO2 AuthenticationAdmin註銷

當soapUI生成註銷請求時,它不包含任何值得注意的元素,如名稱空間爲http://authentication.services.core.carbon.wso2.org的模式(xsd)所證實的。 SOAP請求體如下。

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:aut="http://authentication.services.core.carbon.wso2.org"> 
<soap:Header/> 
    <soap:Body> 
    <aut:logout/> 
</soap:Body> 
</soap:Envelope> 

發送請求時,RAW響應如下。

HTTP/1.1 202 Accepted 
Date: Wed, 26 Jun 2013 08:29:48 GMT 
Server: WSO2 Carbon Server 
Content-Type: text/xml;charset=UTF-8 
Set-Cookie: JSESSIONID=94784CC9FC03E9FA3822CFDDAD0D36F6; Path=/; Secure; HttpOnly 
Vary: Accept-Encoding 
Content-Encoding: gzip 
Keep-Alive: timeout=15, max=100 
Connection: Keep-Alive 
Transfer-Encoding: chunked 

首先,我認爲在響應中沒有SOAP消息。此外,HTTP狀態是202,這意味着請求被接受處理,但處理尚未完成。

如何使用此服務註銷?

應將哪些元素添加到< aut:logout>?

應該將JSESSIONID添加到請求的標題中嗎?

如何將此註銷與loginWithRememberMeOption結合使用?

------- UPDATE 在回顧了xsd之後,我發現必須將一個wsa:action添加到SOAP Header中。這樣做後,我收到了以下答覆。該答覆要求輸入MessageID。但我不確定這個值應該是什麼。

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> 
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"> 
     <wsa:Action>http://www.w3.org/2005/08/addressing/fault</wsa:Action> 
    </soapenv:Header> 
    <soapenv:Body> 
     <soapenv:Fault> 
     <soapenv:Code> 
      <soapenv:Value>soapenv:Sender</soapenv:Value> 
      <soapenv:Subcode> 
       <soapenv:Value xmlns:wsa="http://www.w3.org/2005/08/addressing">wsa:MessageAddressingHeaderRequired</soapenv:Value> 
      </soapenv:Subcode> 
     </soapenv:Code> 
     <soapenv:Reason> 
      <soapenv:Text xml:lang="en-US">A required header representing a Message Addressing Property is not present</soapenv:Text> 
     </soapenv:Reason> 
     <soapenv:Detail> 
      <wsa:ProblemHeaderQName xmlns:wsa="http://www.w3.org/2005/08/addressing">wsa:MessageID</wsa:ProblemHeaderQName> 
     </soapenv:Detail> 
     </soapenv:Fault> 
    </soapenv:Body> 
</soapenv:Envelope> 

當添加一個生成的MessageID時,它又是一個帶有HTTP 202狀態的空SOAP響應。

+0

Afaik當您登錄時,將創建HTTP會話並將會話ID cookie發送給您。當你執行註銷時,你應該把這個cookie設置爲一個頭部請求。 –

+0

嗨阿德里安。我試過了,如下所示: - 將生成的註銷soap請求保持原樣。 - 在名爲'cookie'的SOAP請求中添加了值爲'JSESSIONID = EC91C18055FD38EF0FB112D301386B25;路徑= /;安全;僅Http」(就像我收到了上登錄) - 啓用WS Adressing - 已啓用郵件ID產生 的響應是一個空的SOAP響應,再次與HTTP狀態202 當我不啓用WS尋址,響應也空,202. 當我啓用WS Adressing,但不添加MessageID時,SOAP錯誤說我必須添加它。 – JimRoy

回答

0

註銷方法只是使會話無效。

您只需從soapUI中調用註銷操作即可。沒有參數。

如果您查看AuthenticationAdmin WSDL,則可以看到註銷操作沒有輸出。這就是您獲取HTTP 202狀態碼的原因。

您可以通過在carbon.xml(/repository/conf/carbon.xml)改變<HideAdminServiceWSDLs>配置爲false查看WSDL

<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

輸入您的瀏覽器下面以查看WSDL。

https://開頭:9443 /服務/ AuthenticationAdmin WSDL

我希望這有助於!

+0

謝謝Isuru,它有點幫助。您是否可以確認身份服務器是否不會提供明確的響應,無論用戶是否確實已成功註銷? – JimRoy

+0

註銷操作只會使會話無效。理想情況下,當會話在服務器中失效時,您將自動註銷。你可以從源代碼中看到它:https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0/core/org.wso2.carbon.core.services/4.1.0/src/主/ JAVA /組織/ WSO2 /碳/核心/服務/認證/ AuthenticationAdmin.java –