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
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1717
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1818
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
19-
use Symfony\Component\Security\Http\RequestSupport;
19+
use Symfony\Component\Security\Http\RequestDecision;
2020

2121
/**
2222
* The interface for all authenticators.
@@ -34,9 +34,9 @@ interface AuthenticatorInterface
3434
*
3535
* Returning null means authenticate() can be called lazily when accessing the token storage.
3636
*
37-
* @param RequestSupport|null $requestSupport
37+
* @param RequestDecision|null $requestDecision
3838
*/
39-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): ?bool;
39+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): ?bool;
4040

4141
/**
4242
* Create a passport for the current request.

src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2222
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
2323
use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException;
24-
use Symfony\Component\Security\Http\RequestSupport;
24+
use Symfony\Component\Security\Http\RequestDecision;
2525
use Symfony\Component\VarDumper\Caster\ClassStub;
2626

2727
/**
@@ -32,7 +32,7 @@
3232
final class TraceableAuthenticator implements AuthenticatorInterface, InteractiveAuthenticatorInterface, AuthenticationEntryPointInterface
3333
{
3434
private ?bool $supports = false;
35-
private array $supportReasons = [];
35+
private array $requestDecisionReasons = [];
3636
private ?Passport $passport = null;
3737
private ?float $duration = null;
3838
private ClassStub|string $stub;
@@ -47,7 +47,7 @@ public function getInfo(): array
4747
{
4848
return [
4949
'supports' => $this->supports,
50-
'supportReasons' => $this->supportReasons,
50+
'requestDecisionReasons' => $this->requestDecisionReasons,
5151
'passport' => $this->passport,
5252
'duration' => $this->duration,
5353
'stub' => $this->stub ??= class_exists(ClassStub::class) ? new ClassStub($this->authenticator::class) : $this->authenticator::class,
@@ -66,20 +66,20 @@ static function (BadgeInterface $badge): array {
6666
}
6767

6868
/**
69-
* @param RequestSupport|null $requestSupport
69+
* @param RequestDecision|null $requestDecision
7070
*/
71-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): ?bool
71+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): ?bool
7272
{
73-
$requestSupport = 2 <= \func_num_args() ? func_get_arg(1) : new RequestSupport();
73+
$requestDecision = 2 <= \func_num_args() ? func_get_arg(1) : new RequestDecision();
7474

75-
$this->supports = $this->authenticator->supports($request, $requestSupport);
76-
$this->supportReasons = $requestSupport->reasons;
75+
$this->supports = $this->authenticator->supports($request, $requestDecision);
76+
$this->requestDecisionReasons = $requestDecision->reasons;
7777

7878
if ($this->supports === false) {
79-
$requestSupport->result = false;
79+
$requestDecision->support = false;
8080
} else {
81-
$requestSupport->result = true;
82-
$requestSupport->lazy = null === $this->supports;
81+
$requestDecision->support = true;
82+
$requestDecision->lazy = null === $this->supports;
8383
}
8484

8585
return $this->supports;

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
3232
use Symfony\Component\Security\Http\HttpUtils;
3333
use Symfony\Component\Security\Http\ParameterBagUtils;
34-
use Symfony\Component\Security\Http\RequestSupport;
34+
use Symfony\Component\Security\Http\RequestDecision;
3535
use Symfony\Component\Security\Http\SecurityRequestAttributes;
3636

3737
/**
@@ -70,26 +70,26 @@ protected function getLoginUrl(Request $request): string
7070
}
7171

7272
/**
73-
* @param RequestSupport|null $requestSupport
73+
* @param RequestDecision|null $requestDecision
7474
*/
75-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): bool
75+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): bool
7676
{
77-
$requestSupport = 2 <= \func_num_args() ? func_get_arg(1) : null;
77+
$requestDecision = 2 <= \func_num_args() ? func_get_arg(1) : null;
7878

7979
if ($this->options['post_only'] && !$request->isMethod('POST')) {
80-
$requestSupport?->addReason('Request is not a POST while "post_only" is set.');
80+
$requestDecision?->addReason('Request is not a POST while "post_only" is set.');
8181

8282
return false;
8383
}
8484

8585
if (!$this->httpUtils->checkRequestPath($request, $this->options['check_path'])) {
86-
$requestSupport?->addReason('Request does not match the "check_path".');
86+
$requestDecision?->addReason('Request does not match the "check_path".');
8787

8888
return false;
8989
}
9090

9191
if ($this->options['form_only'] && 'form' !== $request->getContentTypeFormat()) {
92-
$requestSupport?->addReason('Request is not a form submission while "form_only" is set.');
92+
$requestDecision?->addReason('Request is not a form submission while "form_only" is set.');
9393

9494
return false;
9595
}

src/Symfony/Component/Security/Http/Authenticator/HttpBasicAuthenticator.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\Credentials\PasswordCredentials;
2525
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2626
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
27-
use Symfony\Component\Security\Http\RequestSupport;
27+
use Symfony\Component\Security\Http\RequestDecision;
2828

2929
/**
3030
* @author Wouter de Jong <wouter@wouterj.nl>
@@ -51,14 +51,14 @@ public function start(Request $request, ?AuthenticationException $authException
5151
}
5252

5353
/**
54-
* @param RequestSupport|null $requestSupport
54+
* @param RequestDecision|null $requestDecision
5555
*/
56-
public function supports(Request $request, /* ?RequestSupport $requestSupport = null */): ?bool
56+
public function supports(Request $request, /* ?RequestDecision $requestDecision = null */): ?bool
5757
{
58-
$requestSupport = 2 <= \func_num_args() ? func_get_arg(1) : null;
58+
$requestDecision = 2 <= \func_num_args() ? func_get_arg(1) : null;
5959

6060
if (!$request->headers->has('PHP_AUTH_USER')) {
61-
$requestSupport?->addReason('Request has no basic authentication header.');
61+
$requestDecision?->addReason('Request has no basic authentication header.');
6262

6363
return false;
6464
}

0 commit comments

Comments
 (0)