Class CASAuth.
More...
Class CASAuth.
CAS Authentication class.
Definition at line 37 of file class.ilCASAuth.php.
◆ __construct()
ilCASAuth::__construct |
( |
|
$a_params | ) |
|
Constructor public.
Definition at line 43 of file class.ilCASAuth.php.
References CAS_VERSION_2_0, and phpCAS\client().
45 if ($a_params[
"sessionName"] !=
"") {
46 parent::__construct(
"", array(
"sessionName" => $a_params[
"sessionName"]));
48 parent::__construct(
"");
51 include_once(
"./Services/CAS/lib/CAS.php");
53 $this->server_hostname = $a_params[
"server_hostname"];
54 $this->server_port = (int) $a_params[
"server_port"];
55 $this->server_uri = $a_params[
"server_uri"];
60 $this->server_version,
61 $this->server_hostname,
63 (
string) $this->server_uri
static client( $server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true)
phpCAS client initializer.
◆ checkCASAuth()
ilCASAuth::checkCASAuth |
( |
| ) |
|
check cas autehntication
can be called before forceAuthentication, but forceAuthentication must be called afterwards
Definition at line 73 of file class.ilCASAuth.php.
75 global $PHPCAS_CLIENT;
77 return $PHPCAS_CLIENT->isAuthenticated();
◆ forceCASAuth()
ilCASAuth::forceCASAuth |
( |
| ) |
|
◆ getCASUser()
ilCASAuth::getCASUser |
( |
| ) |
|
◆ login()
Checks if the current user is authenticated yet public.
- Returns
- boolean true if user is authenticated Set the maximum idle time
- Parameters
-
integer | time in seconds |
bool | add time to current maximum idle time or not |
- Returns
- void public Set the maximum expire time
- Parameters
-
integer | time in seconds |
bool | add time to current expire time or not |
- Returns
- void public Checks if there is a session with valid auth information.
private
- Returns
- boolean Whether or not the user is authenticated. Start new auth session
public
- Returns
- void Login function
private
- Returns
- void
Definition at line 214 of file class.ilCASAuth.php.
References $ilSetting, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_generateLogin(), AUTH_CAS_NO_ILIAS_USER, phpCAS\getUser(), IL_PASSWD_CRYPTED, and logout().
222 include_once(
'./Services/User/classes/class.ilObjUser.php');
225 if ($local_user !=
"") {
226 $this->setAuth($local_user);
228 if (!$ilSetting->get(
"cas_create_users")) {
238 $newUser[
"firstname"] = $local_user;
239 $newUser[
"lastname"] =
"";
241 $newUser[
"login"] = $local_user;
244 $newUser[
"passwd"] =
"";
248 $newUser[
"auth_mode"] =
"cas";
249 $newUser[
"ext_account"] = $username;
250 $newUser[
"profile_incomplete"] = 1;
253 $userObj->assignData($newUser);
254 $userObj->setTitle($userObj->getFullname());
255 $userObj->setDescription($userObj->getEmail());
258 $userObj->setLanguage($ilSetting->get(
"language"));
261 $userObj->setTimeLimitOwner(7);
262 $userObj->setTimeLimitUnlimited(1);
263 $userObj->setTimeLimitFrom(time());
264 $userObj->setTimeLimitUntil(time());
267 $userObj->setOwner(0);
269 $userObj->setActive(1);
271 $userObj->updateOwner();
274 $userObj->saveAsNew();
277 $userObj->writePrefs();
280 $rbacadmin->assignUser($ilSetting->get(
'cas_user_default_role'), $userObj->getId(),
true);
284 $this->setAuth($local_user);
288 $this->status = AUTH_WRONG_LOGIN;
logout()
Register variable in a session telling that the user has logged in successfully.
static getUser()
This method returns the CAS user's login name.
static _generateLogin($a_login)
generate free login by starting with a default string and adding postfix numbers
const AUTH_CAS_NO_ILIAS_USER
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
◆ logout()
Register variable in a session telling that the user has logged in successfully.
public
- Parameters
-
- Returns
- void Logout function
This function clears any auth tokens in the currently active session and executes the logout callback function, if any
public
- Returns
- void
Definition at line 334 of file class.ilCASAuth.php.
Referenced by login().
The documentation for this class was generated from the following file: