The famous scholar al-Dhahabi says in Tadhkirat al-Huffaz, vol. 4, p. 298, and Ibn Hajar al-'Asqalani says in al-Durar al-Kaminah, vol. 1, p. 67 that Sadruddin Ibrahim bin Muhammad bin al-Hamawayh al-Juwayni al-Shafi'i was a great scholar of Hadith. The same Al-Juwayni reports from Abdullah ibn Abbas (r) from the Prophet (s) who said, "I am the chief of the Prophets and Ali ibn Abi Talib is the chief of successors, and after me my successors shall be twelve, the first of them being Ali ibn Abi Talib and the last of them being Al Mahdi."
Al-Juwayni also narrates from Ibn 'Abbas (r) from the Prophet (s): "Certainly my Caliphs and my legatees and the Proofs of Allah upon his creatures after me are twelve. The first of them is my brother and the last of them is my (grand) son." He was asked: "O Messenger of Allah, who is your brother?" He said, "Ali ibn Abi Talib" Then they asked, "And who is your son?" The Holy Prophet (s) replied, "Al Mahdi, the one who will fill the earth with justice and equity like it would be brimming with injustice and tyranny. And by the One Who has raised me as a warner and a give of good tidings, even if a day remains for the life of this world, the Almighty Allah will prolong this day to an extent till he sends my son Mahdi, then he will make Ruhullah 'Isa ibn Maryam (a) to descend and pray behind him (Mahdi). And the earth will be illuminated by his radiance. And his power will reach to the east and the west."
Al-Juwayni also narrates that the Messenger of Allah (s) informed: "I and Ali and Hasan and Husayn and nine of the descendants of Husayn are the purified ones and the inerrant."
Sunni reference: Al-Juwayni, Fara'id al-Simtayn, Mu'assassat al-Mahmudi li-Taba'ah, Beirut 1978, p. 160