Skip to content

Commit 0cecef5

Browse files
committed
Renaming
1 parent 66af8a6 commit 0cecef5

21 files changed

+88
-88
lines changed

UPGRADE-7.4.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ If you're upgrading from a version below 7.3, follow the [7.3 upgrade guide](UPG
1111
Security
1212
--------
1313

14-
* Add argument `$requestSupport` to `AuthenticatorInterface::supports()`;
14+
* Add argument `$requestDecision` to `AuthenticatorInterface::supports()`;
1515
it should be used to report the reason a request isn't supported. E.g:
1616

1717
```php
18-
public function supports(Request $request, ?RequestSupport $requestSupport = null): ?bool
18+
public function supports(Request $request, ?RequestDecision $requestDecision = null): ?bool
1919
{
20-
$requestSupport?->addReason('This authenticator does not support any request.');
20+
$requestDecision?->addReason('This authenticator does not support any request.');
2121

2222
return false;
2323
}

src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@
423423
<div id="authenticator-{{ i }}" class="font-normal">
424424
{% if authenticator.supports is same as(false) %}
425425
<div class="empty">
426-
{% for reason in (authenticator.supportReasons ?? []) is empty ? ['This authenticator did not support the request.'] : authenticator.supportReasons %}
426+
{% for reason in (authenticator.requestDecisionReasons ?? []) is empty ? ['This authenticator did not support the request.'] : authenticator.requestDecisionReasons %}
427427
<p>{{ reason }}</p>
428428
{% endfor %}
429429
</div>

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2929
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
3030
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
31-
use Symfony\Component\Security\Http\RequestSupport;
31+
use Symfony\Component\Security\Http\RequestDecision;
3232

3333
class RegisterEntryPointsPassTest extends TestCase
3434
{
@@ -72,7 +72,7 @@ public function testProcessResolvesChildDefinitionsClass()
7272

7373
class CustomAuthenticator extends AbstractAuthenticator implements AuthenticationEntryPointInterface
7474
{
75-
public function supports(Request $request, ?RequestSupport $requestSupport = null): ?bool
75+
public function supports(Request $request, ?RequestDecision $requestDecision = null): ?bool
7676
{
7777
return false;
7878
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
3939
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
4040
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
41-
use Symfony\Component\Security\Http\RequestSupport;
41+
use Symfony\Component\Security\Http\RequestDecision;
4242

4343
class SecurityExtensionTest extends TestCase
4444
{
@@ -960,7 +960,7 @@ protected function getContainer()
960960

961961
class TestAuthenticator implements AuthenticatorInterface
962962
{
963-
public function supports(Request $request, ?RequestSupport $requestSupport = null): ?bool
963+
public function supports(Request $request, ?RequestDecision $requestDecision = null): ?bool
964964
{
965965
}
966966

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/ApiAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
2323
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2424
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
25-
use Symfony\Component\Security\Http\RequestSupport;
25+
use Symfony\Component\Security\Http\RequestDecision;
2626

2727
class ApiAuthenticator extends AbstractAuthenticator
2828
{
@@ -33,7 +33,7 @@ public function __construct(bool $selfLoadingUser = false)
3333
$this->selfLoadingUser = $selfLoadingUser;
3434
}
3535

36-
public function supports(Request $request, ?RequestSupport $requestSupport = null): ?bool
36+
public function supports(Request $request, ?RequestDecision $requestDecision = null): ?bool
3737
{
3838
return $request->headers->has('X-USER-EMAIL');
3939
}

src/Symfony/Component/Ldap/Security/LdapAuthenticator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2121
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
2222
use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException;
23-
use Symfony\Component\Security\Http\RequestSupport;
23+
use Symfony\Component\Security\Http\RequestDecision;
2424

2525
/**
2626
* This class decorates internal authenticators to add the LDAP integration.
@@ -45,9 +45,9 @@ public function __construct(
4545
) {
4646
}
4747

48-
public function supports(Request $request, ?RequestSupport $requestSupport = null): ?bool
48+
public function supports(Request $request, ?RequestDecision $requestDecision = null): ?bool
4949
{
50-
return $this->authenticator->supports($request, $requestSupport);
50+
return $this->authenticator->supports($request, $requestDecision);
5151
}
5252

5353
public function authenticate(Request $request): Passport

src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
3434
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
3535
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
36-
use Symfony\Component\Security\Http\RequestSupport;
36+
use Symfony\Component\Security\Http\RequestDecision;
3737
use Symfony\Contracts\Service\ServiceLocatorTrait;
3838

3939
class CheckLdapCredentialsListenerTest extends TestCase
@@ -207,7 +207,7 @@ private function createListener()
207207
if (interface_exists(AuthenticatorInterface::class)) {
208208
class TestAuthenticator implements AuthenticatorInterface
209209
{
210-
public function supports(Request $request, ?RequestSupport $requestSupport = null): ?bool
210+
public function supports(Request $request, ?RequestDecision $requestDecision = null): ?bool
211211
{
212212
}
213213

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1818
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
19-
use Symfony\Component\Security\Http\RequestSupport;
19+
use Symfony\Component\Security\Http\RequestDecision;
2020
use Symfony\Component\Security\Http\SecurityRequestAttributes;
2121

2222
/**
@@ -36,22 +36,22 @@ abstract protected function getLoginUrl(Request $request): string;
3636
* matched in order to handle the login form submit.
3737
*
3838
* This default implementation handles all POST requests to the
39-
* login path (@see getLoginUrl()).
39+
* login path (@param RequestDecision|null $requestDecision
40+
* @see getLoginUrl()).
4041
*
41-
* @param RequestSupport|null $requestSupport
4242
*/
43-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): bool
43+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): bool
4444
{
45-
$requestSupport = 2 <= \func_num_args() ? func_get_arg(1) : null;
45+
$requestDecision = 2 <= \func_num_args() ? func_get_arg(1) : null;
4646

4747
if (!$request->isMethod('POST')) {
48-
$requestSupport?->addReason('Request is not a POST.');
48+
$requestDecision?->addReason('Request is not a POST.');
4949

5050
return false;
5151
}
5252

5353
if ($this->getLoginUrl($request) !== $request->getBaseUrl().$request->getPathInfo()) {
54-
$requestSupport?->addReason('Request does not match the login URL.');
54+
$requestDecision?->addReason('Request does not match the login URL.');
5555

5656
return false;
5757
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
2525
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2626
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
27-
use Symfony\Component\Security\Http\RequestSupport;
27+
use Symfony\Component\Security\Http\RequestDecision;
2828

2929
/**
3030
* The base authenticator for authenticators to use pre-authenticated
@@ -54,26 +54,26 @@ public function __construct(
5454
abstract protected function extractUsername(Request $request): ?string;
5555

5656
/**
57-
* @param RequestSupport|null $requestSupport
57+
* @param RequestDecision|null $requestDecision
5858
*/
59-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): ?bool
59+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): ?bool
6060
{
61-
$requestSupport = 2 <= \func_num_args() ? func_get_arg(1) : null;
61+
$requestDecision = 2 <= \func_num_args() ? func_get_arg(1) : null;
6262

6363
try {
6464
$username = $this->extractUsername($request);
6565
} catch (BadCredentialsException $e) {
6666
$this->clearToken($e);
6767

6868
$this->logger?->debug('Skipping pre-authenticated authenticator as a BadCredentialsException is thrown.', ['exception' => $e, 'authenticator' => static::class]);
69-
$requestSupport?->addReason('Could not find the username in the request.');
69+
$requestDecision?->addReason('Could not find the username in the request.');
7070

7171
return false;
7272
}
7373

7474
if (null === $username) {
7575
$this->logger?->debug('Skipping pre-authenticated authenticator no username could be extracted.', ['authenticator' => static::class]);
76-
$requestSupport?->addReason('Username found in the request was empty.');
76+
$requestDecision?->addReason('Username found in the request was empty.');
7777

7878
return false;
7979
}
@@ -83,7 +83,7 @@ public function supports(Request $request, /* ?RequestSupport $requestSupport =
8383

8484
if ($token instanceof PreAuthenticatedToken && $this->firewallName === $token->getFirewallName() && $token->getUserIdentifier() === $username) {
8585
$this->logger?->debug('Skipping pre-authenticated authenticator as the user already has an existing session.', ['authenticator' => static::class]);
86-
$requestSupport?->addReason('A token already exists for the user in the session.');
86+
$requestDecision?->addReason('A token already exists for the user in the session.');
8787

8888
return false;
8989
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2525
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
2626
use Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken;
27-
use Symfony\Component\Security\Http\RequestSupport;
27+
use Symfony\Component\Security\Http\RequestDecision;
2828
use Symfony\Contracts\Translation\TranslatorInterface;
2929

3030
/**
@@ -48,14 +48,14 @@ public function __construct(
4848
}
4949

5050
/**
51-
* @param RequestSupport|null $requestSupport
51+
* @param RequestDecision|null $requestDecision
5252
*/
53-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): ?bool
53+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): ?bool
5454
{
55-
$requestSupport = 2 <= \func_num_args() ? func_get_arg(1) : null;
55+
$requestDecision = 2 <= \func_num_args() ? func_get_arg(1) : null;
5656

5757
if (null === $this->accessTokenExtractor->extractAccessToken($request)) {
58-
$requestSupport?->addReason(sprintf('No token was found in the request by the %s.', $this->accessTokenExtractor::class));
58+
$requestDecision?->addReason(sprintf('No token was found in the request by the %s.', $this->accessTokenExtractor::class));
5959

6060
return false;
6161
}

0 commit comments

Comments
 (0)