[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Service\Provider; 11 12 use Joomla\Authentication\Password\Argon2idHandler as BaseArgon2idHandler; 13 use Joomla\Authentication\Password\Argon2iHandler as BaseArgon2iHandler; 14 use Joomla\Authentication\Password\BCryptHandler as BaseBCryptHandler; 15 use Joomla\CMS\Authentication\Password\Argon2idHandler; 16 use Joomla\CMS\Authentication\Password\Argon2iHandler; 17 use Joomla\CMS\Authentication\Password\BCryptHandler; 18 use Joomla\CMS\Authentication\Password\ChainedHandler; 19 use Joomla\CMS\Authentication\Password\MD5Handler; 20 use Joomla\CMS\Authentication\Password\PHPassHandler; 21 use Joomla\DI\Container; 22 use Joomla\DI\ServiceProviderInterface; 23 24 // phpcs:disable PSR1.Files.SideEffects 25 \defined('JPATH_PLATFORM') or die; 26 // phpcs:enable PSR1.Files.SideEffects 27 28 /** 29 * Service provider for the authentication dependencies 30 * 31 * @since 4.0.0 32 */ 33 class Authentication implements ServiceProviderInterface 34 { 35 /** 36 * Registers the service provider with a DI container. 37 * 38 * @param Container $container The DI container. 39 * 40 * @return void 41 * 42 * @since 4.0.0 43 */ 44 public function register(Container $container) 45 { 46 $container->alias('password.handler.argon2i', Argon2iHandler::class) 47 ->alias(BaseArgon2iHandler::class, Argon2iHandler::class) 48 ->share( 49 Argon2iHandler::class, 50 function (Container $container) { 51 return new Argon2iHandler(); 52 }, 53 true 54 ); 55 56 $container->alias('password.handler.argon2id', Argon2idHandler::class) 57 ->alias(BaseArgon2idHandler::class, Argon2idHandler::class) 58 ->share( 59 Argon2idHandler::class, 60 function (Container $container) { 61 return new Argon2idHandler(); 62 }, 63 true 64 ); 65 66 $container->alias('password.handler.chained', ChainedHandler::class) 67 ->share( 68 ChainedHandler::class, 69 function (Container $container) { 70 $handler = new ChainedHandler(); 71 72 // Load the chain with supported core handlers 73 $handler->addHandler($container->get(BCryptHandler::class)); 74 75 if (Argon2iHandler::isSupported()) { 76 $handler->addHandler($container->get(Argon2iHandler::class)); 77 } 78 79 if (Argon2idHandler::isSupported()) { 80 $handler->addHandler($container->get(Argon2idHandler::class)); 81 } 82 83 $handler->addHandler($container->get(PHPassHandler::class)); 84 $handler->addHandler($container->get(MD5Handler::class)); 85 86 return $handler; 87 }, 88 true 89 ); 90 91 // The Joomla default is BCrypt so alias this service 92 $container->alias('password.handler.default', BCryptHandler::class) 93 ->alias(BaseBCryptHandler::class, BCryptHandler::class) 94 ->alias('password.handler.bcrypt', BCryptHandler::class) 95 ->share( 96 BCryptHandler::class, 97 function (Container $container) { 98 return new BCryptHandler(); 99 }, 100 true 101 ); 102 103 $container->alias('password.handler.md5', MD5Handler::class) 104 ->share( 105 MD5Handler::class, 106 function (Container $container) { 107 @trigger_error( 108 sprintf( 109 'The "%1$s" class service is deprecated, use the "%2$s" service for the active password handler instead.', 110 MD5Handler::class, 111 'password.handler.default' 112 ), 113 E_USER_DEPRECATED 114 ); 115 116 return new MD5Handler(); 117 }, 118 true 119 ); 120 121 $container->alias('password.handler.phpass', PHPassHandler::class) 122 ->share( 123 PHPassHandler::class, 124 function (Container $container) { 125 @trigger_error( 126 sprintf( 127 'The "%1$s" class service is deprecated, use the "%2$s" service for the active password handler instead.', 128 PHPassHandler::class, 129 'password.handler.default' 130 ), 131 E_USER_DEPRECATED 132 ); 133 134 return new PHPassHandler(); 135 }, 136 true 137 ); 138 } 139 }
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 |