ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilAuthProviderShibboleth.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/Authentication/classes/Provider/class.ilAuthProvider.php';
6include_once './Services/Authentication/interfaces/interface.ilAuthProviderInterface.php';
7include_once './Services/Authentication/interfaces/interface.ilAuthProviderAccountMigrationInterface.php';
8
9
10require_once('./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
11require_once('include/Unicode/UtfNormal.php');
12require_once('./Services/AuthShibboleth/classes/class.ilShibbolethPluginWrapper.php');
13require_once('./Services/AuthShibboleth/classes/Config/class.shibConfig.php');
14require_once('./Services/AuthShibboleth/classes/ServerData/class.shibServerData.php');
15require_once('./Services/AuthShibboleth/classes/User/class.shibUser.php');
16
22{
23 private $migration_account = '';
24
25
31 {
33 }
34
40 {
41 global $DIC; // for backword compatibility of hook environment variables
42 $ilias = $DIC['ilias'];
43 $ilSetting = $DIC['ilSetting'];
44 $shibServerData = shibServerData::getInstance();
45
46 //$this->getLogger()->dump($shibServerData);
47
48 if ($shibServerData->getLogin()) {
49 $shibUser = shibUser::buildInstance($shibServerData);
50 // for backword compatibility of hook environment variables
51 $userObj = &$shibUser; // For shib_data_conv included Script
52 $newUser = $shibUser->isNew(); // For shib_data_conv included Script
53 if ($shibUser->isNew()) {
54 $shibUser->createFields();
55 $shibUser->setPref('hits_per_page', $ilSetting->get('hits_per_page'));
56
57 // Modify user data before creating the user
58 // Include custom code that can be used to further modify
59 // certain Shibboleth user attributes
60 if ($ilias->getSetting('shib_data_conv') and $ilias->getSetting('shib_data_conv') != ''
61 and is_readable($ilias->getSetting('shib_data_conv'))
62 ) {
63 include($ilias->getSetting('shib_data_conv'));
64 }
65 $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeCreateUser($shibUser);
66 $shibUser->create();
67 $shibUser->updateOwner();
68 $shibUser->saveAsNew();
69 $shibUser->writePrefs();
70 $shibUser = ilShibbolethPluginWrapper::getInstance()->afterCreateUser($shibUser);
72 } else {
73 $shibUser->updateFields();
74 // Include custom code that can be used to further modify
75 // certain Shibboleth user attributes
76 if ($ilias->getSetting('shib_data_conv') and $ilias->getSetting('shib_data_conv') != ''
77 and is_readable($ilias->getSetting('shib_data_conv'))
78 ) {
79 include($ilias->getSetting('shib_data_conv'));
80 }
81 // $shibUser->update();
82 $shibUser = ilShibbolethPluginWrapper::getInstance()->beforeUpdateUser($shibUser);
83 $shibUser->update();
84 $shibUser = ilShibbolethPluginWrapper::getInstance()->afterUpdateUser($shibUser);
86 }
87
89 if (($newUser && !$c->isActivateNew()) || !$newUser) {
91 $status->setAuthenticatedUserId(ilObjUser::_lookupId($shibUser->getLogin()));
92 } elseif ($newUser && $c->isActivateNew()) {
94 $status->setReason('err_inactive');
95 }
96 } else {
97 $this->getLogger()->info('Shibboleth authentication failed.');
98 $this->handleAuthenticationFail($status, 'err_wrong_login');
99 return false;
100 }
101 }
102}
An exception for terminatinating execution or to throw for unit testing.
Shibboleth authentication provider.
doAuthentication(\ilAuthStatus $status)
Do apache auth.
__construct(\ilAuthCredentials $credentials)
Constructor.
Base class for authentication providers (radius, ldap, apache, ...)
getLogger()
Get logger.
handleAuthenticationFail(ilAuthStatus $status, $a_reason)
Handle failed authentication.
Auth status implementation.
const STATUS_AUTHENTICATION_FAILED
static _lookupId($a_user_str)
Lookup id by login.
static getInstance()
static buildInstance(shibServerData $shibServerData)
$c
Definition: cli.php:37
global $DIC
Definition: goto.php:24
Interface of auth credentials.
Standard interface for auth provider implementations.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10