[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Plugin 5 * @subpackage System.Webauthn 6 * 7 * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Plugin\System\Webauthn\PluginTraits; 12 13 use Joomla\CMS\Event\Plugin\System\Webauthn\AjaxInitCreate; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\User\User; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Ajax handler for akaction=initcreate 23 * 24 * Returns the Public Key Creation Options to start the attestation ceremony on the browser. 25 * 26 * @since 4.2.0 27 */ 28 trait AjaxHandlerInitCreate 29 { 30 /** 31 * Returns the Public Key Creation Options to start the attestation ceremony on the browser. 32 * 33 * @param AjaxInitCreate $event The event we are handling 34 * 35 * @return void 36 * @throws \Exception 37 * @since 4.2.0 38 */ 39 public function onAjaxWebauthnInitcreate(AjaxInitCreate $event): void 40 { 41 // Make sure I have a valid user 42 $user = Factory::getApplication()->getIdentity(); 43 44 if (!($user instanceof User) || $user->guest) { 45 $event->addResult(new \stdClass()); 46 47 return; 48 } 49 50 // I need the server to have either GMP or BCComp support to attest new authenticators 51 if (function_exists('gmp_intval') === false && function_exists('bccomp') === false) { 52 $event->addResult(new \stdClass()); 53 54 return; 55 } 56 57 $session = $this->getApplication()->getSession(); 58 $session->set('plg_system_webauthn.registration_user_id', $user->id); 59 60 $event->addResult($this->authenticationHelper->getPubKeyCreationOptions($user)); 61 } 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |