Skip to content

Commit acd4cea

Browse files
committed
Display bool values as metrics, Dont display request_matcher anymore
1 parent 9549901 commit acd4cea

File tree

2 files changed

+71
-23
lines changed

2 files changed

+71
-23
lines changed

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18-
use Symfony\Component\HttpFoundation\ParameterBag;
1918
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
2019
use Symfony\Component\Security\Core\Role\RoleInterface;
2120
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
@@ -132,24 +131,10 @@ public function collect(Request $request, Response $response, \Exception $except
132131

133132
// collect firewall context informations
134133
if ($this->firewallMap instanceof ContextAwareFirewallMapInterface) {
135-
$this->data['firewall'] = array('name' => null, 'config' => array());
136134
$firewallContext = $this->firewallMap->getContext($request);
137135

138136
if (null !== $firewallContext) {
139-
$config = $firewallContext->getConfig();
140-
$contextConfig = array();
141-
$contextConfig['request_matcher'] = $config->getRequestMatcher();
142-
$contextConfig['security'] = $config->hasSecurity();
143-
$contextConfig['context'] = $config->getContext();
144-
$contextConfig['entry_point'] = $config->getEntryPoint();
145-
$contextConfig['provider'] = $config->getProvider();
146-
$contextConfig['stateless'] = $config->isStateless();
147-
$contextConfig['access_denied_handler'] = $config->getAccessDeniedHandler();
148-
$contextConfig['access_denied_url'] = $config->getAccessDeniedUrl();
149-
$contextConfig['user_checker'] = $config->getUserChecker();
150-
151-
$this->data['firewall']['name'] = $config->getName();
152-
$this->data['firewall']['config'] = new ParameterBag($contextConfig);
137+
$this->data['firewall'] = $firewallContext->getConfig();
153138
}
154139
} else {
155140
$this->data['firewall'] = array();

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

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
{% if collector.firewall|default([]) is not empty %}
3737
<div class="sf-toolbar-info-piece">
3838
<b>Firewall name</b>
39-
<span>{{ collector.firewall.name }}</span>
39+
<span>{{ collector.firewall.name|default('n/a') }}</span>
4040
</div>
4141
{% endif %}
4242
{% if collector.logoutUrl %}
@@ -126,17 +126,80 @@
126126
</div>
127127
{% endif %}
128128

129-
{% if collector.firewall|default([]) is not empty %}
130-
<h2>Security Firewall</h2>
129+
<h2>Security Firewall</h2>
131130

131+
{% if collector.firewall|default([]) is not empty %}
132132
<div class="metrics">
133133
<div class="metric">
134-
<span class="value">{{ collector.firewall.name|default('unknown') }}</span>
135-
<span class="label">Firewall Name</span>
134+
<span class="value">{{ collector.firewall.name }}</span>
135+
<span class="label">Name</span>
136+
</div>
137+
<div class="metric">
138+
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.firewall.security ? 'yes' : 'no') ~ '.svg') }}</span>
139+
<span class="label">Security</span>
140+
</div>
141+
<div class="metric">
142+
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.firewall.stateless ? 'yes' : 'no') ~ '.svg') }}</span>
143+
<span class="label">Stateless</span>
144+
</div>
145+
<div class="metric">
146+
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.firewall.listenerConfigs.anonymous is defined ? 'yes' : 'no') ~ '.svg') }}</span>
147+
<span class="label">Anonymous</span>
136148
</div>
137149
</div>
138-
139-
{{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.firewall.config, labels: ['Key', 'Value'] }, with_context = false) }}
150+
{% if collector.firewall.security %}
151+
<table>
152+
<thead>
153+
<tr>
154+
<th scope="col" class="key">Key</th>
155+
<th scope="col">Value</th>
156+
</tr>
157+
</thead>
158+
<tbody>
159+
<tr>
160+
<th>provider</th>
161+
<td>{{ collector.firewall.provider }}</td>
162+
</tr>
163+
<tr>
164+
<th>context</th>
165+
<td>{{ collector.firewall.context }}</td>
166+
</tr>
167+
<tr>
168+
<th>entry_point</th>
169+
<td>{{ collector.firewall.entryPoint }}</td>
170+
</tr>
171+
<tr>
172+
<th>user_checker</th>
173+
<td>{{ collector.firewall.userChecker }}</td>
174+
</tr>
175+
<tr>
176+
<th>access_denied_handler</th>
177+
<td>{{ collector.firewall.accessDeniedHandler }}</td>
178+
</tr>
179+
<tr>
180+
<th>access_denied_url</th>
181+
<td>{{ collector.firewall.accessDeniedUrl }}</td>
182+
</tr>
183+
<tr>
184+
<th>listeners</th>
185+
<td>
186+
{% for name, listener in collector.firewall.listenerConfigs %}
187+
{{ name }}
188+
{{ profiler_dump(listener) }} <br>
189+
{% endfor %}
190+
</td>
191+
</tr>
192+
</tbody>
193+
</table>
194+
{% endif %}
195+
{% elseif collector.enabled %}
196+
<div class="empty">
197+
<p>There is no security firewall.</p>
198+
</div>
199+
{% else %}
200+
<div class="empty">
201+
<p>The security component is disabled.</p>
202+
</div>
140203
{% endif %}
141204

142205
{% if collector.voters|default([]) is not empty %}

0 commit comments

Comments
 (0)