Skip to content

Commit 344e7e7

Browse files
committed
[Security][WIP] Add authenticators info to the profiler
1 parent 91c14f2 commit 344e7e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Authentication/AuthenticatorManager.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public function supports(Request $request): ?bool
9999
}
100100

101101
$authenticators = [];
102+
$skippedAuthenticators = [];
102103
$lazy = true;
103104
foreach ($this->authenticators as $authenticator) {
104105
if (null !== $this->logger) {
@@ -108,8 +109,11 @@ public function supports(Request $request): ?bool
108109
if (false !== $supports = $authenticator->supports($request)) {
109110
$authenticators[] = $authenticator;
110111
$lazy = $lazy && null === $supports;
111-
} elseif (null !== $this->logger) {
112-
$this->logger->debug('Authenticator does not support the request.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
112+
} else {
113+
if (null !== $this->logger) {
114+
$this->logger->debug('Authenticator does not support the request.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
115+
}
116+
$skippedAuthenticators[] = $authenticator;
113117
}
114118
}
115119

@@ -118,6 +122,7 @@ public function supports(Request $request): ?bool
118122
}
119123

120124
$request->attributes->set('_security_authenticators', $authenticators);
125+
$request->attributes->set('_security_skipped_authenticators', $skippedAuthenticators);
121126

122127
return $lazy ? null : true;
123128
}
@@ -126,6 +131,8 @@ public function authenticateRequest(Request $request): ?Response
126131
{
127132
$authenticators = $request->attributes->get('_security_authenticators');
128133
$request->attributes->remove('_security_authenticators');
134+
$request->attributes->remove('_security_skipped_authenticators');
135+
129136
if (!$authenticators) {
130137
return null;
131138
}

0 commit comments

Comments
 (0)