-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Guard] Adding cutom role to the security token breaks authentication #36603
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
Comments
Yes. I think so. Or this is a super wild guess. Try debugging My guess is that when you try to authenticate, it will see that the user has changed, ie the roles on your UserInterface entity does not match the roles on the token, and that is why you are unauthenticated. |
Thnaks a lot @Nyholm ! You're right. Method Only an extra |
Maybe using a |
There are a If you doing cross-kernel, then it feels like you need some SSO provider. Ie a third party that helps you authenticate. But sure, if everything is in the same code base, then you can probably hack your way around somehow. Im not sure what the best way to move forward is though. Since this is not a symfony bug, could we close this issue and I'll ask you to find support on Slack or StackOverflow? (See https://symfony.com/support). |
Related #35944
El dom., 3 may. 2020 18:42, Nicolas Grekas <notifications@github.com>
escribió:
… Closed #36603 <#36603>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#36603 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC6YWEYH77CFHB2TIVD7ATRPWNFXANCNFSM4MSHZQRQ>
.
|
Cross-kernel is for extra reason and is not the minimal switch_user feature breaker. Impersonating a user into a different firewall (and different firewall context) is not working with Symfony My switch user implementation works but I cannot add an additional role (like ROLE_PREVIOUS_ADMIN). I've pushed a PR in case it seems interesting to the community. |
Symfony version(s) affected: 4.4
Description
I'm following Custom Authentication System with Guard to implement my own "switch user" feature (across different firewalls). Instead of extending
AbstractGuardAuthenticator
as described in the documentation, I use my own implementation ofcreateAuthenticatedToken(UserInterface $user, $providerKey)
method.My goal is just to add a custom role in the generated
PostAuthenticationGuardToken
.Adding the role in the code above breaks authentication. Adding the roles in the
UserInterface::getRoles()
method is OK...Any idea of what is happening here ?
The text was updated successfully, but these errors were encountered: