[mod_auth] refactor out auth backend code