Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_identity_field can't be integer with Badge System #935

Closed
ComteZeroVD opened this issue Oct 11, 2021 · 3 comments
Closed

user_identity_field can't be integer with Badge System #935

ComteZeroVD opened this issue Oct 11, 2021 · 3 comments

Comments

@ComteZeroVD
Copy link

Hi !

I was following the guide for database-less user provider and needed to define an IRI.
I wanted to define the attribute "id" (which is an integer) from my class User as the user_identity_field.
Looks like it leads to an error in
Security/Authenticator/JWTAuthenticator.php line 113

$passport = new SelfValidatingPassport(
            new UserBadge($payload[$idClaim],
            function ($userIdentifier) use($payload) {
                return $this->loadUser($payload, $userIdentifier);
            })
        );

and more particulary this line

new UserBadge($payload[$idClaim],

because the constructor of UserBadge require a string.

@fd6130
Copy link

fd6130 commented Oct 11, 2021

For temporarily solution, you can use custom authenticator and cast your id to string in UserBadge.

https://github.com/lexik/LexikJWTAuthenticationBundle/blob/2.x/Resources/doc/6-extending-jwt-authenticator.md

@NotionCommotion
Copy link

NotionCommotion commented Nov 10, 2021

Hi, Wish I read your post before figuring out the same on trial and error. It doesn't seem to be really a JWTAuthenticatorBundle issue but a Symfony issue. Thanks!

#376 (comment)

@fd6130
Copy link

fd6130 commented Jan 27, 2022

Related with #976 .

@chalasr chalasr closed this as completed Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants