ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAuthContainerSOAP Class Reference

@classDescription Authentication against external SOAP server More...

+ Inheritance diagram for ilAuthContainerSOAP:
+ Collaboration diagram for ilAuthContainerSOAP:

Public Member Functions

 __construct ()
 Constructor. More...
 
 initClient ()
 Init soap client. More...
 
 fetchData ($a_username, $a_password, $isChallengeResponse=false)
 Call is isValidSession of soap server. More...
 
 loginObserver ($a_username, $a_auth)
 Called after login and successful call of fetch data. More...
 
- Public Member Functions inherited from Auth_Container
 Auth_Container ()
 Constructor. More...
 
 fetchData ($username, $password, $isChallengeResponse=false)
 Fetch data from storage container. More...
 
 verifyPassword ($password1, $password2, $cryptType="md5")
 Crypt and verfiy the entered password. More...
 
 supportsChallengeResponse ()
 Returns true if the container supports Challenge Response password authentication. More...
 
 getCryptType ()
 Returns the crypt current crypt type of the container. More...
 
 listUsers ()
 List all users that are available from the storage container. More...
 
 getUser ($username)
 Returns a user assoc array. More...
 
 addUser ($username, $password, $additional=null)
 Add a new user to the storage container. More...
 
 removeUser ($username)
 Remove user from the storage container. More...
 
 changePassword ($username, $password)
 Change password for user in the storage container. More...
 
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message to the Auth log. More...
 
- Public Member Functions inherited from ilAuthContainerBase
 loginObserver ($a_username, $a_auth)
 Called after successful login. More...
 
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login. More...
 
 checkAuthObserver ($a_username, $a_auth)
 Called after check auth requests. More...
 
 logoutObserver ($a_username, $a_auth)
 Called after logout. More...
 
 supportsCaptchaVerification ()
 Returns whether or not the auth container supports the verification of captchas This should be true for those auth methods, which are available in the default login form. More...
 

Protected Attributes

 $server_host = null
 
 $server_port = null
 
 $server_uri = null
 
 $server_https = null
 
 $server_nms = null
 
 $use_dot_net = null
 
 $uri = null
 
 $client = null
 
 $response = null
 

Additional Inherited Members

- Data Fields inherited from Auth_Container
 $activeUser = ""
 User that is currently selected from the storage container. More...
 
 $_auth_obj = null
 The Auth object this container is attached to. More...
 

Detailed Description

@classDescription Authentication against external SOAP server

Todo:
This class should inherit either from Auth_Container_SOAP or Auth_Container_SOAP5
Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$id$

Definition at line 35 of file class.ilAuthContainerSOAP.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthContainerSOAP::__construct ( )

Constructor.

Definition at line 50 of file class.ilAuthContainerSOAP.php.

51 {
52 $_POST['username'] = $_GET['ext_uid'];
53 $_POST['password'] = $_GET['soap_pw'];
54
55 parent::__construct();
56 $this->initClient();
57 }
$_GET["client_id"]
$_POST['username']
Definition: cron.php:12

References $_GET, $_POST, and initClient().

+ Here is the call graph for this function:

Member Function Documentation

◆ fetchData()

ilAuthContainerSOAP::fetchData (   $a_username,
  $a_password,
  $isChallengeResponse = false 
)

Call is isValidSession of soap server.

Returns
bool
Parameters
string$a_username
string$a_password
bool$isChallengeResponse,[optional]

Reimplemented from Auth_Container.

Definition at line 94 of file class.ilAuthContainerSOAP.php.

95 {
96 $GLOBALS['ilLog']->write(__METHOD__.': Soap auth fetch data');
97
98 // check whether external user exists in ILIAS database
99 $local_user = ilObjUser::_checkExternalAuthAccount("soap", $a_username);
100
101 if ($local_user == "")
102 {
103 $new_user = true;
104 }
105 else
106 {
107 $new_user = false;
108 }
109
110 $soapAction = "";
111 $nspref = "";
112 if ($this->use_dotnet)
113 {
114 $soapAction = $this->server_nms."/isValidSession";
115 $nspref = "ns1:";
116 }
117 $valid = $this->client->call('isValidSession',
118 array($nspref.'ext_uid' => $a_username,
119 $nspref.'soap_pw' => $a_password,
120 $nspref.'new_user' => $new_user),
121 $this->server_nms,
122 $soapAction);
123
124 if (trim($valid["valid"]) == "false")
125 {
126 $valid["valid"] = false;
127 }
128
129 // to do check SOAP error!?
130 $valid["local_user"] = $local_user;
131 $this->response = $valid;
132
133 return $valid['valid'] == true;
134 }
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
$valid
$new_user
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, $new_user, $valid, and ilObjUser\_checkExternalAuthAccount().

+ Here is the call graph for this function:

◆ initClient()

ilAuthContainerSOAP::initClient ( )

Init soap client.

Definition at line 62 of file class.ilAuthContainerSOAP.php.

63 {
64 global $ilSetting;
65
66 $this->server_host = $ilSetting->get('soap_auth_server');
67 $this->server_port = $ilSetting->get('soap_auth_port');
68 $this->server_uri = $ilSetting->get('soap_auth_uri');
69 $this->server_https = $ilSetting->get('soap_auth_use_https');
70 $this->server_nms = $ilSetting->get('soap_auth_namespace');
71 $this->use_dot_net = $ilSetting->get('use_dotnet');
72
73 $this->uri = $this->server_https ? 'https://' : 'http://';
74 $this->uri .= $this->server_host;
75
76 if($this->server_port > 0)
77 {
78 $this->uri .= (':'.$this->server_port);
79 }
80 if($this->server_uri)
81 {
82 $this->uri .= ('/'.$this->server_uri);
83 }
84 $this->client = new nusoap_client($this->uri);
85 }
[nu]soapclient higher level class for easy usage.
Definition: nusoap.php:7059
global $ilSetting
Definition: privfeed.php:40

References $ilSetting, and $server_host.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ loginObserver()

ilAuthContainerSOAP::loginObserver (   $a_username,
  $a_auth 
)

Called after login and successful call of fetch data.

Returns
bool
Parameters
string$a_username
\ilAuthWeb$a_auth

Reimplemented from ilAuthContainerBase.

Definition at line 142 of file class.ilAuthContainerSOAP.php.

143 {
144 global $rbacadmin, $lng, $ilSetting;
145
146 $GLOBALS['ilLog']->write(__METHOD__.': SOAP login observer called');
147
148 $local_user = $this->response["local_user"];
149 if ($local_user != "")
150 {
151 // to do: handle update of user
152 $a_auth->setAuth($local_user);
153 return true;
154 }
155 if(!$ilSetting->get("soap_auth_create_users"))
156 {
157 $a_auth->status = AUTH_SOAP_NO_ILIAS_USER;
158 $a_auth->logout();
159 return false;
160 }
161
162 $userObj = new ilObjUser();
163 $local_user = ilAuthUtils::_generateLogin($a_username);
164
165 $newUser["firstname"] = $this->response["firstname"];
166 $newUser["lastname"] = $this->response["lastname"];
167 $newUser["email"] = $this->response["email"];
168
169 $newUser["login"] = $local_user;
170
171 // to do: set valid password and send mail
172 $newUser["passwd"] = "";
173 $newUser["passwd_type"] = IL_PASSWD_CRYPTED;
174
175 // generate password, if local authentication is allowed
176 // and account mail is activated
177 $pw = "";
178
179 if ($ilSetting->get("soap_auth_allow_local") &&
180 $ilSetting->get("soap_auth_account_mail"))
181 {
183 $pw = $pw[0];
184 $newUser["passwd"] = $pw;
185 $newUser["passwd_type"] = IL_PASSWD_PLAIN;
186 }
187
188 //$newUser["gender"] = "m";
189 $newUser["auth_mode"] = "soap";
190 $newUser["ext_account"] = $a_username;
191 $newUser["profile_incomplete"] = 1;
192
193 // system data
194 $userObj->assignData($newUser);
195 $userObj->setTitle($userObj->getFullname());
196 $userObj->setDescription($userObj->getEmail());
197
198 // set user language to system language
199 $userObj->setLanguage($lng->lang_default);
200
201 // Time limit
202 $userObj->setTimeLimitOwner(7);
203 $userObj->setTimeLimitUnlimited(1);
204 $userObj->setTimeLimitFrom(time());
205 $userObj->setTimeLimitUntil(time());
206
207 // Create user in DB
208 $userObj->setOwner(0);
209 $userObj->create();
210 $userObj->setActive(1);
211
212 $userObj->updateOwner();
213
214 //insert user data in table user_data
215 $userObj->saveAsNew(false);
216
217 // setup user preferences
218 $userObj->writePrefs();
219
220 // to do: test this
221 $rbacadmin->assignUser($ilSetting->get('soap_auth_user_default_role'), $userObj->getId(),true);
222
223 // send account mail
224 if ($ilSetting->get("soap_auth_account_mail"))
225 {
226 include_once('./Services/User/classes/class.ilObjUserFolder.php');
227 $amail = ilObjUserFolder::_lookupNewAccountMail($ilSetting->get("language"));
228 if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
229 {
230 include_once("Services/Mail/classes/class.ilAccountMail.php");
231 $acc_mail = new ilAccountMail();
232
233 if ($pw != "")
234 {
235 $acc_mail->setUserPassword($pw);
236 }
237 $acc_mail->setUser($userObj);
238 $acc_mail->send();
239 }
240 }
241
242 unset($userObj);
243 $a_auth->setAuth($local_user);
244 return true;
245 }
const AUTH_SOAP_NO_ILIAS_USER
const IL_PASSWD_PLAIN
const IL_PASSWD_CRYPTED
Class ilAccountMail.
_generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
static generatePasswords($a_number)
Generate a number of passwords.
global $lng
Definition: privfeed.php:40

References $GLOBALS, $ilSetting, $lng, ilAuthUtils\_generateLogin(), ilObjUserFolder\_lookupNewAccountMail(), AUTH_SOAP_NO_ILIAS_USER, ilUtil\generatePasswords(), IL_PASSWD_CRYPTED, and IL_PASSWD_PLAIN.

+ Here is the call graph for this function:

Field Documentation

◆ $client

ilAuthContainerSOAP::$client = null
protected

Definition at line 44 of file class.ilAuthContainerSOAP.php.

◆ $response

ilAuthContainerSOAP::$response = null
protected

Definition at line 45 of file class.ilAuthContainerSOAP.php.

◆ $server_host

ilAuthContainerSOAP::$server_host = null
protected

Definition at line 37 of file class.ilAuthContainerSOAP.php.

Referenced by initClient().

◆ $server_https

ilAuthContainerSOAP::$server_https = null
protected

Definition at line 40 of file class.ilAuthContainerSOAP.php.

◆ $server_nms

ilAuthContainerSOAP::$server_nms = null
protected

Definition at line 41 of file class.ilAuthContainerSOAP.php.

◆ $server_port

ilAuthContainerSOAP::$server_port = null
protected

Definition at line 38 of file class.ilAuthContainerSOAP.php.

◆ $server_uri

ilAuthContainerSOAP::$server_uri = null
protected

Definition at line 39 of file class.ilAuthContainerSOAP.php.

◆ $uri

ilAuthContainerSOAP::$uri = null
protected

Definition at line 43 of file class.ilAuthContainerSOAP.php.

◆ $use_dot_net

ilAuthContainerSOAP::$use_dot_net = null
protected

Definition at line 42 of file class.ilAuthContainerSOAP.php.


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