You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before upgrading, I was using a JWTProvider to allow a JWT Token to be "user less" (eg : a token to allow another system to call my API (eg : a JWT used by my WHMCS installation).
I was overriding the getUserFromPayload() function to return a user created by instancing a new User object.
As the JWTProvider has been deprecated in flavor of the JWTTokenAuthenticator class, I would like to do the same with this new class : extending the JWTTokenAuthenticator::getUser() method.
Before going any further (like creating a new PR), am I doing something wrong ? Is this private declaration wanted ?
If not, could we declare this property as protected instead of private ?
Best regards.
The text was updated successfully, but these errors were encountered:
Thank you for opening this issue.
You're right to discuss about before trying to solve it, I did not answer you before today because in fact we were about to merge a feature that should solve your problem and it needed to be finished, it is now.
In #278 we added a database-less user provider which creates user instances from JWTs payload. The user provider is not mandatory, any other provider can still be used instead, but you could be interested by the feature for your use case as we provide a JWTUserInterface and any class implementing this interface can be used with this user provider (the class needs a static createFromPayload($username, $payload): self to guarantee that we can instantiate it.
Even if you don't need the feature and keep creating your user instances by extending the authenticator, the PR will help you as we added a protected loadUser() method to the JWTTokenAuthenticator class, so you can just override it and return your custom user instance.
Anyway, you can already try it by upgrading the bundle to v2.1.0, hope you're all good with it.
Hi,
Before upgrading, I was using a JWTProvider to allow a JWT Token to be "user less" (eg : a token to allow another system to call my API (eg : a JWT used by my WHMCS installation).
I was overriding the
getUserFromPayload()
function to return a user created by instancing a new User object.As the JWTProvider has been deprecated in flavor of the JWTTokenAuthenticator class, I would like to do the same with this new class : extending the
JWTTokenAuthenticator::getUser()
method.I saw in the issue #277 ( https://github.com/lexik/LexikJWTAuthenticationBundle/issues/277#issuecomment-264116280 ) that I should use the following line to make my custom JWTTokenAuthenticator work : https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Security/Guard/JWTTokenAuthenticator.php#L153.
The problem is that the
$preAuthenticationTokenStorage
property is declared as private ( see : https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Security/Guard/JWTTokenAuthenticator.php#L60 ) and thus cannot be accessed by my custom authenticator class.Before going any further (like creating a new PR), am I doing something wrong ? Is this private declaration wanted ?
If not, could we declare this property as protected instead of private ?
Best regards.
The text was updated successfully, but these errors were encountered: