All states have the legal right to challenge the constitutionality of all federal laws or orders.  That is what California is doing.  They have an obligation to do this if they believe the federal government is acting against the constitution. It's the only way a madman like Trump can be contained.