检查用户身份验证是否有效

时间:2015-03-25 23:45:07

标签: http ibm-connections

所以我使用以下函数来尝试连接IBM Connections:

private boolean checkCredentials(String username, String password){
    // Connect to IBM Connections
    HttpClient client = new HttpClient();
    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password);
    AuthScope authscope = new AuthScope("w3-connections.ibm.com", AuthScope.ANY_PORT, AuthScope.ANY_REALM);
    client.getState().setCredentials(authscope, credentials);
}

但我无法知道用户是否登录。据我所知,当你提供有效或无效的证书时没有区别。

我发现的唯一方法是发帖请求,但这不起作用,因为我最终创建了一个无用的线程或回复。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您应该拨打电话(GET)到/ forums / atom / topics /我将返回服务文档,如果凭据正确,服务文档将包含用户详细信息。如果他们错了,如果无法阅读论坛,您将收到401错误代码您可以在http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Getting_the_My_Topics_feed_ic50&content=apicontent了解有关服务文档的更多信息