Neither the White House nor the Department of Defense (DoD) has offered a legal justification for the killing of general Soleimani. That is probably because it is difficult to find one.
If there is a war (armed conflict) between the US and Iran, then Soleimani, as a general, is surely a legitimate target. However, there is no such war.
There is, perhaps, a civil war (a non-international armed conflict) in Iraq, in which the US is supporting the Iraqi government. (My impression is, though, that the still ongoing violence in Iraq does not reach the level of civil war.) If so, the US has to act under the authority of the Iraqi government, which invited them. It is not at all clear that the killing is within the bounds of what the Iraqi government has approved. The Iraqi prime minister Abdul-Mahdi has condemned the earlier US attack on a Shia militia on 29 December.
Another potential justification is that the US is at war with the Islamic Revolutionary Guard Corps (IRGC), headed by Soleimani, which the US declared to be a terrorist organisation in 2019. However, the US has not declared itself to be at war with all terrorist organisations, but only with those affiliated with al-Qaeda, and this certainly does not apply to the IRGC. Läs artikel