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

Impersonate an user when using REMOTE_USER #18406

Closed
bertoost opened this issue Apr 1, 2016 · 6 comments
Closed

Impersonate an user when using REMOTE_USER #18406

bertoost opened this issue Apr 1, 2016 · 6 comments

Comments

@bertoost
Copy link

bertoost commented Apr 1, 2016

When switching user when you're using the REMOTE_USER setup, it will switch you back every time within a couple of seconds. It's not possible to swich user this way.

Tried to overwrite the security token etc. but that also ends in the same result.

The "impersonated" user does get an updated last login time (FOSUserBundle) in both situations, but the REMOTE_USER is still leading and I am still myself :-)

Anyone facing this issue?
Would be great to use Symfony's switch feature.

@stof
Copy link
Member

stof commented Apr 1, 2016

REMOTE_USER is meant to be a stateless auth model. The browser sends the auth with each request.
So when switching user, the next request is again authenticating with the original user, leading to the behavior you see.
The impersonation feature of Symfony requires that the authentication state is maintained server-side. For stateless auth systems where the client maintains this state, it cannot work, as you would have to impersonate client-side (which is where the state is)

@stof
Copy link
Member

stof commented Apr 1, 2016

I think this should be considered as a documentation issue, which should explain the limitations of the feature

@javiereguiluz
Copy link
Member

I agree with @stof. I've proposed adding a note about this in the docs: symfony/symfony-docs#6423

Therefore, I'm closing this issue as "fixed". Thanks!

@bertoost
Copy link
Author

bertoost commented Apr 1, 2016

Makes sense. I need to find another solution to fix this. It's important to impersonate in our REMOTE_USER based application :-)

@amylashley
Copy link

@bertoost did you ever find a solution? We're facing a similar issue.

@bertoost
Copy link
Author

Tried different things with sessions and listeners but no luck.. we disabled this admin feature in our application:-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants