CIA director resigns over extramarital affair