Authentication in ng refactored