ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSoapDummyAuthServer.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24
34include_once './webservice/soap/lib/nusoap.php';
35
40{
41 $ret = array(
42 "valid" => false,
43 "firstname" => "",
44 "lastname" => "",
45 "email" => "");
46
47 // generate some dummy values
48 if ($new_user) {
49 $ret["firstname"] = "first " . $ext_uid;
50 $ret["lastname"] = "last " . $ext_uid;
51 $ret["email"] = $ext_uid . "@de.de";
52 }
53
54 // return valid authentication if user id equals soap password
55 if ($ext_uid == $soap_pw) {
56 $ret["valid"] = true;
57 } else {
58 $ret["valid"] = false;
59 }
60
61 return $ret;
62}
63
64
66{
67 /*
68 * @var object Nusoap-Server
69 */
70 public $server = null;
71
72
73 public function __construct($a_use_wsdl = true)
74 {
75 define('SERVICE_NAME', 'ILIAS SOAP Dummy Authentication Server');
76 define('SERVICE_NAMESPACE', 'urn:ilSoapDummyAuthServer');
77 define('SERVICE_STYLE', 'rpc');
78 define('SERVICE_USE', 'encoded');
79
80 $this->server = new soap_server();
81
82 if ($a_use_wsdl) {
83 $this->__enableWSDL();
84 }
85
86 $this->__registerMethods();
87 }
88
89 public function start()
90 {
92
93 $this->server->service($HTTP_RAW_POST_DATA);
94 exit();
95 }
96
97 // PRIVATE
98 public function __enableWSDL()
99 {
100 $this->server->configureWSDL(SERVICE_NAME, SERVICE_NAMESPACE);
101
102 return true;
103 }
104
105
106 public function __registerMethods()
107 {
108
109 // Add useful complex types. E.g. array("a","b") or array(1,2)
110 $this->server->wsdl->addComplexType(
111 'intArray',
112 'complexType',
113 'array',
114 '',
115 'SOAP-ENC:Array',
116 array(),
117 array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:int[]')),
118 'xsd:int'
119 );
120
121
122 $this->server->wsdl->addComplexType(
123 'stringArray',
124 'complexType',
125 'array',
126 '',
127 'SOAP-ENC:Array',
128 array(),
129 array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')),
130 'xsd:string'
131 );
132
133 // isValidSession()
134 $this->server->register(
135 'isValidSession',
136 array('ext_uid' => 'xsd:string',
137 'soap_pw' => 'xsd:string',
138 'new_user' => 'xsd:boolean'),
139 array('valid' => 'xsd:boolean',
140 'firstname' => 'xsd:string',
141 'lastname' => 'xsd:string',
142 'email' => 'xsd:string'),
143 SERVICE_NAMESPACE,
144 SERVICE_NAMESPACE . '#isValidSession',
145 SERVICE_STYLE,
146 SERVICE_USE,
147 'Dummy Session Validation'
148 );
149
150 return true;
151 }
152}
An exception for terminatinating execution or to throw for unit testing.
isValidSession($ext_uid, $soap_pw, $new_user)
isValidSession
soap_server allows the user to create a SOAP server that is capable of receiving messages and returni...
Definition: nusoap.php:2313
$soap_pw
$ext_uid
$new_user
global $HTTP_RAW_POST_DATA
$ret
Definition: parser.php:6