Saw recently few topics asking about this, also saw a lot of wrong answers so ill try to help a little

1st thing to do is to imprint
non class specyfic aspect from codex (e.g. disobedience for armor pieces, aspect of elements for gloves) on an item while doing it,
make sure you're on a class that item is locked for.!Do not roll any stats before you imprint an aspect!Made few test recently trying to help one person asking, this works on any rare item, haven't tested legendaries.
Works also on items with class specyfic rolls e.g. overpower with 2h blunts on baba armor, whirlwind on gloves etc.
Works on any pair of gloves i've tested, even with stats rolled (i've put an aspect of elements).
Hope it helps, if anyone have any info about legendary items, i can update this post.