Our Gemara on Amud Beis uses the story of Yosef’s resisting the seduction by Potiphar’s wife as a role model and proof for moral  behavior:

⁦They said about Joseph the righteous: Each and every day, the wife of Potiphar seduced him with words. In addition, the clothes that she wore to entice him in the morning, she did not wear to entice him in the evening. The clothes that she wore to entice him in the evening, she did not wear to entice him in the morning of the next day.

I would like to make a couple of observations regarding this Aggadah. First, I couldn’t help noticing the relentless manner in which the wife of Potiphar badgered Yosef. She sexually harassed him day and night, different clothes, offerings to “just do this“, or “just do that“ seem highly reminiscent of the sexual trials of modern life. The relentless siren call of media, day and night, seem eerily similar to what some porn addicts say start with, “I’ll just watch a little news”. 

Yet Yosef resisted. Yosef was young, far away from his home and support network, lonely and in a cosmopolitan area with values different than his upbringing.

At first glance, this vignette seems to be pointing out that no one can claim an excuse that they were overcome by their desires. However, this would seem to contradict another famous sugya (Moed Kattan 17a, Kiddushin 40a, Chagiggah 16a) describes a scenario where a person is overcome with desire to sin and cannot resist it. The Gemara advises the person to travel far away to a place where he is not recognized, and wear black clothes, so at least people will not know who he is, forestalling a chillul Hashem. The Gemara then says that after that, “He should do what his heart desires.” True, perhaps the idea of exile and black clothes was meant to be a natural delay tactic to distract him from his desire and cause him to enter into a state of humility, nevertheless ultimately it sounds like there are some situations where a person cannot resist the temptation. (See Tosafos Eruvin 41b “Miy”, and Tosafos Chaggigah 16a, “veya’aseh”, which take this position conclusively in opposition to Rabbenu Chananel.) 

If we take a closer look, actually our Gemara shows a different picture than we originally thought. This Gemara does not state that Yosef proves those engaged in sexual immorality have no excuse for their behavior. Rather, it says that Yosef shows there is no excuse to the wicked persons who say that they cannot study Torah due to them being steeped in their hedonistic pursuits. The exact language is as follows:

“⁦And if a wicked man comes to heavenly judgment, the members of the court say to him: Why did you not engage in Torah? If he said: I was handsome and preoccupied with my evil inclination, as I had many temptations, they say to him: Were you any more handsome than Joseph, who did not neglect Torah despite his beauty?

Tosafos Yeshanim (ibid) also notices that the Gemara discusses Yosef in the context of Torah study and not resistance to being seduced, although Tosafos Yeshanim pursued a different track of interpretation. The conclusion we can draw is that our Gemara is not saying Yosef proves that no one has an excuse for being unable to resist sexual seduction. Instead, and surprisingly, the Gemara is delivering a different message: Even a person who succumbs to his sexual desires and is living a life of sin cannot claim this as an excuse that he is too far gone to study Torah. This peshat is based on Ben Yehoyada and Yismach Moshe, which you can look at for more detail.