protected function startAuthentication(Request $request, AuthenticationException $reason)
{
$this->context->setToken(null);
if (null === $this->authenticationEntryPoint) {
throw $reason;
}
if (null !== $this->logger) {
$this->logger->debug('Calling Authentication entry point');
}
$request->getSession()->set('_security.target_url', $request->getUri());
return $this->authenticationEntryPoint->start($request, $reason);
}