Authentication controller refactoring