Skip to content

Commit 06e0b16

Browse files
committed
Remove deprecation
1 parent 987a1da commit 06e0b16

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Symfony/Component/Security/Http/Authenticator/AccessTokenAuthenticator.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
*/
3535
class AccessTokenAuthenticator implements AuthenticatorInterface
3636
{
37+
private ?TranslatorInterface $translator = null;
38+
3739
public function __construct(
3840
private readonly AccessTokenHandlerInterface $accessTokenHandler,
3941
private readonly AccessTokenExtractorInterface $accessTokenExtractor,
@@ -80,7 +82,11 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8082
return $this->failureHandler->onAuthenticationFailure($request, $exception);
8183
}
8284

83-
$errorMessage = strtr($exception->getMessageKey(), $exception->getMessageData());
85+
if (null !== $this->translator) {
86+
$errorMessage = $this->translator->trans($exception->getMessageKey(), $exception->getMessageData(), 'security');
87+
} else {
88+
$errorMessage = strtr($exception->getMessageKey(), $exception->getMessageData());
89+
}
8490

8591
return new Response(
8692
null,
@@ -91,7 +97,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
9197

9298
public function setTranslator(?TranslatorInterface $translator)
9399
{
94-
trigger_deprecation('symfony/security-http', '6.2', '"%s()" has no effect and will be removed in 7.0.', __METHOD__);
100+
$this->translator = $translator;
95101
}
96102

97103
/**

src/Symfony/Component/Security/Http/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ CHANGELOG
1111
* Add `$lifetime` parameter to `LoginLinkHandlerInterface::createLoginLink()`
1212
* Add RFC6750 Access Token support to allow token-based authentication
1313
* Allow using expressions as `#[IsGranted()]` attribute and subject
14-
* Deprecate `AccessTokenAuthenticator::setTranslator`, it has no effect and should not be called
1514

1615
6.0
1716
---

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy