forked from codeFareith/cf_google_authenticator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathext_localconf.php
101 lines (90 loc) · 4.02 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Configuration file for TYPO3 CMS Extension 'cf_google_authenticator'
*
* This script is included in the global scope, either frontend or backend.
* It defines various hooks, registers services and request handlers,
* etc.
*
* @author Robin 'codeFareith' von den Bergen <[email protected]>
* @copyright (c) 2018 by Robin von den Bergen
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 1.0.0
*
* @link https://github.com/codeFareith/cf_google_authenticator
* @see https://www.fareith.de
* @see https://typo3.org
*/
/** @noinspection PhpFullyQualifiedNameUsageInspection */
defined('TYPO3_MODE')
or die('Access denied.');
call_user_func(
static function ($_EXTKEY) {
$globalsReference = &$GLOBALS;
$extConf = \CodeFareith\CfGoogleAuthenticator\Utility\ExtensionBasicDataUtility::getExtensionConfiguration();
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Extbase\Object\ObjectManager::class
);
$adapterFactory = $objectManager->get(\CodeFareith\CfGoogleAuthenticator\Service\GoogleAuthenticationServiceAdapterFactory::class);
$adapter = $adapterFactory->create();
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService(
$_EXTKEY,
'auth',
\CodeFareith\CfGoogleAuthenticator\Service\AuthenticationService::class,
[
'title' => 'Google Authenticator',
'description' => 'Enable Google 2FA for both, frontend- and backend login',
'subtype' => 'authUserFE,authUserBE',
'available' => true,
'priority' => 80,
'quality' => 80,
'os' => '',
'exec' => '',
'className' => get_class($adapter),
]
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
\CodeFareith\CfGoogleAuthenticator\Utility\TypoScriptUtility::getIncludeTypoScriptFileTag(
\CodeFareith\CfGoogleAuthenticator\Utility\PathUtility::makeExtensionPath(
'Configuration/TypoScript/setup.typoscript'
)
)
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
\CodeFareith\CfGoogleAuthenticator\Utility\ExtensionBasicDataUtility::getVendorName() . '.' . \CodeFareith\CfGoogleAuthenticator\Utility\ExtensionBasicDataUtility::getExtensionKey(),
'Setup',
[
'Frontend\Setup' => 'index,form,update',
],
[
'Frontend\Setup' => 'form,update',
],
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_PLUGIN
);
if ((bool) $extConf['googleAuthenticatorEnableFE'] === true) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants(
'styles.content.loginform.templateFile = ' . $extConf['feLoginTemplate']
);
}
if ((bool) $extConf['googleAuthenticatorEnableBE'] === true) {
$globalsReference['TYPO3_CONF_VARS']
['EXTCONF']
['backend']
['loginProviders']
[1433416747]
['provider'] = \CodeFareith\CfGoogleAuthenticator\Provider\Login\GoogleAuthenticatorLoginProvider::class;
}
$globalsReference['TYPO3_CONF_VARS']
['SC_OPTIONS']
['t3lib/class.t3lib_tcemain.php']
['processDatamapClass']
[$_EXTKEY] = \CodeFareith\CfGoogleAuthenticator\Hook\TCEMain::class;
$globalsReference['TYPO3_CONF_VARS']
['EXTCONF']
['felogin']
['postProcContent']
[$_EXTKEY] = \CodeFareith\CfGoogleAuthenticator\Hook\FeLogin::class . '->createOneTimePasswordField';
},
/** @var string $_EXTKEY */
$_EXTKEY
);