ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAuthProviderShibboleth Class Reference

Shibboleth authentication provider. More...

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

Public Member Functions

 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...
 

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.

Member Function Documentation

◆ doAuthentication()

ilAuthProviderShibboleth::doAuthentication ( ilAuthStatus  $status)

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

References $_SERVER, $DIC, $ilSetting, ILIAS\LTI\ToolProvider\$settings, ilObjUser\_lookupId(), shibUser\buildInstance(), ilShibbolethRoleAssignmentRules\doAssignments(), ilShibbolethPluginWrapper\getInstance(), shibServerData\getInstance(), ilAuthProvider\getLogger(), ilAuthProvider\handleAuthenticationFail(), ilAuthStatus\setAuthenticatedUserId(), ilAuthStatus\setReason(), ilAuthStatus\setStatus(), ilAuthStatus\STATUS_AUTHENTICATED, ilAuthStatus\STATUS_AUTHENTICATION_FAILED, and ilShibbolethRoleAssignmentRules\updateAssignments().

22  : bool
23  {
24  global $DIC; // for backwards compatibility of hook environment variables
25  $ilias = $DIC['ilias'];
26  $ilSetting = $DIC['ilSetting'];
27  $shibServerData = shibServerData::getInstance();
28 
29  if ($shibServerData->getLogin() !== '' && $shibServerData->getLogin() !== '0') {
30  $shibUser = shibUser::buildInstance($shibServerData);
31  // for backword compatibility of hook environment variables
32  $userObj = &$shibUser; // For shib_data_conv included Script
33  $newUser = $shibUser->isNew(); // For shib_data_conv included Script
34  if ($shibUser->isNew()) {
35  $shibUser->createFields();
36  $shibUser->setPref('hits_per_page', $ilSetting->get('hits_per_page'));
37 
38  // Modify user data before creating the user
39  // Include custom code that can be used to further modify
40  // certain Shibboleth user attributes
41  if (
42  $ilias->getSetting('shib_data_conv') &&
43  $ilias->getSetting('shib_data_conv', '') !== '' &&
44  is_readable($ilias->getSetting('shib_data_conv'))
45  ) {
47  include($ilias->getSetting('shib_data_conv'));
48  }
49  $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeCreateUser($shibUser);
50  $shibUser->create();
51  $shibUser->saveAsNew();
52  $shibUser->updateOwner();
53  $shibUser->writePrefs();
54  $shibUser = ilShibbolethPluginWrapper::getInstance()->afterCreateUser($shibUser);
56  } else {
57  $shibUser->updateFields();
58  // Include custom code that can be used to further modify
59  // certain Shibboleth user attributes
60  if (
61  $ilias->getSetting('shib_data_conv') &&
62  $ilias->getSetting('shib_data_conv') !== '' &&
63  is_readable($ilias->getSetting('shib_data_conv'))
64  ) {
66  include($ilias->getSetting('shib_data_conv'));
67  }
68  // $shibUser->update();
69  $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeUpdateUser($shibUser);
70  $shibUser->update();
71  $shibUser = ilShibbolethPluginWrapper::getInstance()->afterUpdateUser($shibUser);
73  }
74 
76 
77  if (!$newUser || !$settings->adminMustActivate()) {
79  $status->setAuthenticatedUserId(ilObjUser::_lookupId($shibUser->getLogin()));
80  } elseif ($settings->adminMustActivate()) {
82  $status->setReason('err_inactive');
83  }
84  } else {
85  $this->getLogger()->info('Shibboleth authentication failed.');
86  $this->handleAuthenticationFail($status, 'err_wrong_login');
87  return false;
88  }
89 
90  return true;
91  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
const STATUS_AUTHENTICATION_FAILED
static doAssignments(int $a_usr_id, array $a_data)
static _lookupId($a_user_str)
global $DIC
Definition: feed.php:28
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)
static buildInstance(shibServerData $shibServerData)
getLogger()
Get logger.
global $ilSetting
Definition: privfeed.php:17
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
Class ilShibbolethSettings.
+ Here is the call graph for this function:

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