added basic authentication logic