Baruch Spinoza said this quote

Everyone is by absolute natural right the master of his own thoughts, and thus utter failure will attend any attempt in a commonwealth to force men to speak only as prescribed by the sovereign despite their different and opposing opinions.