Chris Froome is assured of a second Tour de France title after holding on to the yellow jersey in the penultimate stage.