I think you just use a suitable epoxy. My understanding is you need to ensure that galvanic corrosion does not occur. Someone recently told me that epoxy is a good enough insulator, but some of the things I've seen at the bike shop make me wonder if that's true.