Moses
Genesis 39:21ESV·traditional attribution

But the LORD was with Joseph and showed him steadfast love and gave him favor in the sight of the keeper of the prison.

John Calvin Reformed @genevareformer

21. But the Lord was with Joseph. It appears, from the testimony of the Psalmist just cited, that Joseph’s extreme sufferings were not immediately alleviated. The Lord purposely suffered him to be reduced to extremity, that he might bring him back as from the grave.

Matthew Henry Presbyterian @wholebiblehenry

Here is, 1. Joseph wronged by his master. He believed the accusation, and either Joseph durst not make his defence by telling the truth, as it would reflect too much upon his mistress, or his master would not hear it, or would not believe it, and there is no remedy, he is condemned to perpetual imprisonment, Gen 39:19, Gen 39:20.

Commenting on Genesis 39:19-23

John Gill Reformed Baptist @doctorgill

And the Lord was with Joseph,.... Comforting him with his presence under his afflictions; supporting him with his right hand; sanctifying all his troubles to him, and so causing him to bear them patiently and cheerfully: and showed him mercy, and gave him favour in the sight of the keeper of the prison; who was the underkeeper to Potiphar; God so wrought upon the heart...