Skip to content

Impersonate / Switch User #1196

@maximecolin

Description

@maximecolin

Hi,

I'm trying to perform impersonation / switch user over JWT with LexikJWTAuthenticationBundle and it's not clear if the bundle supports it natively or not.

The official bundle documentation on Symfony website seems to indicate the bundle supports it, but there is no explanation about how to process except a link to the Symfony switch user documentation.

I found several issues about this, sometimes very old and outdated, but none comes with an actual working solution neither with a clear statement about switch user support of LexikJWTAuthenticationBundle.

My use case is quite the same as session/cookie based authentication. I'm authenticated as admin (I have a valid JWT) and I want to use it to get another JWT that authenticate me as the impersonated user and allowing me to get the previous user from the security token. Is that possible ? Or do I have to code my own stuff to handle that ? Does JWT can even do that ?

Thanks, any clues will be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions