Refactor ActsAsTokenAuthenticationHandler