SwitchUserListener

class SwitchUserListener implements ListenerInterface

SwitchUserListener allows a user to impersonate another one temporarily (like the Unix su command).

Constants

EXIT_VALUE

Methods

__construct(TokenStorageInterface $tokenStorage, UserProviderInterface $provider, UserCheckerInterface $userChecker, string $providerKey, AccessDecisionManagerInterface $accessDecisionManager, LoggerInterface $logger = null, string $usernameParameter = '_switch_user', string $role = 'ROLE_ALLOWED_TO_SWITCH', EventDispatcherInterface $dispatcher = null, bool $stateless = false)
handle(GetResponseEvent $event)

Handles the switch to another user.

Details

__construct(TokenStorageInterface $tokenStorage, UserProviderInterface $provider, UserCheckerInterface $userChecker, string $providerKey, AccessDecisionManagerInterface $accessDecisionManager, LoggerInterface $logger = null, string $usernameParameter = '_switch_user', string $role = 'ROLE_ALLOWED_TO_SWITCH', EventDispatcherInterface $dispatcher = null, bool $stateless = false)

Parameters

TokenStorageInterface $tokenStorage
UserProviderInterface $provider
UserCheckerInterface $userChecker
string $providerKey
AccessDecisionManagerInterface $accessDecisionManager
LoggerInterface $logger
string $usernameParameter
string $role
EventDispatcherInterface $dispatcher
bool $stateless

handle(GetResponseEvent $event)

Handles the switch to another user.

Parameters

GetResponseEvent $event

Exceptions

LogicException if switching to a user failed

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Security/Http/Firewall/SwitchUserListener.html