I get a working JWT token, but I want to add extra data to it:
{
"...": "...",
"sub": "myname",
"scopes": [
"messaging"
],
"my-own-added-key": "this is a neat custom value"
}
I've found Lcobucci\JWT\Builder::withClaim in the code which seems exactly what I need, but there is no way for my to apply it. For some reason everything is final, so I can't apply the Open/Closed principle anywhere. I'm not looking to rewrite half this tool, I just need a small hook to add a little data.
- The events that exists (
OAuth2Events) dont offer anything useful.
- Altering the build cant, its incorrectly
final anyway.
- cant create a custom AccessToken, the current one is incorrectly
final
- None of the managers are usefull
- None of the builds can be configured (and are incorrectly marked as
final)
- There is no way to alter an accesstoken to have something like
$customClaims which could be picked up in the AccessTokenTrait again.
- 'RelatedTo' must be a string. Using a simplified array here would solve a lot
Is there a reason this is so hard? I dont mind creating some code to implement this, but I'd like to know if that is worth my time.
I get a working JWT token, but I want to add extra data to it:
{ "...": "...", "sub": "myname", "scopes": [ "messaging" ], "my-own-added-key": "this is a neat custom value" }I've found
Lcobucci\JWT\Builder::withClaimin the code which seems exactly what I need, but there is no way for my to apply it. For some reason everything is final, so I can't apply the Open/Closed principle anywhere. I'm not looking to rewrite half this tool, I just need a small hook to add a little data.OAuth2Events) dont offer anything useful.finalanyway.finalfinal)$customClaimswhich could be picked up in the AccessTokenTrait again.Is there a reason this is so hard? I dont mind creating some code to implement this, but I'd like to know if that is worth my time.