if (\
is_string($failureUrl) && (str_starts_with($failureUrl, '/'
) ||
str_starts_with($failureUrl, 'http'
))) { $options['failure_path'
] =
$failureUrl;
} elseif ($this->logger &&
$failureUrl) { $this->logger->
debug(sprintf('Ignoring query parameter "%s": not a valid URL.',
$options['failure_path_parameter'
]));
} $options['failure_path'
] ??=
$options['login_path'
];
if ($options['failure_forward'
]) { $this->logger?->
debug('Authentication failure, forward triggered.',
['failure_path' =>
$options['failure_path'
]]);
$subRequest =
$this->httpUtils->
createRequest($request,
$options['failure_path'
]);
$subRequest->attributes->
set(SecurityRequestAttributes::AUTHENTICATION_ERROR,
$exception);
return $this->httpKernel->
handle($subRequest, HttpKernelInterface::SUB_REQUEST
);
} $this->logger?->
debug('Authentication failure, redirect triggered.',
['failure_path' =>
$options['failure_path'
]]);
if (!
$request->attributes->
getBoolean('_stateless'
)) { $request->
getSession()->
set(SecurityRequestAttributes::AUTHENTICATION_ERROR,
$exception);
}