Superconductivity on the threshold of magnetism in CePd2Si2 and CeIn3