ldap test2
This commit is contained in:
@@ -10,6 +10,7 @@ use App\LdapProvisioner;
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
$config = ConfigLoader::load($projectRoot, 'registration');
|
||||
$ldap = new LdapProvisioner($config);
|
||||
$diagnostics = $ldap->diagnostics();
|
||||
|
||||
$serviceResult = $ldap->testServiceBind();
|
||||
$messages = [];
|
||||
@@ -84,6 +85,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<p><?= htmlspecialchars((string) ($serviceResult['message'] ?? ''), ENT_QUOTES) ?></p>
|
||||
</div>
|
||||
|
||||
<div class="login-notice login-notice-info">
|
||||
<strong>Verbindungsdaten</strong>
|
||||
<ul class="login-list">
|
||||
<li>Host: <?= htmlspecialchars((string) ($diagnostics['host'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>Port: <?= htmlspecialchars((string) ($diagnostics['port'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>Bind-DN: <?= htmlspecialchars((string) ($diagnostics['bind_dn'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>Users-DN: <?= htmlspecialchars((string) ($diagnostics['users_dn'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>StartTLS: <?= htmlspecialchars((string) ($diagnostics['starttls'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>Gruppenmodus: <?= htmlspecialchars((string) ($diagnostics['group_assignment_mode'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>Gruppenattribut: <?= htmlspecialchars((string) ($diagnostics['group_member_attribute'] ?? ''), ENT_QUOTES) ?></li>
|
||||
<li>PHP LDAP-Erweiterung: <?= htmlspecialchars((string) ($diagnostics['ldap_extension'] ?? ''), ENT_QUOTES) ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if ($messages !== []): ?>
|
||||
<div class="login-notice login-notice-success">
|
||||
<strong>Ergebnis</strong>
|
||||
|
||||
@@ -28,6 +28,23 @@ final class LdapProvisioner
|
||||
&& function_exists('ldap_add');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function diagnostics(): array
|
||||
{
|
||||
return [
|
||||
'host' => trim((string) ($this->config['ldap']['host'] ?? '')),
|
||||
'port' => (string) ((int) ($this->config['ldap']['port'] ?? 389)),
|
||||
'bind_dn' => trim((string) ($this->config['ldap']['bind_dn'] ?? '')),
|
||||
'users_dn' => trim((string) ($this->config['ldap']['users_dn'] ?? '')),
|
||||
'starttls' => ((bool) ($this->config['ldap']['use_starttls'] ?? false)) ? 'aktiv' : 'inaktiv',
|
||||
'group_assignment_mode' => trim((string) ($this->config['ldap']['group_assignment_mode'] ?? 'group_memberuid')),
|
||||
'group_member_attribute' => trim((string) ($this->config['ldap']['group_member_attribute'] ?? 'memberUid')),
|
||||
'ldap_extension' => $this->canUseLdap() ? 'verfügbar' : 'nicht verfügbar',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{success: bool, message: string}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user