![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-two-factor-auth/Block/Provider/U2fKey/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\U2fKey; use Magento\Backend\Block\Template; use Magento\Backend\Model\Auth\Session; use Magento\TwoFactorAuth\Model\Provider\Engine\U2fKey; use Magento\TwoFactorAuth\Model\Provider\Engine\U2fKey\Session as U2fSession; /** * @api */ class Configure extends Template { /** * @var U2fKey */ private $u2fKey; /** * @var U2fSession */ private $u2fSession; /** * @var Session */ private $session; /** * @param Template\Context $context * @param U2fKey $u2fKey * @param U2fSession $u2fSession * @param Session $session * @param array $data */ public function __construct( Template\Context $context, U2fKey $u2fKey, U2fSession $u2fSession, Session $session, array $data = [] ) { parent::__construct($context, $data); $this->u2fKey = $u2fKey; $this->u2fSession = $u2fSession; $this->session = $session; } /** * @inheritdoc */ public function getJsLayout() { $this->jsLayout['components']['tfa-configure']['postUrl'] = $this->getUrl('*/*/configurepost'); $this->jsLayout['components']['tfa-configure']['successUrl'] = $this->getUrl($this->_urlBuilder->getStartupPageUrl()); $this->jsLayout['components']['tfa-configure']['touchImageUrl'] = $this->getViewFileUrl('Magento_TwoFactorAuth::images/u2f/touch.png'); $this->jsLayout['components']['tfa-configure']['registerData'] = $this->getRegisterData(); return parent::getJsLayout(); } /** * Get the data required to issue a WebAuthn request * * @return array */ public function getRegisterData(): array { $registerData = $this->u2fKey->getRegisterData($this->session->getUser()); $this->u2fSession->setU2fChallenge($registerData['publicKey']['challenge']); return $registerData; } }