Ubadah bin al-Walid bin Ubadah bin al-Samit narrates from his father (Sayyiduna Ubadah bin al-Samit, may Allah be pleased with him) that we pledged allegiance to the Messenger of Allah (peace and blessings be upon him): "To hear and obey, in hardship and in ease, in times of eagerness and of reluctance, and when preference is given, that is, when others are preferred over us; and that we will not wrest authority from those who hold it; and that we will speak the truth and not fear, in the matter of Allah, the blame of any blamer."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20592