This is a tough one.
Protesting the actions of a synagoge should be legal and protests are most effective outside the organisation itself. At the same time harassment based on identity needs to be prevented.
IMO that law should not exist. Anti-discrimination laws are enough of a tool that you don't need this sort of legislation.