diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
index 4fe1140eadfda..919fc5008e2d2 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
@@ -340,10 +340,12 @@
{{ profiler_dump(authenticator.stub) }} |
{{ source('@WebProfiler/Icon/' ~ (authenticator.supports ? 'yes' : 'no') ~ '.svg') }} |
- {{ authenticator.authenticated is not null ? source('@WebProfiler/Icon/' ~ (authenticator.authenticated ? 'yes' : 'no') ~ '.svg') : '' }} |
+ {{ authenticator.lazy is not null ? source('@WebProfiler/Icon/' ~ (authenticator.lazy ? 'yes' : 'no') ~ '.svg') }} |
+ {{ authenticator.authenticated is not null ? source('@WebProfiler/Icon/' ~ (authenticator.authenticated ? 'yes' : 'no') ~ '.svg') }} |
{{ authenticator.duration is null ? '(none)' : '%0.2f ms'|format(authenticator.duration * 1000) }} |
{{ authenticator.passport ? profiler_dump(authenticator.passport) : '(none)' }} |
@@ -373,6 +376,7 @@
(none)
{% endfor %}
|
+ {{ authenticator.exception ? profiler_dump(authenticator.exception) : '(none)' }} |
{% if loop.last %}
diff --git a/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php b/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php
index 34c3c62f68848..e3a8f3360aa2b 100644
--- a/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php
+++ b/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php
@@ -34,6 +34,8 @@ final class TraceableAuthenticator implements AuthenticatorInterface, Interactiv
private ?float $duration = null;
private ClassStub|string $stub;
private ?bool $authenticated = null;
+ private ?bool $lazy = null;
+ private ?AuthenticationException $exception = null;
public function __construct(private AuthenticatorInterface $authenticator)
{
@@ -56,12 +58,18 @@ static function (BadgeInterface $badge): array {
},
$this->passport?->getBadges() ?? [],
),
+ 'lazy' => $this->lazy,
+ 'exception' => $this->exception,
];
}
public function supports(Request $request): ?bool
{
- return $this->authenticator->supports($request);
+ $supports = $this->authenticator->supports($request);
+
+ $this->lazy = null === $supports;
+
+ return $supports;
}
public function authenticate(Request $request): Passport
@@ -88,6 +96,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
$this->authenticated = false;
+ $this->exception = $exception->getPrevious() instanceof AuthenticationException ? $exception->getPrevious() : $exception;
return $this->authenticator->onAuthenticationFailure($request, $exception);
}
diff --git a/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php b/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php
index 73ff7347cb58a..0aa40df184cf9 100644
--- a/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php
+++ b/src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php
@@ -55,6 +55,8 @@ public function authenticate(RequestEvent $event): void
'duration' => 0,
'authenticated' => null,
'badges' => [],
+ 'lazy' => null,
+ 'exception' => null,
];
}