boolean success = false;
try {
UsersTab usersTab = new UsersTab(conn);
User user = usersTab.getUser(login, md5Pwd);
if (user == null) {
throw new ServerAccessException("Invalid user name and/or password.");
}
ExternalApiSupport wss = new ExternalApiSupport(conn, user, md5Pwd);
success = true;
return wss;
} catch (SQLException ex) {
throw new ServerAccessException("Failed to validate the connecting user.", ex);
} finally {
if (!success) {
KongaDbUtils.close(conn);
}
}