extract auth to class