A 38-year-old sex offender has been locked up for targeting a vulnerable homeless woman as she slept in a shop doorway.