[NFR]: Add a method for creating custom claims to JWT token #15656
Labels
5.0
The issues we want to solve in the 5.0 release
new feature request
Planned Feature or New Feature Request
When generating a token in a JWT Phalcon, there is no way to add a custom claim, for example
["email" => "example@gmail.com, "username" => "phalconist" ]
.Phalcon Builder https://github.com/phalcon/cphalcon/blob/master/phalcon/Security/JWT/Builder.zep#L406 has a protected setClaim method, which other reserved methods use, such as
setIssuer(), setSubject
etc.I propose to introduce a public setCustom method:
which will allow you to create custom claims in the payload of the token, ex.:
Possible method names:
There is something , this is to make the protected setClaim method public, and then you can simply use it:
but there may be reasons not to do so :)
The text was updated successfully, but these errors were encountered: