Under Just War Theory, the question of legitimacy is an institutional one. Was the question of going to war adequately vetted out through legitimate organs of the state? Posing the question peripherally, I would have to say yes, it was. The question of war was taken to the legislature, who voted on the matter, according to constitutional procedure.
However, we also have to question the information provided to decision makers on the prospects for war. Simply put, many deemed the war necessary because the Bush administration was touting its need in the face of an imminent threat. Turns out that Saddam's Iraq wasn't so much the threat that it was played up to be, and indeed, he was largely deterred by American military power by 2002. We've learned that much of the information used to justify this war was built on weak premises. Even worse, the rationalization for the war provided by Bush shifted with the political winds. It started out as a security matter, then they began to emphasize that this war was some broad neo-liberal democracy-building project. Of course, it is highly ironic that a Republican administration would pursue war for such ends, historically that's an aberration for the foreign policy promulgated by that party, one that probably shouldn't be repeated.
We should do more to promote democracy, but lets do it systematically and not arbitrarily. In this respect, the belief promoted by the neo-cons that one can mix Wilsonian idealism and realism to create a new paradigm is woefully wrong and highly subjective. In such a situation, security decisions are made with irrelevant criteria and decisions about things like human rights, which, if we follow the doctrine enshrined in the Declaration of Independence, becomes one that isn't necessarily universal in scope. So basically, what many claim to be a "Bush Doctrine" is nothing more than "foreign policy done on the fly." Mixing and matching different goals situationally. Under certain contexts, that is fine, but one shouldn't tout universal values and a big picture vision when there clearly is none.