Any court of judicature or any commissioned officer of the United Army, Navy or Marine Corps shall administer the oath of allegiance to such person as shall be by law required to take the same in such court; provided, that when said oath of allegiance 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-4