ExceptionListener
in package
Uses
TargetPathTrait
ExceptionListener catches authentication exception and converts them to Response instances.
Tags
Table of Contents
- $accessDeniedHandler : mixed
- $authenticationEntryPoint : mixed
- $authenticationTrustResolver : mixed
- $errorPage : mixed
- $httpUtils : mixed
- $logger : mixed
- $providerKey : mixed
- $stateless : mixed
- $tokenStorage : mixed
- __construct() : mixed
- onKernelException() : mixed
- Handles security related exceptions.
- register() : mixed
- Registers a onKernelException listener to take care of security exceptions.
- unregister() : mixed
- Unregisters the dispatcher.
- setTargetPath() : mixed
- getTargetPath() : string|null
- Returns the URL (if any) the user visited that forced them to login.
- handleAccessDeniedException() : mixed
- handleAuthenticationException() : void
- handleLogoutException() : void
- removeTargetPath() : mixed
- Removes the target path from the session.
- saveTargetPath() : mixed
- Sets the target path the user should be redirected to after authentication.
- startAuthentication() : Response
Properties
$accessDeniedHandler
private
mixed
$accessDeniedHandler
$authenticationEntryPoint
private
mixed
$authenticationEntryPoint
$authenticationTrustResolver
private
mixed
$authenticationTrustResolver
$errorPage
private
mixed
$errorPage
$httpUtils
private
mixed
$httpUtils
$logger
private
mixed
$logger
$providerKey
private
mixed
$providerKey
$stateless
private
mixed
$stateless
$tokenStorage
private
mixed
$tokenStorage
Methods
__construct()
public
__construct(TokenStorageInterface $tokenStorage, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, string $providerKey[, AuthenticationEntryPointInterface $authenticationEntryPoint = null ][, string $errorPage = null ][, AccessDeniedHandlerInterface $accessDeniedHandler = null ][, LoggerInterface $logger = null ][, bool $stateless = false ]) : mixed
Parameters
- $tokenStorage : TokenStorageInterface
- $trustResolver : AuthenticationTrustResolverInterface
- $httpUtils : HttpUtils
- $providerKey : string
- $authenticationEntryPoint : AuthenticationEntryPointInterface = null
- $errorPage : string = null
- $accessDeniedHandler : AccessDeniedHandlerInterface = null
- $logger : LoggerInterface = null
- $stateless : bool = false
Return values
mixed —onKernelException()
Handles security related exceptions.
public
onKernelException(GetResponseForExceptionEvent $event) : mixed
Parameters
- $event : GetResponseForExceptionEvent
Return values
mixed —register()
Registers a onKernelException listener to take care of security exceptions.
public
register(EventDispatcherInterface $dispatcher) : mixed
Parameters
- $dispatcher : EventDispatcherInterface
Return values
mixed —unregister()
Unregisters the dispatcher.
public
unregister(EventDispatcherInterface $dispatcher) : mixed
Parameters
- $dispatcher : EventDispatcherInterface
Return values
mixed —setTargetPath()
protected
setTargetPath(Request $request) : mixed
Parameters
- $request : Request
Return values
mixed —getTargetPath()
Returns the URL (if any) the user visited that forced them to login.
private
getTargetPath(SessionInterface $session, string $providerKey) : string|null
Parameters
- $session : SessionInterface
- $providerKey : string
Return values
string|null —handleAccessDeniedException()
private
handleAccessDeniedException(GetResponseForExceptionEvent $event, AccessDeniedException $exception) : mixed
Parameters
- $event : GetResponseForExceptionEvent
- $exception : AccessDeniedException
Return values
mixed —handleAuthenticationException()
private
handleAuthenticationException(GetResponseForExceptionEvent $event, AuthenticationException $exception) : void
Parameters
- $event : GetResponseForExceptionEvent
- $exception : AuthenticationException
Return values
void —handleLogoutException()
private
handleLogoutException(GetResponseForExceptionEvent $event, LogoutException $exception) : void
Parameters
- $event : GetResponseForExceptionEvent
- $exception : LogoutException
Return values
void —removeTargetPath()
Removes the target path from the session.
private
removeTargetPath(SessionInterface $session, string $providerKey) : mixed
Parameters
- $session : SessionInterface
- $providerKey : string
Return values
mixed —saveTargetPath()
Sets the target path the user should be redirected to after authentication.
private
saveTargetPath(SessionInterface $session, string $providerKey, string $uri) : mixed
Usually, you do not need to set this directly.
Parameters
- $session : SessionInterface
- $providerKey : string
- $uri : string
Return values
mixed —startAuthentication()
private
startAuthentication(Request $request, AuthenticationException $authException) : Response
Parameters
- $request : Request
- $authException : AuthenticationException