Closed ElisDN closed 3 years ago
Thanks @ElisDN - this is a simple solution but does require overriding of existing functions. I think ideally, long term, I'd like something more deliberately baked into the package. There are a few other potential PRs which go further than this one so for that reason, I won't be proceeding with this at present.
Thank you for your efforts though and apologies I won't be merging this in at this time.
@Sephster neither this nor the other
@Sephster is there any PR finally considered to add custom claims support? It's so useful for SPA and actually discussing here for a couple of years. Thanks.
Definitely want to add this so not off the radar
Easy backward compatible way for parsing custom claims for #1120, #1122 and #1183 in the next 8.x release.
How to use it
For example, if you want to add a role field into JWT, just add
$role
property into your token entity and overrideconvertToJWT
method from trait for addingrole
claim:After all fetch user role and fill the property in token repository:
And now you can retreive
$request->getAttribute('oauth_custom_claims')
with value like['role' => 'admin']
.