A U.S. federal judge upheld an Obama-era rule designed to avoid conflicts of interests when brokers give retirement advice.