Refactor Authentication in Controllers