Implements user authentication