Search code examples
httpibm-connections

Check that a users authentication is valid


So I have the following function I'm using to try and connect the 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);
}

But I have no way of knowing if the user gets signed in or not. from what I can tell there is no difference when you give valid or invalid credentials.

The ONLY way I've found is doing a post request, but that doesn't work as I'd end up creating a useless thread or reply.

Any ideas?


Solution

  • You should make a call (GET) to /forums/atom/topics/my you'll get the service doc back, the service document will include user details if the credentials are correct. if they are wrong you'll get a 401 error code if not able to read the forum You can read more about the service doc at 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