It has been narrated on the authority of Junida b. Abu Umayya who said
We called upon 'Ubada b. Samit who was ill and said to him: May God give you health I Narrate to us a tradition which God may prove beneficial (to us) and which you have heard from the Messenger of Allah (ﷺ). He said: The Messenger of Allah (ﷺ) called us and we took the oath of allegiance to him. Among the injunctions he made binding upon us was: Listening and obedience (to the Amir) in our pleasure and displeasure, in our adversity and prosperity, even when somebody is given preference over us, and without disputing the delegation of powers to a man duly invested with them (Obedience shall be accorded to him in all circumstances) except when you have clear signs of his disbelief in (or disobedience to) God-signs that could be used as a conscientious justification (for non-compliance with his orders).