A man is under arrest after apparently posing as an immigration officer before attempting to rape a woman in Brooklyn.