4 include_once
'Auth/Container.php';
28 parent::__construct();
41 global $PHPCAS_CLIENT,
$ilLog;
43 if(!$PHPCAS_CLIENT->isAuthenticated())
45 $PHPCAS_CLIENT->forceAuthentication();
56 $ilLog->write(__METHOD__.
': Successful CAS login.');
59 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
65 include_once(
"./Services/CAS/lib/CAS.php");
66 if ($PHPCAS_CLIENT->getUser() !=
"")
68 $username = $PHPCAS_CLIENT->getUser();
69 $ilLog->write(__METHOD__.
': Username: '.$username);
72 include_once(
'./Services/User/classes/class.ilObjUser.php');
75 if ($local_user !=
"")
77 $a_auth->setAuth($local_user);
81 if (!$ilSetting->get(
"cas_create_users"))
92 $newUser[
"firstname"] = $local_user;
93 $newUser[
"lastname"] =
"";
95 $newUser[
"login"] = $local_user;
98 $newUser[
"passwd"] =
"";
102 $newUser[
"auth_mode"] =
"cas";
103 $newUser[
"ext_account"] = $username;
104 $newUser[
"profile_incomplete"] = 1;
107 $userObj->assignData($newUser);
108 $userObj->setTitle($userObj->getFullname());
109 $userObj->setDescription($userObj->getEmail());
112 $userObj->setLanguage($ilSetting->get(
"language"));
115 $userObj->setTimeLimitOwner(7);
116 $userObj->setTimeLimitUnlimited(1);
117 $userObj->setTimeLimitFrom(
time());
118 $userObj->setTimeLimitUntil(
time());
121 $userObj->setOwner(0);
123 $userObj->setActive(1);
125 $userObj->updateOwner();
128 $userObj->saveAsNew();
131 $userObj->writePrefs();
134 $rbacadmin->assignUser($ilSetting->get(
'cas_user_default_role'), $userObj->getId(),
true);
137 $a_auth->setAuth($local_user);
143 $ilLog->write(__METHOD__.
': Login failed.');
146 $a_auth->status = AUTH_WRONG_LOGIN;
159 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
164 $GLOBALS[
'ilLog']->write(__METHOD__.
' Using ldap data source for user: '.$ext_account);
166 include_once
'./Services/LDAP/classes/class.ilLDAPUserSynchronisation.php';
169 $sync->setUserData(
array());
170 #$sync->forceCreation($this->force_creation); 172 $sync->forceCreation(
true);
175 $internal_account = $sync->sync();
178 $GLOBALS[
'ilLog']->write(__METHOD__.
': Login failed with message: '. $e->getMessage());
179 $a_auth->status = AUTH_WRONG_LOGIN;
185 $GLOBALS[
'ilLog']->write(__METHOD__.
': Login failed with message: '. $e->getMessage());
191 $GLOBALS[
'ilLog']->write(__METHOD__.
': Starting account migration.');
193 ilUtil::redirect(
'ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration');
195 $a_auth->setAuth($internal_account);
208 public function fetchData($a_username,$a_password,$isChallengeResponse =
false)
210 global $PHPCAS_CLIENT,
$ilLog;
212 $ilLog->write(__METHOD__.
': Fetch Data called');
213 return $PHPCAS_CLIENT->isAuthenticated();
220 include_once(
"./Services/CAS/lib/CAS.php");
223 $this->server_hostname = $ilSetting->get(
'cas_server');
224 $this->server_port = (int) $ilSetting->get(
'cas_port');
225 $this->server_uri = (
string) $ilSetting->get(
'cas_uri');
229 $this->server_version,
230 $this->server_hostname,
Description of ilLDAPSyncronisationException.
forceAuthentication($username, $status, $auth)
Force CAS authentication.
handleLDAPDataSource($a_auth, $ext_account)
Handle ldap as data source.
static _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Synchronization of user accounts used in auth container ldap, radius , cas,...
Add rich text string
The name of the decorator.
const AUTH_CAS_NO_ILIAS_USER
fetchData($a_username, $a_password, $isChallengeResponse=false)
setExternalAccount($a_ext)
Set external account (unique for each auth mode)
Description of ilLDAPAccountMigrationRequiredException.
static getInstanceByServerId($a_server_id)
Get instance by server id.
static isDataSourceActive($a_auth_mode)
Check if a data source is active for a specific auth mode ilDB $ilDB.
static getDataSource($a_auth_mode)
Create styles array
The data for the language used.
static setDebug($filename='')
Set/unset debug mode.
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static setNoCasServerValidation()
Set no SSL validation for the CAS server.
static redirect($a_script)
http redirect to other script
static client($server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true)
phpCAS client initializer.
loginObserver($a_username, $a_auth)