SwitchUserListener

class SwitchUserListener implements ListenerInterface

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

Methods

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

Handles the switch to another user.

Details

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

Parameters

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

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/3.1/Symfony/Component/Security/Http/Firewall/SwitchUserListener.html