Toyotomi Hideyoshi, who unified Japan in 1590, and Tokugawa Ieyasu, who founded the Tokugawa Shogunate in 1603, were loyal followers of Oda Nobunaga. These two were gifted with Nobunaga's previous achievements on which they could build a unified Japan. There was a saying: "Nobunaga pounds the national rice cake, Hideyoshi kneads it, and in the end Ieyasu sits down and eats it."
Hideyoshi was brought up from a nameless peasant to be one of Nobunaga's top generals. When he became a grand minister in 1586, he created a law that the samurai caste became codified as permanent and heritable, and that non-samurai were forbidden to carry weapons, thereby ending the social mobility of Japan from which he himself had benefited. He was even said to divert rivers to flood enemy villages and clans. These restrictions lasted until the dissolution of the Edo Shogunate by the Meiji Restoration revolutionaries. Hideyoshi secured his claim as the rightful successor of Nobunaga by defeating Akechi Mitsuhide within a month of Nobunaga's death.
It is important to note that the distinction between samurai and non-samurai was so obscure that during the 16th century, most male adults in any social class (even small farmers) belonged to at least one military organization of their own and served in wars before and during Hideyoshi's rule. It can be said that an "all against all" situation continued for a century. The authorized samurai families after the 17th century were those that chose to follow Nobunaga, Hideyoshi and Ieyasu. Large battles occurred during the change between regimes and a number of defeated samurai were destroyed, became ronin or were absorbed into the general populace.
Ieyasu had shared his childhood with Nobunaga as a hostage of the Oda clan. Though there were a number of battles between Ieyasu and the Oda clan, Ieyasu eventually switched sides and became one of Nobunaga's strongest allies.