The Taft -- Hartley Act outlawed the closed shop in the United States in 1947. The union shop was ruled illegal by the Supreme Court. States that have passed right-to-work laws go further by not allowing employers to require employees to pay the agency fee. An employer may not lawfully agree with a union to hire only union members, but it may agree to require employees to join the union or pay the equivalent of union dues to it, within a set period after starting employment. Similarly, while a union could require an employer that had agreed to a closed shop contract prior to 1947 to fire an employee who had been expelled from the union for any reason, it can not demand that an employer fire an employee under a union shop contract for any reason other than failure to pay those dues that are uniformly required of all employees.

The federal law which made closed shops and preferential shops illegal was the? Okie... think carefully first, then make a decision:
To answer the question, consider the following: The Taft -- Hartley Act outlawed the closed shop in the United States in 1947. So, the answer is The Taft -- Hartley Act.