Skip to content

Commit 037bc14

Browse files
committed
WIP
1 parent 2e33193 commit 037bc14

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

src/Controllers/Admin/FederationTestController.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,10 @@ public function federationDiscovery(Request $request): Response
189189
throw new OidcException('Empty Trust Anchor ID.');
190190

191191
try {
192-
$entities = $this->federationWithArrayLogger->federationDiscovery()->discoverAndFetch(
192+
$entities = $this->federationWithArrayLogger->federationDiscovery()->discoverEntityIds(
193193
trustAnchorId: $trustAnchorId,
194-
forceRefresh: true,
194+
// forceRefresh: true, // TODO make optional in form
195195
);
196-
197196
} catch (\Throwable $exception) {
198197
$this->arrayLogger->error(sprintf(
199198
'Error during entity discovery under Trust Anchor %s. Error was %s',
@@ -205,13 +204,21 @@ public function federationDiscovery(Request $request): Response
205204

206205
$logMessages = $this->arrayLogger->getEntries();
207206

207+
try {
208+
$trustAnchorIds = $this->moduleConfig->getFederationTrustAnchorIds();
209+
} catch (\Throwable $exception) {
210+
$this->arrayLogger->error('Module config error: ' . $exception->getMessage());
211+
$trustAnchorIds = [];
212+
}
213+
208214
return $this->templateFactory->build(
209215
'oidc:tests/federation-discovery.twig',
210216
compact(
211217
'trustAnchorId',
212218
'logMessages',
213219
'isFormSubmitted',
214220
'entities',
221+
'trustAnchorIds',
215222
),
216223
RoutesEnum::AdminTestFederationDiscovery->value,
217224
);

src/Controllers/Federation/EntityStatementController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ public function configuration(): Response
9595
ClaimsEnum::OrganizationUri->value => $this->moduleConfig->getOrganizationUri(),
9696
],
9797
)),
98-
ClaimsEnum::FederationFetchEndpoint->value => $this->routes->urlFederationFetch(),
99-
ClaimsEnum::FederationListEndpoint->value => $this->routes->urlFederationList(),
10098
// TODO v7 mivanci Add when ready. Use ClaimsEnum for keys.
10199
// https://openid.net/specs/openid-federation-1_0.html#name-federation-entity
102100
//'federation_resolve_endpoint',

templates/tests/federation-discovery.twig

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
{{ 'You can use the form below to test Federation Discovery under given Trust Anchor.'|trans }}
99
{{ 'Log messages will show if any warnings or errors were raised during the process.'|trans }}
1010
</p>
11+
<p>
12+
{% if trustAnchorIds|default %}
13+
{{ 'Curently configured Trust Anchors for this entity:'|trans }}
14+
<ul>
15+
{% for trustAnchor in trustAnchorIds %}
16+
<li>{{ trustAnchor }}</li>
17+
{% endfor %}
18+
</ul>
19+
{% else %}
20+
{{ 'No Trust Anchors are currently configured for this entity.'|trans }}
21+
{% endif %}
22+
</p>
1123

1224
<form method="post"
1325
action="{{ routes.urlAdminTestFederationDiscovery }}"
@@ -22,7 +34,7 @@
2234
required=""
2335
value="{{ trustAnchorId|default }}"
2436
>
25-
<span class="pure-form-message"></span>
37+
<span class="pure-form-message">Use any Trust Anchor ID for discovery</span>
2638

2739
<br>
2840
<button type="submit" class="pure-button ">{{ (actionText|default('Submit'))|trans }}</button>
@@ -42,13 +54,15 @@
4254
</p>
4355

4456
<h4>{{ 'Entities'|trans }}</h4>
57+
<p>
4558
{% if entities|default %}
4659
<code class="code-box code-box-content">
4760
{{- entities|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_UNESCAPED_SLASHES')) -}}
4861
</code>
4962
{% else %}
5063
{{ 'No entities were found during the process.'|trans }}
5164
{% endif %}
65+
</p>
5266

5367
{% endif %}
5468

0 commit comments

Comments
 (0)