Skip to content

Commit d6c3d7d

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Security] Add badge resolution to profiler [AssetMapper] Allow specifying packages to update with importmap:update [AssetMapper] Make importmap:install command download the same version Remove unneeded variable [PropertyInfo] Remove checking if AttributeMetadataInterface setIgnore method exist [VarDumper][FrameworkBundle] Remove checking if OutputFormatterStyle setHref method exist [HttpKernel][DebugBundle] Always call CliDumper setDisplayOptions method [DoctrineBridge][Messenger] Always use executeStatement [DoctrineBridge] Remove LazyGhost feature detection [Messenger] Fix PHPDoc template for `TransportFactoryInterface`
2 parents 0635b14 + 2f6e5c4 commit d6c3d7d

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Authenticator/Debug/TraceableAuthenticator.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1818
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
1919
use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface;
20+
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface;
2021
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2122
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
2223
use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException;
@@ -29,14 +30,13 @@
2930
*/
3031
final class TraceableAuthenticator implements AuthenticatorInterface, InteractiveAuthenticatorInterface, AuthenticationEntryPointInterface
3132
{
32-
private AuthenticatorInterface $authenticator;
3333
private ?Passport $passport = null;
3434
private ?float $duration = null;
3535
private ClassStub|string $stub;
36+
private ?bool $authenticated = null;
3637

37-
public function __construct(AuthenticatorInterface $authenticator)
38+
public function __construct(private AuthenticatorInterface $authenticator)
3839
{
39-
$this->authenticator = $authenticator;
4040
}
4141

4242
public function getInfo(): array
@@ -46,6 +46,16 @@ public function getInfo(): array
4646
'passport' => $this->passport,
4747
'duration' => $this->duration,
4848
'stub' => $this->stub ??= class_exists(ClassStub::class) ? new ClassStub($this->authenticator::class) : $this->authenticator::class,
49+
'authenticated' => $this->authenticated,
50+
'badges' => array_map(
51+
static function (BadgeInterface $badge): array {
52+
return [
53+
'stub' => class_exists(ClassStub::class) ? new ClassStub($badge::class) : $badge::class,
54+
'resolved' => $badge->isResolved(),
55+
];
56+
},
57+
$this->passport->getBadges(),
58+
),
4959
];
5060
}
5161

@@ -70,11 +80,15 @@ public function createToken(Passport $passport, string $firewallName): TokenInte
7080

7181
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
7282
{
83+
$this->authenticated = true;
84+
7385
return $this->authenticator->onAuthenticationSuccess($request, $token, $firewallName);
7486
}
7587

7688
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
7789
{
90+
$this->authenticated = false;
91+
7892
return $this->authenticator->onAuthenticationFailure($request, $exception);
7993
}
8094

Authenticator/Debug/TraceableAuthenticatorManagerListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public function authenticate(RequestEvent $event): void
5353
'stub' => $this->hasVardumper ? new ClassStub($skippedAuthenticator::class) : $skippedAuthenticator::class,
5454
'passport' => null,
5555
'duration' => 0,
56+
'authenticated' => null,
57+
'badges' => [],
5658
];
5759
}
5860

0 commit comments

Comments
 (0)