Implemented autentication logic, made he lib configurable via the XML.