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

webservice/soap/classes/class.ilSoapAuthentication.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 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 
00033 include_once 'Auth/Auth.php';
00034 include_once './classes/class.ilBaseAuthentication.php';
00035 
00036 class ilSoapAuthentication extends ilBaseAuthentication
00037 {
00038         function ilSoapAuthentication()
00039         {
00040                 parent::ilBaseAuthentication();
00041                 $this->__setMessageCode('Client');
00042         }
00043 
00044         function authenticate()
00045         {
00046                 if(!$this->getClient())
00047                 {
00048                         $this->__setMessage('No client given');
00049                         return false;
00050                 }
00051                 if(!$this->getUsername())
00052                 {
00053                         $this->__setMessage('No username given');
00054                         return false;
00055                 }
00056                 // Read ilias ini
00057                 if(!$this->__buildAuth())
00058                 {
00059                         return false;
00060                 }
00061                 if(!$this->__setSessionSaveHandler())
00062                 {
00063                         return false;
00064                 }
00065                 if(!$this->__checkSOAPEnabled())
00066                 {
00067                         $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
00068                         $this->__setMessageCode('Server');
00069 
00070                         return false;
00071                 }
00072 
00073 
00074                 $this->auth->start();
00075 
00076                 if(!$this->auth->getAuth())
00077                 {
00078                         $this->__getAuthStatus();
00079 
00080                         return false;
00081                 }                       
00082 
00083                 $this->setSid(session_id());
00084 
00085                 return true;
00086         }
00087 
00088         
00089         function validateSession()
00090         {
00091                 if(!$this->getClient())
00092                 {
00093                         $this->__setMessage('No client given');
00094                         return false;
00095                 }
00096                 if(!$this->getSid())
00097                 {
00098                         $this->__setMessage('No session id given');
00099                         return false;
00100                 }
00101                 
00102                 if(!$this->__buildAuth())
00103                 {
00104                         return false;
00105                 }
00106                 if(!$this->__setSessionSaveHandler())
00107                 {
00108                         return false;
00109                 }
00110                 if(!$this->__checkSOAPEnabled())
00111                 {
00112                         $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
00113                         $this->__setMessageCode('Server');
00114 
00115                         return false;
00116                 }
00117                 $this->auth->start();
00118                 if(!$this->auth->getAuth())
00119                 {
00120                         $this->__setMessage('Session not valid');
00121                         
00122                         return false;
00123                 }
00124                 
00125                 return true;
00126         }
00127 
00128         // PRIVATE
00129         function __checkSOAPEnabled()
00130         {
00131                 include_once './classes/class.ilDBx.php';
00132 
00133                 
00134                 $db =& new ilDBx($this->dsn);
00135 
00136                 $query = "SELECT * FROM settings WHERE keyword = 'soap_user_administration' AND value = 1";
00137 
00138                 $res = $db->query($query);
00139 
00140                 return $res->numRows() ? true : false;
00141         }
00142 }
00143 ?>

Generated on Fri Dec 13 2013 09:06:40 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1