Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[security] Provide authentification token when using an user checker #50650

Closed
@fabienlem

Description

@fabienlem

Description

Hi there,

When using a custom user checker, ie:

security:
    firewalls:
        api:
            user_checker: 'App\Security\UserChecker'

I would like to be able to get the authentication token. My use case is as follows: I want to make checks less stringent when an impersonation is in progress.

Injecting the Security service does not provide a solution.

use Symfony\Bundle\SecurityBundle\Security;

    public function checkPostAuth(UserInterface $user): void
    {
        $this->security->getToken(); // null
    }

I saw that in Symfony\Component\Security\Http\EventListener\UserCheckerListener the token could be provided as second parameter to the checkPostAuth method. So it could be posible to achieve some things like knowing if an impersonation is in progress.

What do you think about this proposal?

Kind regards,

Fabien

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions