forked from phluzern/shibboleth_auth
-
Notifications
You must be signed in to change notification settings - Fork 9
/
ext_localconf.php
83 lines (67 loc) · 2.99 KB
/
ext_localconf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
use Visol\ShibbolethAuth\Controller\FrontendLoginController;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use Visol\ShibbolethAuth\Hook\UserAuthentication;
use Visol\ShibbolethAuth\LoginProvider\ShibbolethLoginProvider;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use Visol\ShibbolethAuth\Typo3\Service\ShibbolethAuthenticationService;
defined('TYPO3') || die();
(function ($extKey = 'shibboleth_auth') {
$extensionConfiguration = GeneralUtility::makeInstance(
ExtensionConfiguration::class
)->get($extKey);
$subTypes = [];
if ($extensionConfiguration['enableBE']) {
$subTypes[] = 'getUserBE';
$subTypes[] = 'authUserBE';
$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup']['BE_fetchUserIfNoSession'] = $extensionConfiguration['BE_fetchUserIfNoSession'];
// Register backend logout handler
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'][] = UserAuthentication::class . '->backendLogoutHandler';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'][1518433441] = [
'provider' => ShibbolethLoginProvider::class,
'sorting' => 60,
'icon-class' => 'fa-sign-in',
'label' => 'LLL:EXT:shibboleth_auth/Resources/Private/Language/locallang.xlf:backend_login.header'
];
}
if ($extensionConfiguration['enableFE']) {
// Register FE user authentication subtypes
$subTypes[] = 'getUserFE';
$subTypes[] = 'authUserFE';
// Register FE plugin
ExtensionUtility::configurePlugin(
'ShibbolethAuth',
'Login',
[
FrontendLoginController::class => 'index,login,loginSuccess,logout,logoutSuccess',
],
// non-cacheable actions
[
FrontendLoginController::class => 'index,loginSuccess,logoutSuccess',
]
);
// Configure if session should be fetched on each page load
$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup']['FE_fetchUserIfNoSession'] = $extensionConfiguration['FE_fetchUserIfNoSession'];
}
// Register authentication service
ExtensionManagementUtility::addService(
$extKey,
'auth',
ShibbolethAuthenticationService::class,
[
'title' => 'Shibboleth Authentication',
'description' => 'Shibboleth Authentication service (BE & FE)',
'subtype' => implode(',', $subTypes),
'available' => true,
'priority' => $extensionConfiguration['priority'],
'quality' => 50,
'os' => '',
'exec' => '',
'className' => ShibbolethAuthenticationService::class,
]
);
// Use popup window to refresh login instead of the AJAX relogin
$GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup'] = 1;
})();