Does the person have to be willing in order for the sacrament of baptism to be legitimately conferred on a person?
Say for example, you knew a close relative who didnt believe in God and refused to to be baptized. One day that relative was in a car crash, and unconcious. You knew he would die in a matter of minutes. If I baptized him, even though he would be unwilling and is unconcious, would it be considered valid or would be effective in absolving his previously committed sins?
According to Canon Law, you could not baptize this person:
Can. 865 §1. For an adult to be baptized, the person must have manifested the intention to receive baptism, have been instructed sufficiently about the truths of the faith and Christian obligations, and have been tested in the Christian life through the catechumenate. The adult is also to be urged to have sorrow for personal sins.
§2. An adult in danger of death can be baptized if, having some knowledge of the principal truths of the faith, the person has manifested in any way at all the intention to receive baptism and promises to observe the commandments of the Christian religion.
Would he have received the Sacrament validly? Yes. legitimately or licitly ? No. Would his sins be forgiven? Original Sin, Yes. Actual personal sin? Maybe not, because this effect of Baptism might be blocked by his disposition to receive it. Only God would know.