added method to authenticate a user