Are there European laws that prohibit discriminating against people who live in Iran? Or that prohibit discriminating against companies who employ people who live in Iran? If not, the legal basis is that you can do anything you want unless it's prohibited by law, and the action in question isn't prohibited by law.