Refactor Http auth