How to plug basic auth to an existing database?