2015-04-17 60 views
1

我正在爲實現OAuth2的Websphere Liberty服務器構建信任關聯攔截器(TAI)。它運作良好,只是當我遇到錯誤並拋出WebTrustAssociationFailedException,我得到一個錯誤,如在服務器日誌如下:Websphere Liberty服務器無法在自定義TAI中加載WebTrustAssociationFailedException

[4/17/15 15:26:55:523 CDT] 000000b1 com.ibm.ws.webcontainer.security.internal.TAIAuthenticator E CWWKS9107E: Trust Association Init is unable to load Trust Association class com.ibm.websphere.security.WebTrustAssociationFailedException: called with invalid state param 
    at com.ibm.tivoli.monitoring.OAuthTai.OAuthTAI.getBearerToken(OAuthTAI.java:299) 
    at com.ibm.tivoli.monitoring.OAuthTai.OAuthTAI.negotiateValidateandEstablishTrust(OAuthTAI.java:420) 
    at com.ibm.ws.webcontainer.security.internal.TAIAuthenticator.authenticate(TAIAuthenticator.java:102) 
    at com.ibm.ws.webcontainer.security.WebAuthenticatorProxy.handleTAI(WebAuthenticatorProxy.java:163) 
    at com.ibm.ws.webcontainer.security.WebAuthenticatorProxy.authenticate(WebAuthenticatorProxy.java:84) 
    at com.ibm.ws.webcontainer.security.WebAppSecurityCollaboratorImpl.authenticateRequest(WebAppSecurityCollaboratorImpl.java:724) 
    at com.ibm.ws.webcontainer.security.WebAppSecurityCollaboratorImpl.determineWebReply(WebAppSecurityCollaboratorImpl.java:567) 
    at com.ibm.ws.webcontainer.security.WebAppSecurityCollaboratorImpl.performSecurityChecks(WebAppSecurityCollaboratorImpl.java:438) 
    at com.ibm.ws.webcontainer.security.WebAppSecurityCollaboratorImpl.preInvoke(WebAppSecurityCollaboratorImpl.java:389) 
    at com.ibm.wsspi.webcontainer.collaborator.CollaboratorHelper.preInvokeCollaborators(CollaboratorHelper.java:443) 
    at com.ibm.ws.webcontainer.osgi.collaborator.CollaboratorHelperImpl.preInvokeCollaborators(CollaboratorHelperImpl.java:267) 
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1026) 
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4499) 
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:282) 
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954) 
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252) 
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:584) 
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439) 
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:421) 
    at java.lang.Thread.run(Thread.java:795) 

「調用無效狀態參數」的錯誤看到上述信息會我拋出異常時提供的消息。

我不明白爲什麼沒有找到這個類。在構建期間,我從com.ibm.ws.webcontainer_1.0.1.jar獲得這個類。我本來以爲,服務器會已經有這個建在我的server.xml中爲它啓用了:

<feature>appSecurity-2.0</feature> 

但因爲它沒有找到它,我加入這個罐子我的圖書館服務器上所以它可以從那裏得到它,但這沒有什麼區別。引發此異常時,我仍然遇到上述錯誤。由於它是定義的TAI接口的一部分,並且像TAIResult這樣的接口中的其他類沒有問題,所以我很困惑。

回答

0

事實證明,這是一個錯誤消息的簡單例子。它似乎是說WebTrustAssociationFailedException類沒有找到,但事實並非如此。它實際上只是報告引發異常。 Websphere團隊有一個內部缺陷來糾正這個消息,它將在未來的版本中修復。目前它可以安全地被忽略。

0

最簡單的方法是使用Java EE安全性來保護您的應用程序並創建TAI將使用基於與用戶ID通過令牌攔截調用這個程序,並建立TAIResult:

公共靜態TAIResult創建(INT狀態,String主體);

這將在WAS註冊表中找到一個主體用戶,對其進行身份驗證並創建LTPA令牌。

您當然不希望或不需要將憑據(例如密碼)傳遞給WebSphere; TAI過程不需要實際的密碼 - 框架的本質是通過其他方式允許信任關係。

此外 - 也沒有迫切需要推出自己的TAI類和相關的專有SSO協議(令牌,加密等)。

WebSphere 7+提供開箱即用的OAuth和SAML TAI(雖然需要配置它們以進行配置)。這給你兩個開放的標準規格可供選擇。您最終不會在WebSphere端編寫代碼。這些SSO協議被廣泛採用並且已經成熟 - 由網絡開發者的整個行業進行審查,如果執行得當,很少或沒有攻擊媒介。這些方法也不需要DNS或域名對齊 - 它們被設計爲跨域使用。

+0

謝謝Sandhya。但是,我不能使用股票TAI,因爲我們需要一些自定義行爲。所以我真的只是想了解爲什麼異常類不被識別的底部。 –

相關問題