You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Authentication/AuthenticatorManager.php
+7-21Lines changed: 7 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -101,17 +101,13 @@ public function supports(Request $request): ?bool
101
101
$skippedAuthenticators = [];
102
102
$lazy = true;
103
103
foreach ($this->authenticatorsas$authenticator) {
104
-
if (null !== $this->logger) {
105
-
$this->logger->debug('Checking support on authenticator.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
106
-
}
104
+
$this->logger?->debug('Checking support on authenticator.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
107
105
108
106
if (false !== $supports = $authenticator->supports($request)) {
109
107
$authenticators[] = $authenticator;
110
108
$lazy = $lazy && null === $supports;
111
109
} else {
112
-
if (null !== $this->logger) {
113
-
$this->logger->debug('Authenticator does not support the request.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
114
-
}
110
+
$this->logger?->debug('Authenticator does not support the request.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]);
115
111
$skippedAuthenticators[] = $authenticator;
116
112
}
117
113
}
@@ -149,18 +145,14 @@ private function executeAuthenticators(array $authenticators, Request $request):
149
145
// eagerly (before token storage is initialized), whereas authenticate() is called
150
146
// lazily (after initialization).
151
147
if (false === $authenticator->supports($request)) {
152
-
if (null !== $this->logger) {
153
-
$this->logger->debug('Skipping the "{authenticator}" authenticator as it did not support the request.', ['authenticator' => \get_class($authenticator)]);
154
-
}
148
+
$this->logger?->debug('Skipping the "{authenticator}" authenticator as it did not support the request.', ['authenticator' => \get_class($authenticator)]);
$this->logger->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => \get_class($authenticator)]);
163
-
}
155
+
$this->logger?->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => \get_class($authenticator)]);
164
156
165
157
return$response;
166
158
}
@@ -208,9 +200,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
Copy file name to clipboardExpand all lines: Authenticator/AbstractPreAuthenticatedAuthenticator.php
+4-12Lines changed: 4 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -64,17 +64,13 @@ public function supports(Request $request): ?bool
64
64
} catch (BadCredentialsException$e) {
65
65
$this->clearToken($e);
66
66
67
-
if (null !== $this->logger) {
68
-
$this->logger->debug('Skipping pre-authenticated authenticator as a BadCredentialsException is thrown.', ['exception' => $e, 'authenticator' => static::class]);
69
-
}
67
+
$this->logger?->debug('Skipping pre-authenticated authenticator as a BadCredentialsException is thrown.', ['exception' => $e, 'authenticator' => static::class]);
70
68
71
69
returnfalse;
72
70
}
73
71
74
72
if (null === $username) {
75
-
if (null !== $this->logger) {
76
-
$this->logger->debug('Skipping pre-authenticated authenticator no username could be extracted.', ['authenticator' => static::class]);
77
-
}
73
+
$this->logger?->debug('Skipping pre-authenticated authenticator no username could be extracted.', ['authenticator' => static::class]);
78
74
79
75
returnfalse;
80
76
}
@@ -83,9 +79,7 @@ public function supports(Request $request): ?bool
$this->logger->debug('Remember me disabled; request does not contain remember me parameter ("{parameter}").', ['parameter' => $this->options['remember_me_parameter']]);
61
-
}
59
+
$this->logger?->debug('Remember me disabled; request does not contain remember me parameter ("{parameter}").', ['parameter' => $this->options['remember_me_parameter']]);
$this->logger->debug('Stored the security token in the session.', ['key' => $this->sessionKey]);
191
-
}
179
+
$this->logger?->debug('Stored the security token in the session.', ['key' => $this->sessionKey]);
192
180
}
193
181
194
182
if ($this->sessionTrackerEnabler && $session->getId() === $sessionId) {
@@ -227,9 +215,7 @@ protected function refreshUser(TokenInterface $token): ?TokenInterface
227
215
if ($tokeninstanceof AbstractToken && $this->hasUserChanged($user, $newToken)) {
228
216
$userDeauthenticated = true;
229
217
230
-
if (null !== $this->logger) {
231
-
$this->logger->debug('Cannot refresh token because user has changed.', ['username' => $refreshedUser->getUserIdentifier(), 'provider' => \get_class($provider)]);
232
-
}
218
+
$this->logger?->debug('Cannot refresh token because user has changed.', ['username' => $refreshedUser->getUserIdentifier(), 'provider' => \get_class($provider)]);
233
219
234
220
continue;
235
221
}
@@ -251,9 +237,7 @@ protected function refreshUser(TokenInterface $token): ?TokenInterface
251
237
} catch (UnsupportedUserException$e) {
252
238
// let's try the next user provider
253
239
} catch (UserNotFoundException$e) {
254
-
if (null !== $this->logger) {
255
-
$this->logger->warning('Username could not be found in the selected user provider.', ['username' => $e->getUserIdentifier(), 'provider' => \get_class($provider)]);
256
-
}
240
+
$this->logger?->warning('Username could not be found in the selected user provider.', ['username' => $e->getUserIdentifier(), 'provider' => \get_class($provider)]);
257
241
258
242
$userNotFoundByProvider = true;
259
243
}
@@ -288,9 +272,7 @@ private function safelyUnserialize(string $serializedToken)
288
272
if (0x37313BC !== $e->getCode()) {
289
273
throw$e;
290
274
}
291
-
if ($this->logger) {
292
-
$this->logger->warning('Failed to unserialize the security token from the session.', ['key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e]);
293
-
}
275
+
$this->logger?->warning('Failed to unserialize the security token from the session.', ['key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e]);
0 commit comments