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

Check that a users authentication is valid

所以我使用以下函数来尝试连接 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);
}

但我无法知道用户是否登录。据我所知,提供有效或无效凭据没有区别。

我发现的唯一方法是发出 post 请求,但这行不通,因为我最终会创建一个无用的线程或回复。

有什么想法吗?

您应该调用 (GET) /forums/atom/topics/my 您将获得服务文档,如果凭据正确,服务文档将包含用户详细信息。如果他们错了,如果无法阅读论坛,您将收到 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

阅读有关服务文档的更多信息