ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSoapAuthenticationCAS Class Reference
+ Inheritance diagram for ilSoapAuthenticationCAS:
+ Collaboration diagram for ilSoapAuthenticationCAS:

Public Member Functions

 setPT ($a_pt)
 
 getPT ()
 
 authenticate ()
 
 validateSession ()
 
 __buildAuth ()
 

Detailed Description

Definition at line 36 of file class.ilSoapAuthenticationCAS.php.

Member Function Documentation

◆ __buildAuth()

ilSoapAuthenticationCAS::__buildAuth ( )

Definition at line 230 of file class.ilSoapAuthenticationCAS.php.

231 {
232
233 if (!is_object($this->db))
234 {
235 require_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
236 $ilDB = ilDBWrapperFactory::getWrapper();
237 $ilDB->initFromIniFile();
238 $ilDB->connect();
239 $this->db = $ilDB;
240 }
241
242 $GLOBALS["ilDB"] = $this->db;
243 $this->init->initSettings();
244
245 $this->init->buildHTTPPath();
246 include_once './Services/Administration/classes/class.ilSetting.php';
247 $set = new ilSetting();
248
249 /*$query = "SELECT * FROM sett ings WHERE ".
250 " keyword = ".$this->db->quote("cas_server")." OR ".
251 " keyword = ".$this->db->quote("cas_port")." OR ".
252 " keyword = ".$this->db->quote("cas_uri");
253 $res = $this->db->query($query);
254 $cas_set = array();
255 while ($rec = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
256 {
257 $cas_set[$rec["keyword"]] = $rec["value"];
258 }*/
259 $cas_set["cas_server"] = $set->get("cas_server");
260 $cas_set["cas_port"] = $set->get("cas_port");
261 $cas_set["cas_uri"] = $set->get("cas_uri");
262
263 $auth_params = array(
264 "server_version" => CAS_VERSION_2_0,
265 "server_hostname" => $cas_set["cas_server"],
266 "server_port" => $cas_set["cas_port"],
267 "server_uri" => $cas_set["cas_uri"]);
268
269 include_once("Services/CAS/classes/class.ilCASAuth.php");
270 $this->auth = new ilCASAuth($auth_params);
271
272 // HTTP path will return full path to server.php directory
273 phpCAS::setFixedServiceURL(ILIAS_HTTP_PATH."/webservice/soap/server.php");
274
275 return true;
276 }
Class CASAuth.
ILIAS Setting Class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static setFixedServiceURL($url)
Set the fixed URL that will be set as the CAS service parameter.
Definition: CAS.php:1566
const CAS_VERSION_2_0
Definition: CAS.php:78
global $ilDB

References $GLOBALS, $ilDB, CAS_VERSION_2_0, and phpCAS\setFixedServiceURL().

Referenced by authenticate(), and validateSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ authenticate()

ilSoapAuthenticationCAS::authenticate ( )

Definition at line 84 of file class.ilSoapAuthenticationCAS.php.

85 {
86 include_once("./Services/Init/classes/class.ilInitialisation.php");
87 $this->init = new ilInitialisation();
88 $this->init->requireCommonIncludes();
89 //$init->initSettings();
90
91
92 if(!$this->getClient())
93 {
94 $this->__setMessage('No client given');
95 return false;
96 }
97
98 if(!$this->getUsername())
99 {
100 $this->__setMessage('No username given');
101 return false;
102 }
103 // Read ilias ini
104 if(!$this->__buildDSN())
105 {
106 $this->__setMessage('Error building dsn/Wrong client Id?');
107 return false;
108 }
109
110 if(!$this->__setSessionSaveHandler())
111 {
112 return false;
113 }
114 if(!$this->__checkAgreement('cas'))
115 {
116 return false;
117 }
118
119 if(!$this->__buildAuth())
120 {
121 return false;
122 }
123
124 if($this->soap_check and !$this->__checkSOAPEnabled())
125 {
126 $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
127 $this->__setMessageCode('Server');
128
129 return false;
130 }
131
132 // check whether authentication is valid
133 //if (!$this->auth->checkCASAuth())
135 {
136 $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): No valid CAS authentication.');
137 return false;
138 }
139
140 $this->auth->forceCASAuth();
141
142 if ($this->getUsername() != $this->auth->getCASUser())
143 {
144 $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): SOAP CAS user does not match to ticket user.');
145 return false;
146 }
147
148 include_once('./Services/User/classes/class.ilObjUser.php');
149 $local_user = ilObjUser::_checkExternalAuthAccount("cas", $this->auth->getCASUser());
150 if ($local_user == "")
151 {
152 $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): SOAP CAS user authenticated but not existing in ILIAS user database.');
153 return false;
154 }
155
156 /*
157 $init->initIliasIniFile();
158 $init->initSettings();
159 $ilias = new ILIAS();
160 $GLOBALS['ilias'] =& $ilias;*/
161
162 $this->auth->start();
163
164 if(!$this->auth->getAuth())
165 {
166 $this->__getAuthStatus();
167
168 return false;
169 }
170
171 $this->setSid(session_id());
172
173 return true;
174 }
ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration fil...
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
static checkAuthentication()
This method is called to check if the user is already authenticated locally or has a global cas sessi...
Definition: CAS.php:1073

References __buildAuth(), ilObjUser\_checkExternalAuthAccount(), and phpCAS\checkAuthentication().

+ Here is the call graph for this function:

◆ getPT()

ilSoapAuthenticationCAS::getPT ( )

Definition at line 79 of file class.ilSoapAuthenticationCAS.php.

80 {
81 return $this->pt;
82 }

◆ setPT()

ilSoapAuthenticationCAS::setPT (   $a_pt)

Definition at line 74 of file class.ilSoapAuthenticationCAS.php.

75 {
76 $this->pt = $a_pt;
77 $_GET['ticket'] = $a_pt;
78 }
$_GET["client_id"]

References $_GET.

◆ validateSession()

ilSoapAuthenticationCAS::validateSession ( )

Definition at line 177 of file class.ilSoapAuthenticationCAS.php.

178 {
179 if(!$this->getClient())
180 {
181 $this->__setMessage('No client given');
182 return false;
183 }
184 if(!$this->getSid())
185 {
186 $this->__setMessage('No session id given');
187 return false;
188 }
189
190 if(!$this->__buildDSN())
191 {
192 $this->__setMessage('Error building dsn');
193 return false;
194 }
195 if(!$this->__setSessionSaveHandler())
196 {
197 return false;
198 }
199 if(!$this->__buildAuth())
200 {
201 return false;
202 }
203 if($this->soap_check and !$this->__checkSOAPEnabled())
204 {
205 $this->__setMessage('SOAP is not enabled in ILIAS administration for this client');
206 $this->__setMessageCode('Server');
207
208 return false;
209 }
210
211 // check whether authentication is valid
212 if (!$this->auth->checkCASAuth())
213 {
214 $this->__setMessage('ilSOAPAuthenticationCAS::authenticate(): No valid CAS authentication.');
215 return false;
216 }
217 $this->auth->forceCASAuth();
218
219 $this->auth->start();
220 if(!$this->auth->getAuth())
221 {
222 $this->__setMessage('Session not valid');
223
224 return false;
225 }
226
227 return true;
228 }

References __buildAuth().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: