It is narrated from Abuzar that he heard the Messenger of Allah (ص) say to Ali (ع):
"O people! Test your children by means of Ali’s love, for Ali does not call towards misguidance and does not keep anyone aloof from guidance. The child who loves him is from you (born lawful) and the child who hates him is not from you (is illegitimate)"
Ibn Asaker, Tarikh Madinah-Damishq, V.42, page 288.
It is narrated from Mahbub ibn Abi al-Zannad that the Ansar used to say: “We understood the illegitimate born people by the enmity they showed to Ali ibn Abi Talib.” Ibn Asaker, Tarikh Madinah-Damishq, V.42, page 287-288.
And it is narrated from Shafi’i that he heard Malik ibn Anas say: "We had no measure to recognize the illegitimate children except by the hatred and enmity shown towards Ali ibn Abi Talib."Ibn Marduyeh Esfahani, Al-Manaqib, page 76.
And Anas says: After the Battle of Khaybar, it became a habit that a man would carry his child and stand in the way of Ali. Then, he would turn his face towards Ali and pointing his finger at him, would ask his child: "My child! Do you love this man? If the child said yes, he would hug and kiss him, and if he said, 'No,' he would place him on the ground and say, "Go join your mother." I don't want a child who doesn't love Ali.
Ibn Asaker, Tarikh Madinah-Damishq, V.42, page 288-289; Ibn Marduyeh Esfahani, Al-Manaqib, page 77.