Added session authentication for AJAX client and login/logout functionality