2015-04-17 61 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,因为我们需要一些自定义行为。所以我真的只是想了解为什么异常类不被识别的底部。 –

相关问题