Small refactor of authentication in controller