Add database implementation, fix segfault with invalide login and add basic auth worker