-
Notifications
You must be signed in to change notification settings - Fork 33
/
ext_localconf.php
68 lines (59 loc) · 2.21 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
<?php
declare(strict_types=1);
use Causal\Oidc\Hooks\DataHandlerOidc;
use Causal\Oidc\Service\AuthenticationService;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
defined('TYPO3') or die();
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = DataHandlerOidc::class;
$settings = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('oidc') ?? [];
// Service configuration
$subTypes = '';
if ($settings['enableFrontendAuthentication'] ?? '') {
$subTypesArr = [
'getUserFE',
'authUserFE',
'getGroupsFE',
];
$subTypes = implode(',', $subTypesArr);
}
$authenticationClassName = AuthenticationService::class;
ExtensionManagementUtility::addService(
'oidc',
'auth' /* sv type */,
$authenticationClassName /* sv key */,
[
'title' => 'Authentication service',
'description' => 'Authentication service for OpenID Connect.',
'subtype' => $subTypes,
'available' => true,
'priority' => (int)($settings['authenticationServicePriority'] ?? 82),
'quality' => (int)($settings['authenticationServiceQuality'] ?? 80),
'os' => '',
'exec' => '',
'className' => $authenticationClassName,
]
);
// Add typoscript for custom login plugin
ExtensionManagementUtility::addTypoScript('oidc', 'setup', '
# Setting oidc plugin TypoScript
plugin.tx_oidc_login = USER_INT
plugin.tx_oidc_login {
userFunc = Causal\Oidc\Controller\LoginController->login
defaultRedirectPid =
# Additional URL parameters for the authorization URL of the identity server
authorizationUrlOptions {
# login_theme = dark
}
}
');
ExtensionManagementUtility::addTypoScript('oidc', 'setup', '
# Setting oidc plugin TypoScript
tt_content.list.20.oidc_login =< plugin.tx_oidc_login
', 'defaultContentRendering');
// Require 3rd-party libraries, in case TYPO3 does not run in composer mode
$pharFileName = ExtensionManagementUtility::extPath('oidc') . 'Libraries/league-oauth2-client.phar';
if (is_file($pharFileName)) {
@include 'phar://' . $pharFileName . '/vendor/autoload.php';
}