8000 [Security] Improve profiler’s panel by MatTheCat · Pull Request #1 · MatTheCat/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Improve profiler’s panel #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Get up-to-date informations from lazy listeners
  • Loading branch information
MatTheCat committed Jun 17, 2024
commit d8f4d5d2a81c4617d4c737df28e1b15ee42d80f7
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ final class TraceableFirewallListener extends FirewallListener implements ResetI

public function getWrappedListeners(): array
{
return $this->wrappedListeners;
return array_map(
static fn (WrappedListener|WrappedLazyListener $listener) => $listener->getInfo(),
$this->wrappedListeners
);
}

public function getAuthenticatorsInfo(): array
Expand All @@ -48,12 +51,11 @@ public function reset(): void
protected function callListeners(RequestEvent $event, iterable $listeners): void
{
$wrappedListeners = [];
$wrappedLazyListeners = [];
$authenticatorManagerListener = null;

foreach ($listeners as $listener) {
if ($listener instanceof LazyFirewallContext) {
\Closure::bind(function () use (&$wrappedLazyListeners, &$wrappedListeners, &$authenticatorManagerListener) {
\Closure::bind(function () use (&$wrappedListeners, &$authenticatorManagerListener) {
$listeners = [];
foreach ($this->listeners as $listener) {
if (!$authenticatorManagerListener && $listener instanceof TraceableAuthenticatorManagerListener) {
Expand All @@ -62,12 +64,12 @@ protected function callListeners(RequestEvent $event, iterable $listeners): void
if ($listener instanceof FirewallListenerInterface) {
$listener = new WrappedLazyListener($listener);
$listeners[] = $listener;
$wrappedLazyListeners[] = $listener;
$wrappedListeners[] = $listener;
} else {
$listeners[] = function (RequestEvent $event) use ($listener, &$wrappedListeners) {
$wrappedListener = new WrappedListener($listener);
$wrappedListener($event);
$wrappedListeners[] = $wrappedListener->getInfo();
$wrappedListeners[] = $wrappedListener;
};
}
}
Expand All @@ -78,7 +80,7 @@ protected function callListeners(RequestEvent $event, iterable $listeners): void
} else {
$wrappedListener = $listener instanceof FirewallListenerInterface ? new WrappedLazyListener($listener) : new WrappedListener($listener);
$wrappedListener($e 727E vent);
$wrappedListeners[] = $wrappedListener->getInfo();
$this->wrappedListeners[] = $wrappedListener;
if (!$authenticatorManagerListener && $listener instanceof TraceableAuthenticatorManagerListener) {
$authenticatorManagerListener = $listener;
}
Expand All @@ -89,12 +91,6 @@ protected function callListeners(RequestEvent $event, iterable $listeners): void
}
}

if ($wrappedLazyListeners) {
foreach ($wrappedLazyListeners as $lazyListener) {
$this->wrappedListeners[] = $lazyListener->getInfo();
}
}

$this->wrappedListeners = array_merge($this->wrappedListeners, $wrappedListeners);

if ($authenticatorManagerListener) {
Expand Down
0