4 include_once
'Auth/Container.php';
26 parent::__construct();
39 global $PHPCAS_CLIENT,
$ilLog;
41 if (!$PHPCAS_CLIENT->isAuthenticated()) {
42 $PHPCAS_CLIENT->forceAuthentication();
53 $ilLog->write(__METHOD__ .
': Successful CAS login.');
56 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
61 include_once(
"./Services/CAS/lib/CAS.php");
62 if ($PHPCAS_CLIENT->getUser() !=
"") {
63 $username = $PHPCAS_CLIENT->getUser();
64 $ilLog->write(__METHOD__ .
': Username: ' . $username);
67 include_once(
'./Services/User/classes/class.ilObjUser.php');
70 if ($local_user !=
"") {
71 $a_auth->setAuth($local_user);
73 if (!$ilSetting->get(
"cas_create_users")) {
83 $newUser[
"firstname"] = $local_user;
84 $newUser[
"lastname"] =
"";
86 $newUser[
"login"] = $local_user;
89 $newUser[
"passwd"] =
"";
93 $newUser[
"auth_mode"] =
"cas";
94 $newUser[
"ext_account"] = $username;
95 $newUser[
"profile_incomplete"] = 1;
98 $userObj->assignData($newUser);
99 $userObj->setTitle($userObj->getFullname());
100 $userObj->setDescription($userObj->getEmail());
103 $userObj->setLanguage($ilSetting->get(
"language"));
106 $userObj->setTimeLimitOwner(7);
107 $userObj->setTimeLimitUnlimited(1);
108 $userObj->setTimeLimitFrom(
time());
109 $userObj->setTimeLimitUntil(
time());
112 $userObj->setOwner(0);
114 $userObj->setActive(1);
116 $userObj->updateOwner();
119 $userObj->saveAsNew();
122 $userObj->writePrefs();
125 $rbacadmin->assignUser($ilSetting->get(
'cas_user_default_role'), $userObj->getId(),
true);
128 $a_auth->setAuth($local_user);
132 $ilLog->write(__METHOD__ .
': Login failed.');
135 $a_auth->status = AUTH_WRONG_LOGIN;
148 include_once
'./Services/LDAP/classes/class.ilLDAPServer.php';
153 $GLOBALS[
'ilLog']->write(__METHOD__ .
' Using ldap data source for user: ' . $ext_account);
155 include_once
'./Services/LDAP/classes/class.ilLDAPUserSynchronisation.php';
157 $sync->setExternalAccount($ext_account);
159 #$sync->forceCreation($this->force_creation); 161 $sync->forceCreation(
true);
164 $internal_account =
$sync->sync();
166 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Login failed with message: ' . $e->getMessage());
167 $a_auth->status = AUTH_WRONG_LOGIN;
172 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Login failed with message: ' . $e->getMessage());
177 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Starting account migration.');
179 ilUtil::redirect(
'ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration');
181 $a_auth->setAuth($internal_account);
194 public function fetchData($a_username, $a_password, $isChallengeResponse =
false)
196 global $PHPCAS_CLIENT,
$ilLog;
198 $ilLog->write(__METHOD__ .
': Fetch Data called');
199 return $PHPCAS_CLIENT->isAuthenticated();
206 include_once(
"./Services/CAS/lib/CAS.php");
209 $this->server_hostname = $ilSetting->get(
'cas_server');
210 $this->server_port = (int) $ilSetting->get(
'cas_port');
211 $this->server_uri = (
string) $ilSetting->get(
'cas_uri');
215 $this->server_version,
216 $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,...
const AUTH_CAS_NO_ILIAS_USER
fetchData($a_username, $a_password, $isChallengeResponse=false)
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 _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
static setDebug($filename='')
Set/unset debug mode.
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)
static client($server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true)
phpCAS client initializer.
loginObserver($a_username, $a_auth)