Microlensing in dark matter haloes