Skip to content

Commit fee6ccb

Browse files
committed
Added OIDC redirect URI display
1 parent 4c59755 commit fee6ccb

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/Form/SettingsForm.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Drupal\Core\Form\FormBase;
66
use Drupal\Core\Form\FormStateInterface;
7+
use Drupal\Core\Link;
78
use Drupal\Core\StringTranslation\StringTranslationTrait;
89
use Drupal\os2forms_nemlogin_openid_connect\Helper\Settings;
910
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -73,6 +74,41 @@ public function buildForm(array $form, FormStateInterface $form_state): array {
7374
'#value' => $this->t('Save settings'),
7475
];
7576

77+
try {
78+
$providers = Yaml::parse($providers);
79+
80+
$form['info'] = [
81+
'#type' => 'details',
82+
'#open' => TRUE,
83+
'#title' => $this->t('Provider details'),
84+
'#weight' => 9999,
85+
];
86+
87+
$form['info']['table'] = [
88+
'#theme' => 'table',
89+
'#header' => [
90+
['data' => 'Id'],
91+
['data' => 'Label'],
92+
['data' => 'Redirect URI'],
93+
['data' => ''],
94+
],
95+
'#rows' => array_map(fn ($id, $provider) => [
96+
'data' => [
97+
['data' => $id],
98+
['data' => $provider],
99+
['data' => Link::createFromRoute($provider, 'os2forms_nemlogin_openid_connect.openid_connect_authenticate', ['id' => $id])->toRenderable()],
100+
['data' => Link::createFromRoute($this->t('Edit'), 'os2web_nemlogin.auth_provider.' . $id)->toRenderable()],
101+
],
102+
],
103+
array_keys($providers),
104+
$providers
105+
),
106+
];
107+
}
108+
catch (\Exception $e) {
109+
// Ignore all exception.
110+
}
111+
76112
return $form;
77113
}
78114

0 commit comments

Comments
 (0)