ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
34 include_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  {
50  $ret["firstname"] = "first ".$ext_uid;
51  $ret["lastname"] = "last ".$ext_uid;
52  $ret["email"] = $ext_uid."@de.de";
53  }
54 
55  // return valid authentication if user id equals soap password
56  if ($ext_uid == $soap_pw)
57  {
58  $ret["valid"] = true;
59  }
60  else
61  {
62  $ret["valid"] = false;
63  }
64 
65  return $ret;
66 }
67 
68 
70 {
71  /*
72  * @var object Nusoap-Server
73  */
74  var $server = null;
75 
76 
77  function ilSoapDummyAuthServer($a_use_wsdl = true)
78  {
79  define('SERVICE_NAME','ILIAS SOAP Dummy Authentication Server');
80  define('SERVICE_NAMESPACE','urn:ilSoapDummyAuthServer');
81  define('SERVICE_STYLE','rpc');
82  define('SERVICE_USE','encoded');
83 
84  $this->server =& new soap_server();
85 
86  if($a_use_wsdl)
87  {
88  $this->__enableWSDL();
89  }
90 
91  $this->__registerMethods();
92 
93  }
94 
95  function start()
96  {
97  global $HTTP_RAW_POST_DATA;
98 
99  $this->server->service($HTTP_RAW_POST_DATA);
100  exit();
101  }
102 
103  // PRIVATE
104  function __enableWSDL()
105  {
106  $this->server->configureWSDL(SERVICE_NAME,SERVICE_NAMESPACE);
107 
108  return true;
109  }
110 
111 
112  function __registerMethods()
113  {
114 
115  // Add useful complex types. E.g. array("a","b") or array(1,2)
116  $this->server->wsdl->addComplexType('intArray',
117  'complexType',
118  'array',
119  '',
120  'SOAP-ENC:Array',
121  array(),
122  array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:int[]')),
123  'xsd:int');
124 
125 
126  $this->server->wsdl->addComplexType('stringArray',
127  'complexType',
128  'array',
129  '',
130  'SOAP-ENC:Array',
131  array(),
132  array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')),
133  'xsd:string');
134 
135  // isValidSession()
136  $this->server->register('isValidSession',
137  array('ext_uid' => 'xsd:string',
138  'soap_pw' => 'xsd:string',
139  'new_user' => 'xsd:boolean'),
140  array('valid' => 'xsd:boolean',
141  'firstname' => 'xsd:string',
142  'lastname' => 'xsd:string',
143  'email' => 'xsd:string'),
144  SERVICE_NAMESPACE,
145  SERVICE_NAMESPACE.'#isValidSession',
146  SERVICE_STYLE,
147  SERVICE_USE,
148  'Dummy Session Validation');
149 
150  return true;
151  }
152 
153 }
154 ?>