powered by Jive Software

Checking username/password combination

I’‘m trying to create a function in a plugin that validates a username/password combination for clients (we want to link the login credentials to other services as well). Below is my (simplified) attempt, but for some reason it doesn’‘t work. I’‘ve tried both usernames that have their password stored plain text and usernames that have it stored encrypted. The debug strings shows that both plain and digest are supported, but in all cases, the UnauthorizedException is thrown. Can anyone figure out what’'s wrong?

private static final String TOKEN = “Abc1234”;

public boolean validateLogin(String xmppUser, String xmppPass)

{

if (AuthFactory.isPlainSupported())

{

Log.debug(“Plain authentication is supported.”);

try

{

if (AuthFactory.authenticate(xmppUser, xmppPass) != null)

{

Log.debug(“Plain authentication is valid!”);

return true;

}

}

catch (UnauthorizedException e)

{

Log.debug(“Plain authentication username/password mismatch.”);

}

}

if (AuthFactory.isDigestSupported())

{

Log.debug(“Digest authentication is supported.”);

try

{

if (AuthFactory.authenticate(

xmppUser,

TOKEN,

AuthFactory.createDigest(TOKEN, xmppPass)

) != null)

{

Log.debug(“Digest authentication is valid!”);

return true;

}

}

catch (UnauthorizedException e)

{

Log.debug(“Digest authentication username/password mismatch.”);

}

}

// everything failed.

return false;

}[/code]

Ok, I’'m an ass. The function works fine - I mixed up the user-accounts of our development and production environment.