Henry David Thoreau spoke these oft quoted words in a Concord Lyceum lecture on January 6th 1848. This address was published in 1849 as "Resistance to Civil Government" and again in 1866 when the term "Civil Disobedience" (a term Thoreau may never have used) first surfaced.
But how do you know you're right?
Ayn Rand had assertive thoughts about this question and in some senses extended elements of Thoreau's thesis.
"The question isn't who is going to let me; it's who is going to stop me." Ayn Rand
"There are two sides to every issue: one side is right and the other is wrong, but the middle is always evil." Ayn Rand