§1. For an infant to be baptized licitly: 1/ the parents or at least one of them or the person who legitimately takes their place must consent; 2/ spes habeatur fundata eum in religione catholica educatum iri, firma §3; quae si prorsus deficiat, baptismus secundum praescripta iuris particularis differatur, monitis de ratione parentibus.
§2. An infant of Catholic parents or even of non-Catholic parents is baptized licitly in danger of death even against the will of the parents.
Source: Code of Canon Law (Vatican.va)