Refactor on authentication and authorization methods.