How to include Authorization Extension data (groups/roles/permissions) into issued tokens?

Hello John,
Can you explain how you have extended a copy of the extension rule so that the groups/roles/permissions get’s added to the JWT?
I’m struggling with this for a few days now and I can’t get it to work. The documentation about this is very confusing, links pointing to a lot of other pages but not explaining what I really need.