That would be Thomas Jefferson: "If a law is unjust, a man is not only right to disobey it, he is obligated to do so."
Yes, it is attributed to both men with perhaps a little different wording.