• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/SOAPAuth/classes/class.ilSoapDummyAuthServer.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00034 include_once './webservice/soap/lib/nusoap.php';
00035 
00039 function isValidSession($ext_uid, $soap_pw, $new_user)
00040 {
00041         $ret = array(
00042                 "valid" => false,
00043                 "firstname" => "",
00044                 "lastname" => "",
00045                 "email" => "");
00046                 
00047         // generate some dummy values
00048         if ($new_user)
00049         {
00050                 $ret["firstname"] = "first ".$ext_uid;
00051                 $ret["lastname"] = "last ".$ext_uid;
00052                 $ret["email"] = $ext_uid."@de.de";
00053         }
00054         
00055         // return valid authentication if user id equals soap password
00056         if ($ext_uid == $soap_pw)
00057         {
00058                 $ret["valid"] = true;
00059         }
00060         else
00061         {
00062                 $ret["valid"] = false;
00063         }
00064         
00065         return $ret;
00066 }
00067 
00068 
00069 class ilSoapDummyAuthServer
00070 {
00071         /*
00072          * @var object Nusoap-Server
00073          */
00074         var $server = null;
00075 
00076 
00077     function ilSoapDummyAuthServer($a_use_wsdl = true)
00078     {
00079                 define('SERVICE_NAME','ILIAS SOAP Dummy Authentication Server');
00080                 define('SERVICE_NAMESPACE','urn:ilSoapDummyAuthServer');
00081                 define('SERVICE_STYLE','rpc');
00082                 define('SERVICE_USE','encoded');
00083 
00084                 $this->server =& new soap_server();
00085 
00086                 if($a_use_wsdl)
00087                 {
00088                         $this->__enableWSDL();
00089                 }
00090 
00091                 $this->__registerMethods();
00092 
00093     }
00094 
00095         function start()
00096         {
00097                 global $HTTP_RAW_POST_DATA;
00098 
00099                 $this->server->service($HTTP_RAW_POST_DATA);
00100                 exit();
00101         }
00102 
00103         // PRIVATE
00104         function __enableWSDL()
00105         {
00106                 $this->server->configureWSDL(SERVICE_NAME,SERVICE_NAMESPACE);
00107 
00108                 return true;
00109         }
00110 
00111 
00112         function __registerMethods()
00113         {
00114 
00115                 // Add useful complex types. E.g. array("a","b") or array(1,2)
00116                 $this->server->wsdl->addComplexType('intArray',
00117                                                                                         'complexType',
00118                                                                                         'array',
00119                                                                                         '',
00120                                                                                         'SOAP-ENC:Array',
00121                                                                                         array(),
00122                                                                                         array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:int[]')),
00123                                                                                         'xsd:int');
00124 
00125 
00126                 $this->server->wsdl->addComplexType('stringArray',
00127                                                                                         'complexType',
00128                                                                                         'array',
00129                                                                                         '',
00130                                                                                         'SOAP-ENC:Array',
00131                                                                                         array(),
00132                                                                                         array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')),
00133                                                                                         'xsd:string');
00134 
00135                 // isValidSession()
00136                 $this->server->register('isValidSession',
00137                                                                 array('ext_uid' => 'xsd:string',
00138                                                                           'soap_pw' => 'xsd:string',
00139                                                                           'new_user' => 'xsd:boolean'),
00140                                                                 array('valid' => 'xsd:boolean',
00141                                                                         'firstname' => 'xsd:string',
00142                                                                         'lastname' => 'xsd:string',
00143                                                                         'email' => 'xsd:string'),
00144                                                                 SERVICE_NAMESPACE,
00145                                                                 SERVICE_NAMESPACE.'#isValidSession',
00146                                                                 SERVICE_STYLE,
00147                                                                 SERVICE_USE,
00148                                                                 'Dummy Session Validation');
00149 
00150                 return true;
00151         }
00152 
00153 }
00154 ?>

Generated on Fri Dec 13 2013 17:57:01 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1