繁体   English   中英

TYPO3 - AuthenticationService 中的访问设置

[英]TYPO3 - Access settings in AuthenticationService

我确实为 TYPO3 v10 开发了一个小扩展,在该扩展中我需要访问扩展\TYPO3\CMS\Core\Authentication\AuthenticationService的服务 class 中的扩展设置。

My first attemp was to pass the settings using the DI configured in my Services.yaml according to: https://daniel-siepmann.de/concrete-typo3-dependency-injection-examples.html (Inject Extension Configuration)

但是,无论我做什么,传递给我的__constructor(array $settings)的设置数组都保持为空。

然后我尝试 go 进行更hacky的尝试,例如:

public function __construct(array $settings)
    {
        $this->settings = $settings;
        DebuggerUtility::var_dump($this->settings);

        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
        $typoscript = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
        
        DebuggerUtility::var_dump($typoscript);
        die('debug');
    }

但加载完整的打字稿似乎也失败了,因为 $typoscript 也是 null。 因此我认为这与我的 class 扩展的 AuthenticationService 有关系吗? 扩展 TYPO3 的 AuthenticationService 时如何访问我的设置?

当为 FE 或 BE 登录咨询 AuthenticationService 时,打字稿尚不可用,因为身份验证发生在中间件堆栈的早期(查看后端配置模块中 PSR-15 中间件的顺序)。

这是因为打字稿取决于页面,您是否有资格访问页面可能取决于您的登录状态或用户角色。

所以问题是你想访问什么样的设置? 您可以使用站点配置(已加载用于身份验证),也可以使用始终可用的 TYPO3_CONF_VARS 中的全局配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM