Implement authenticate and unauthenticate methods.