A homeless man admitted to having sex with his lover outside a supermarket after being spotted in the act.