Authorization refactoring