ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAuthSOAP.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public static function testConnection(string $a_ext_uid, string $a_soap_pw, bool $a_new_user): string
24 {
25 global $ilSetting;
26
27 $settings = $ilSetting->getAll();
28
29 $server_hostname = (string) ($settings['soap_auth_server'] ?? '');
30 $server_port = (int) ($settings['soap_auth_port'] ?? 0);
31 $server_uri = (string) ($settings['soap_auth_uri'] ?? '');
32 $namespace = (string) ($settings['soap_auth_namespace'] ?? '');
33 $use_dotnet = (bool) ($settings['soap_auth_use_dotnet'] ?? false);
34 $uri = 'http://';
35 if (isset($settings['soap_auth_use_https']) && $settings['soap_auth_use_https']) {
36 $uri = 'https://';
37 }
38
39 $uri .= $server_hostname;
40
41 if ($server_port > 0) {
42 $uri .= ':' . $server_port;
43 }
44
45 if ($server_uri !== '') {
46 $uri .= '/' . $server_uri;
47 }
48
49 require_once __DIR__ . '/../../soap/lib/nusoap.php';
50 $soap_client = new nusoap_client($uri);
51 if ($err = $soap_client->getError()) {
52 return 'SOAP Authentication Initialisation Error: ' . $err;
53 }
54
55 $soapAction = '';
56 $nspref = '';
57 if ($use_dotnet) {
58 $soapAction = $namespace . '/isValidSession';
59 $nspref = 'ns1:';
60 }
61
62 $valid = $soap_client->call(
63 'isValidSession',
64 [
65 $nspref . 'ext_uid' => $a_ext_uid,
66 $nspref . 'soap_pw' => $a_soap_pw,
67 $nspref . 'new_user' => $a_new_user
68 ],
70 $soapAction
71 );
72
73 return
74 '<br>== Request ==' .
75 '<br><pre>' . htmlspecialchars(str_replace('" ', "\"\n ", str_replace('>', ">\n", $soap_client->request)), ENT_QUOTES) . '</pre><br>' .
76 '<br>== Response ==' .
77 '<br>Valid: -' . $valid['valid'] . '-' .
78 '<br><pre>' . htmlspecialchars(str_replace('" ', "\"\n ", str_replace('>', ">\n", $soap_client->response)), ENT_QUOTES) . '</pre>';
79 }
80}
static testConnection(string $a_ext_uid, string $a_soap_pw, bool $a_new_user)
[nu]soapclient higher level class for easy usage.
Definition: nusoap.php:7179
$valid
if($err=$client->getError()) $namespace
global $ilSetting
Definition: privfeed.php:31