Federal law gives the Secret Service the authority. As others noted, this came up at the Republican convention in 2016:
"Title 18 United States Code Sections 3056 and 1752 provides the Secret Service authority to preclude firearms from entering sites visited by our protectees, including those located in open-carry states," Secret Service spokesman Robert K. Hoback said in a statement. "Only authorized law enforcement personnel working in conjunction with the Secret Service for a particular event may carry a firearm inside of the protected site."
https://www.washingtonpost.com/news/the ... d37ba48074
1752 in part:
(B) of a building or grounds where the President or other person protected by the Secret Service is or will be temporarily visiting; or
(C) of a building or grounds so restricted in conjunction with an event designated as a special event of national significance; ...