thephpleague / oauth2-server

A spec compliant, secure by default PHP OAuth 2.0 Server
https://oauth2.thephpleague.com
MIT License
6.49k stars 1.12k forks source link

Split the `AccessTokenTrait::convertToJWT()` function so that the token can be customized #1382

Closed rhertogh closed 8 months ago

rhertogh commented 8 months ago

Split the \League\OAuth2\Server\Entities\Traits\AccessTokenTrait::convertToJWT() function into two separate functions so that implementing classes can customize the token. E.g.

class AccessToken implements AccessTokenEntityInterface
{
// ...
    use AccessTokenTrait {
        getJwtBuilder as traitGetJwtBuilder;
    }
// ...
    private function getJwtBuilder()
    {
        $builder = $this->traitGetJwtBuilder();

        $builder->withClaim('my_custom_claim', 'custom claim value');

        return $builder;
    }
parallels999 commented 8 months ago

1328

rhertogh commented 8 months ago

Closed in favor of #1328

parallels999 commented 8 months ago

Also, leave your comment on that PR, so the authors review it at least