How to deal with supervisor who required me to share all my work with him?
I think you must give your supervisor all your "code, figure files, data, etc" pertaining all paper you have published together, as your supervisor is a co-author of your publications. Co-authors should have access to all relevant material behind published research under their responsibility, particularly corresponding authors. 

And preferentially when you do so, share all of that in at least one data repository such as FigShare or Dryad, linking the raw material to their pertaining papers. If you have published research, make it public, so that everyone can benefit from your work. Scientific research equates with reproducible research, which heavily depends on transparency.

I believe you have an issue with having included your supervisor and perhaps some others as honorary/gift authors to work which was solely done by yourself. You should have objected to doing that before. Running away with important background scientific data will not send the right message nor mend this flaw.