It shall be lawful for every court, body corporate, judge, magistrate, any commissioned officer of the United States Army, Navy or Marine Corps or other person, before whom it is or shall be incumbent for any person, elected or appointed to office, to take his official oath, to administer at the same time the oath of allegiance to such person, if he is or shall be required by law to take the same; provided, that when said official oath shall be taken before a commissioned officer there shall be a recital that he is such commissioned officer including a recital of his rank and official designation as such and that the person taking such oath is in the military or naval service of the United States.
N.J.S. § 41:2-5