Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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 var $soap_check = true;
00039
00040
00041 function ilSoapAuthentication()
00042 {
00043
00044 unset($_COOKIE['PHPSESSID']);
00045
00046 parent::ilBaseAuthentication();
00047 $this->__setMessageCode('Client');
00048 }
00049
00050 function disableSoapCheck()
00051 {
00052 $this->soap_check = false;
00053 }
00054
00055 function authenticate()
00056 {
00057 if(!$this->getClient())
00058 {
00059 $this->__setMessage('No client given');
00060 return false;
00061 }
00062 if(!$this->getUsername())
00063 {
00064 $this->__setMessage('No username given');
00065 return false;
00066 }
00067
00068 if(!$this->__buildDSN())
00069 {
00070 $this->__setMessage('Error building dsn/Wrong client Id?');
00071 return false;
00072 }
00073 if(!$this->__setSessionSaveHandler())
00074 {
00075 return false;
00076 }
00077
00078 if(!$this->__buildAuth())
00079 {
00080 return false;
00081 }
00082 if($this->soap_check and !$this->__checkSOAPEnabled())
00083 {
00084 $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
00085 $this->__setMessageCode('Server');
00086
00087 return false;
00088 }
00089
00090
00091 $this->auth->start();
00092
00093 if(!$this->auth->getAuth())
00094 {
00095 $this->__getAuthStatus();
00096
00097 return false;
00098 }
00099
00100 $this->setSid(session_id());
00101
00102 return true;
00103 }
00104
00105
00106 function validateSession()
00107 {
00108 if(!$this->getClient())
00109 {
00110 $this->__setMessage('No client given');
00111 return false;
00112 }
00113 if(!$this->getSid())
00114 {
00115 $this->__setMessage('No session id given');
00116 return false;
00117 }
00118
00119 if(!$this->__buildDSN())
00120 {
00121 $this->__setMessage('Error building dsn');
00122 return false;
00123 }
00124 if(!$this->__checkClientEnabled())
00125 {
00126 $this->__setMessage('Client disabled.');
00127 return false;
00128 }
00129
00130 if(!$this->__setSessionSaveHandler())
00131 {
00132 return false;
00133 }
00134 if(!$this->__buildAuth())
00135 {
00136 return false;
00137 }
00138 if($this->soap_check and !$this->__checkSOAPEnabled())
00139 {
00140 $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
00141 $this->__setMessageCode('Server');
00142
00143 return false;
00144 }
00145 $this->auth->start();
00146 if(!$this->auth->getAuth())
00147 {
00148 $this->__setMessage('Session not valid');
00149
00150 return false;
00151 }
00152
00153 return true;
00154 }
00155
00156
00157 function __checkSOAPEnabled()
00158 {
00159 include_once './classes/class.ilDBx.php';
00160
00161
00162 $db =& new ilDBx($this->dsn);
00163
00164 $query = "SELECT * FROM settings WHERE keyword = 'soap_user_administration' AND value = 1";
00165
00166 $res = $db->query($query);
00167
00168 return $res->numRows() ? true : false;
00169 }
00170
00171 function __checkClientEnabled()
00172 {
00173 if(is_object($this->ini) and $this->ini->readVariable('client','access'))
00174 {
00175 return true;
00176 }
00177 return false;
00178 }
00179 }
00180 ?>