Feature/2621 refactor auth to make it adaptable