Refactors authenticate class method