As a lawyer, I go through courthouse security quite often. Given the number of incidents of violence in courtrooms, I don't mind it at all. Of course, courthouse security is conducted by LEOs, as opposed to TSOs. Accordingly, I find them professional, courteous, efficient and not overly intrusive. More to the point, they use common sense -- no bare-arm pat downs at courthouses.
As for the legality of courthouse searches, I have no idea -- I've never researched it. I don't imagine, however, wanting to not submit to a search to enter a courtroom is going to be regarded as credible grounds for failing to report for jury duty.