Sa'id bin al-Musayyib (may Allah have mercy on him) said: Sayyiduna Hassan bin Thabit (may Allah be pleased with him) was reciting poetry in the mosque. Sayyiduna Umar (may Allah be pleased with him) passed by him, looked at him sharply and said: In the mosque? Sayyiduna Hassan bin Thabit (may Allah be pleased with him) said: I used to recite poetry at a time when one better than you was present, meaning the Prophet (peace and blessings be upon him). The narrator said: He (Umar) feared that he would attribute the matter to the Prophet (peace and blessings be upon him), so Sayyiduna Umar (may Allah be pleased with him) allowed him and left him alone.
(b) Sayyiduna Hassan bin Thabit (may Allah be pleased with him) asked the people, among whom was Sayyiduna Abu Hurayrah (may Allah be pleased with him): I adjure you by Allah, did you hear the Messenger of Allah (peace and blessings be upon him) say: "Answer Quraysh on my behalf; may Allah support you with Jibril"?
(c) Imam al-Zuhri (may Allah have mercy on him) said: Reciting poetry the way Sayyiduna Hassan bin Thabit (may Allah be pleased with him) recited it in defence of Islam and the Muslims is permissible in the mosque and everywhere else.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4349