The quick answer to this is that Thoreau says the only obligation he has the right to assume is the obligation to follow his own conscience. Here is a quote that shows that.
The only obligation which I have a right to assume is to do at any time what I think right.
What Thoreau is saying here is that people must not simply follow the law. The law, made by the majority of the people, can be wrong or immoral. A person must not, therefore, assume the obligation to follow the law. That would be to give up their individual consciences. Instead, people must always do what they personally think is right. Otherwise, society would be a group of people, marching in lockstep and evil laws would not be resisted.
In his letter from a Birmingham jail after he was arrested during the Civil Rights movement, Martin Luther King takes his final words directly from Thoreau:
I submit that an individual who breaks a law that conscience tells him is unjust, and willingly accepts the penalty by staying in jail to arouse the conscience of the community over its injustice, is in reality expressing the very highest respect for law.
In both cases, that of Thoreau and that of King, they protest, not the rule of law, but the "tyranny of the majority" as John Stuart Mill expressed the formation of rules called "laws" by controlling groups. For, to use the term employed by Emerson, the "joint-stock company" of society agree for their own interests that there should be a law. This law, be it one for a war or one for segregation of races, is an unjust and should, therefore, be challenged and rejected. Hence, Thoreau went to jail, and King also went to jail in protest of the wrong of making something a law designed solely for the profit of others that is, therefore, unjust. They both followed their consciences as every free man should be allowed to do.