Sahih al-Bukhari 7055, 7056
Narrated Junada bin Abi Umaiya:
We entered upon 'Ubada bin As-Samit while he was sick. We said, "May Allah make you healthy. 
Will you tell us a Hadith you heard from the Prophet (ﷺ) and by which Allah may make you benefit?" He 
said, "The Prophet (ﷺ) called us and we gave him the Pledge of allegiance for Islam, and among the 
conditions on which he took the Pledge from us, was that we were to listen and obey (the orders) both 
at the time when we were active and at the time when we were tired, and at our difficult time and at 
our ease and to be obedient to the ruler and give him his right even if he did not give us our right, and 
not to fight against him unless we noticed him having open Kufr (disbelief) for which we would have 
a proof with us from Allah."
حَدَّثَنَا إِسْمَاعِيلُ، حَدَّثَنِي ابْنُ وَهْبٍ، عَنْ عَمْرٍو، عَنْ بُكَيْرٍ، عَنْ بُسْرِ بْنِ سَعِيدٍ، عَنْ جُنَادَةَ بْنِ أَبِي أُمَيَّةَ، قَالَ دَخَلْنَا عَلَى عُبَادَةَ بْنِ الصَّامِتِ وَهْوَ مَرِيضٌ قُلْنَا أَصْلَحَكَ اللَّهُ حَدِّثْ بِحَدِيثٍ، يَنْفَعُكَ اللَّهُ بِهِ سَمِعْتَهُ مِنَ النَّبِيِّ، صلى الله عليه وسلم‏.‏ قَالَ دَعَانَا النَّبِيُّ صلى الله عليه وسلم فَبَايَعْنَاهُ فَقَالَ فِيمَا أَخَذَ عَلَيْنَا أَنْ بَايَعَنَا عَلَى السَّمْعِ وَالطَّاعَةِ، فِي مَنْشَطِنَا وَمَكْرَهِنَا، وَعُسْرِنَا، وَيُسْرِنَا، وَأَثَرَةٍ عَلَيْنَا، وَأَنْ لاَ نُنَازِعَ الأَمْرَ أَهْلَهُ، إِلاَّ أَنْ تَرَوْا كُفْرًا بَوَاحًا، عِنْدَكُمْ مِنَ اللَّهِ فِيهِ بُرْهَانٌ‏.‏