Refactoring authorization