public boolean authenticate(String username, String password)
{
boolean valid = false;
try
{
AuthSessionFactory api = AuthSessionFactory.getInstance(configPath);
AuthSession authSession = api.createUserSession();
int status = authSession.check(username, password);
authSession.close();
api.shutdown();
valid = (status == AuthSession.ACCESS_OK);
}
catch (Exception e)
{
// an exception is expected when bad credentials are used