ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilAuthProviderShibboleth Class Reference

Shibboleth authentication provider. More...

+ Inheritance diagram for ilAuthProviderShibboleth:
+ Collaboration diagram for ilAuthProviderShibboleth:

Public Member Functions

 __construct (ilAuthCredentials $credentials)
 
 doAuthentication (ilAuthStatus $status)
 
- Public Member Functions inherited from ilAuthProvider
 __construct (ilAuthCredentials $credentials)
 Constructor. More...
 
 getLogger ()
 Get logger. More...
 
 getCredentials ()
 
- Public Member Functions inherited from ilAuthProviderInterface
 doAuthentication (\ilAuthStatus $status)
 Do authentication. More...
 

Private Attributes

ILIAS $ilias
 
ilSetting $settings
 

Additional Inherited Members

- Protected Member Functions inherited from ilAuthProvider
 handleAuthenticationFail (ilAuthStatus $status, string $a_reason)
 Handle failed authentication. More...
 

Detailed Description

Shibboleth authentication provider.

Definition at line 20 of file class.ilAuthProviderShibboleth.php.

Constructor & Destructor Documentation

◆ __construct()

ilAuthProviderShibboleth::__construct ( ilAuthCredentials  $credentials)

Definition at line 25 of file class.ilAuthProviderShibboleth.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\settings().

26  {
27  global $DIC;
28  $this->ilias = $DIC['ilias'];
29  $this->settings = $DIC->settings();
30  parent::__construct($credentials);
31  }
global $DIC
Definition: shib_login.php:25
Class ilObjForumAdministration.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ doAuthentication()

ilAuthProviderShibboleth::doAuthentication ( ilAuthStatus  $status)
Exceptions
ilObjectNotFoundException
ilSystemStyleException
ilPasswordException
ilObjectTypeMismatchException
ilUserException

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

References $_SERVER, $new_user, ilObjUser\_lookupId(), ilShibbolethSettings\ACCOUNT_CREATION_DISABLED, ilShibbolethSettings\ACCOUNT_CREATION_ENABLED, ilShibbolethSettings\ACCOUNT_CREATION_WITH_APPROVAL, shibUser\buildInstance(), ilShibbolethRoleAssignmentRules\doAssignments(), ilShibbolethPluginWrapper\getInstance(), shibServerData\getInstance(), ilAuthProvider\getLogger(), ilAuthProvider\handleAuthenticationFail(), ilAuthStatus\setAuthenticatedUserId(), ilAuthStatus\setReason(), ilAuthStatus\setStatus(), ILIAS\Repository\settings(), ilAuthStatus\STATUS_AUTHENTICATED, ilAuthStatus\STATUS_AUTHENTICATION_FAILED, and ilShibbolethRoleAssignmentRules\updateAssignments().

40  : bool
41  {
42  $shib_server_data = shibServerData::getInstance();
43 
44  if ($shib_server_data->getLogin() !== '' && $shib_server_data->getLogin() !== '0') {
45  $shib_user = shibUser::buildInstance($shib_server_data);
46  // for backword compatibility of hook environment variables
47  $new_user = $shib_user->isNew(); // For shib_data_conv included Script
49  $account_creation = $settings->getAccountCreation();
50  if (!$new_user) {
51  $shib_user->updateFields();
52  // Include custom code that can be used to further modify
53  // certain Shibboleth user attributes
54  if (
55  $this->ilias->getSetting('shib_data_conv') &&
56  $this->ilias->getSetting('shib_data_conv') !== '' &&
57  is_readable($this->ilias->getSetting('shib_data_conv'))
58  ) {
60  include($this->ilias->getSetting('shib_data_conv'));
61  }
62  $shib_user = ilShibbolethPluginWrapper::getInstance()->beforeUpdateUser($shib_user);
63  $shib_user->update();
64  $shib_user = ilShibbolethPluginWrapper::getInstance()->afterUpdateUser($shib_user);
66  } elseif (!($account_creation === ilShibbolethSettings::ACCOUNT_CREATION_DISABLED)) {
67  $shib_user->createFields();
68  $shib_user->setPref('hits_per_page', $this->settings->get('hits_per_page'));
69 
70  // Modify user data before creating the user
71  // Include custom code that can be used to further modify
72  // certain Shibboleth user attributes
73  if (
74  $this->ilias->getSetting('shib_data_conv') &&
75  $this->ilias->getSetting('shib_data_conv', '') !== '' &&
76  is_readable($this->ilias->getSetting('shib_data_conv'))
77  ) {
79  include($this->ilias->getSetting('shib_data_conv'));
80  }
81  $shib_user = ilShibbolethPluginWrapper::getInstance()->beforeCreateUser($shib_user);
82  if ($account_creation === ilShibbolethSettings::ACCOUNT_CREATION_WITH_APPROVAL) {
83  $shib_user->setActive(false);
84  }
85  $shib_user->create();
86  $shib_user->saveAsNew();
87  $shib_user->updateOwner();
88  $shib_user->writePrefs();
89  $shib_user = ilShibbolethPluginWrapper::getInstance()->afterCreateUser($shib_user);
91  }
92 
93  if(!$new_user || $account_creation === ilShibbolethSettings::ACCOUNT_CREATION_ENABLED) {
95  $status->setAuthenticatedUserId(ilObjUser::_lookupId($shib_user->getLogin()));
96  } elseif ($account_creation === ilShibbolethSettings::ACCOUNT_CREATION_WITH_APPROVAL) {
98  $status->setReason('err_inactive');
99  } else {
101  $status->setReason('err_disabled');
102  }
103 
104  } else {
105  $this->getLogger()->info('Shibboleth authentication failed.');
106  $this->handleAuthenticationFail($status, 'err_wrong_login');
107  return false;
108  }
109 
110  return true;
111  }
const STATUS_AUTHENTICATION_FAILED
static doAssignments(int $a_usr_id, array $a_data)
static _lookupId($a_user_str)
handleAuthenticationFail(ilAuthStatus $status, string $a_reason)
Handle failed authentication.
setStatus(int $a_status)
Set auth status.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
static updateAssignments(int $a_usr_id, array $a_data)
Class ilObjForumAdministration.
static buildInstance(shibServerData $shibServerData)
getLogger()
Get logger.
$new_user
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $ilias

ILIAS ilAuthProviderShibboleth::$ilias
private

Definition at line 22 of file class.ilAuthProviderShibboleth.php.

◆ $settings

ilSetting ilAuthProviderShibboleth::$settings
private

Definition at line 23 of file class.ilAuthProviderShibboleth.php.


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