diff --git a/composer.json b/composer.json index 6db9b9ab1a12e..09d081cb215fd 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ }, "preferred-install": { "joomla/application": "dist", + "joomla/authentication": "dist", "joomla/controller": "dist", "joomla/crypt": "dist", "joomla/data": "dist", @@ -46,6 +47,7 @@ "php": ">=7.0", "joomla/application": "~2.0@dev", "joomla/archive": "~1.1.5", + "joomla/authentication": "~2.0@dev", "joomla/controller": "~2.0@dev", "joomla/crypt": "~2.0@dev", "joomla/data": "~2.0@dev", diff --git a/composer.lock b/composer.lock index eca22d9418b2b..69c84e6106afd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0dd93f548f1bb7e2372b3be78655bd06", + "content-hash": "45a034f7d5968eeb83f375414e066f4f", "packages": [ { "name": "composer/ca-bundle", @@ -379,6 +379,59 @@ ], "time": "2017-06-12T11:32:11+00:00" }, + { + "name": "joomla/authentication", + "version": "dev-2.0-dev", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/authentication.git", + "reference": "54537e5c0379bd78006f81a7c8e3c8cde53508d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/authentication/zipball/54537e5c0379bd78006f81a7c8e3c8cde53508d8", + "reference": "54537e5c0379bd78006f81a7c8e3c8cde53508d8", + "shasum": "" + }, + "require": { + "php": "~7.0" + }, + "require-dev": { + "joomla/database": "~2.0", + "joomla/input": "~1.0|~2.0", + "joomla/test": "~1.0", + "phpunit/dbunit": "~1.3|~2.0", + "phpunit/phpunit": "^5.4.3", + "squizlabs/php_codesniffer": "1.*" + }, + "suggest": { + "joomla/database": "Required if you want to use Joomla\\Authentication\\Strategies\\DatabaseStrategy", + "joomla/input": "Required if you want to use classes in the Joomla\\Authentication\\Strategies namespace" + }, + "type": "joomla-package", + "extra": { + "branch-alias": { + "dev-2.0-dev": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Joomla\\Authentication\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Authentication Package", + "homepage": "https://github.com/joomla-framework/authentication", + "keywords": [ + "Authentication", + "framework", + "joomla" + ], + "time": "2017-10-18T01:29:24+00:00" + }, { "name": "joomla/compat", "version": "1.2.0", @@ -2257,16 +2310,16 @@ }, { "name": "consolidation/config", - "version": "1.0.7", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/consolidation/config.git", - "reference": "b59a3b9ea750c21397f26a68fd2e04d9580af42e" + "reference": "a57ff3a302aac6f7e6fc0d81fe0778550a0fe9aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/config/zipball/b59a3b9ea750c21397f26a68fd2e04d9580af42e", - "reference": "b59a3b9ea750c21397f26a68fd2e04d9580af42e", + "url": "https://api.github.com/repos/consolidation/config/zipball/a57ff3a302aac6f7e6fc0d81fe0778550a0fe9aa", + "reference": "a57ff3a302aac6f7e6fc0d81fe0778550a0fe9aa", "shasum": "" }, "require": { @@ -2302,7 +2355,7 @@ } ], "description": "Provide configuration services for a commandline tool.", - "time": "2017-10-25T05:50:10+00:00" + "time": "2017-10-17T17:09:36+00:00" }, { "name": "consolidation/log", @@ -2402,16 +2455,16 @@ }, { "name": "consolidation/robo", - "version": "1.1.5", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/consolidation/Robo.git", - "reference": "aea695cebff81d54ed6daf14894738d5dac1c15c" + "reference": "ce11f3f842298ce6215c68c631af5b0420b18f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/aea695cebff81d54ed6daf14894738d5dac1c15c", - "reference": "aea695cebff81d54ed6daf14894738d5dac1c15c", + "url": "https://api.github.com/repos/consolidation/Robo/zipball/ce11f3f842298ce6215c68c631af5b0420b18f53", + "reference": "ce11f3f842298ce6215c68c631af5b0420b18f53", "shasum": "" }, "require": { @@ -2435,7 +2488,7 @@ "codeception/base": "^2.2.6", "codeception/verify": "^0.3.2", "henrikbjorn/lurker": "~1", - "natxet/cssmin": "3.0.4", + "natxet/cssmin": "~3", "patchwork/jsqueeze": "~2", "pear/archive_tar": "^1.4.2", "phpunit/php-code-coverage": "~2|~4", @@ -2477,7 +2530,7 @@ } ], "description": "Modern task runner", - "time": "2017-10-25T20:41:21+00:00" + "time": "2017-10-17T01:59:38+00:00" }, { "name": "container-interop/container-interop", @@ -2722,7 +2775,7 @@ ], "authors": [ { - "name": "Dariusz RumiƄski", + "name": "Dariusz Rumi??ski", "email": "dariusz.ruminski@gmail.com" }, { @@ -3017,12 +3070,12 @@ "source": { "type": "git", "url": "https://github.com/joomla-projects/joomla-browser.git", - "reference": "7fba550d49901faf95a1792a9ee08c924baf3d16" + "reference": "bdedf1938e8ffa5f7e2753dae93bc49229a451ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/7fba550d49901faf95a1792a9ee08c924baf3d16", - "reference": "7fba550d49901faf95a1792a9ee08c924baf3d16", + "url": "https://api.github.com/repos/joomla-projects/joomla-browser/zipball/bdedf1938e8ffa5f7e2753dae93bc49229a451ee", + "reference": "bdedf1938e8ffa5f7e2753dae93bc49229a451ee", "shasum": "" }, "require": { @@ -3060,7 +3113,7 @@ "acceptance testing", "joomla" ], - "time": "2017-09-24T14:12:21+00:00" + "time": "2017-09-26T14:11:03+00:00" }, { "name": "joomla-projects/selenium-server-standalone", @@ -5056,6 +5109,7 @@ "minimum-stability": "stable", "stability-flags": { "joomla/application": 20, + "joomla/authentication": 20, "joomla/controller": 20, "joomla/crypt": 20, "joomla/data": 20, diff --git a/installation/includes/app.php b/installation/includes/app.php index a3f46922ae134..9c60804267d46 100644 --- a/installation/includes/app.php +++ b/installation/includes/app.php @@ -44,6 +44,7 @@ ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Document) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Dispatcher) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Form) + ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Authentication) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Database); // Instantiate and execute the application diff --git a/libraries/src/Authentication/Password/Argon2iHandler.php b/libraries/src/Authentication/Password/Argon2iHandler.php new file mode 100644 index 0000000000000..c1cef0a7aeebe --- /dev/null +++ b/libraries/src/Authentication/Password/Argon2iHandler.php @@ -0,0 +1,35 @@ +handlers[] = $handler; + } + + /** + * Check if the password requires rehashing + * + * @param string $hash The password hash to check + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function checkIfRehashNeeded(string $hash): bool + { + foreach ($this->handlers as $handler) + { + if ($handler instanceof CheckIfRehashNeededHandlerInterface && $handler->isSupported() && $handler->checkIfRehashNeeded($hash)) + { + return true; + } + } + + return false; + } + + /** + * Generate a hash for a plaintext password + * + * @param string $plaintext The plaintext password to validate + * @param array $options Options for the hashing operation + * + * @return string + * + * @since __DEPLOY_VERSION__ + * @throws \RuntimeException + */ + public function hashPassword($plaintext, array $options = []) + { + throw new \RuntimeException('The chained password handler cannot be used to hash a password'); + } + + /** + * Check that the password handler is supported in this environment + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function isSupported() + { + return true; + } + + /** + * Validate a password + * + * @param string $plaintext The plain text password to validate + * @param string $hashed The password hash to validate against + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function validatePassword($plaintext, $hashed) + { + foreach ($this->handlers as $handler) + { + if ($handler->isSupported() && $handler->validatePassword($plaintext, $hashed)) + { + return true; + } + } + + return false; + } +} diff --git a/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php b/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php new file mode 100644 index 0000000000000..7c12907069302 --- /dev/null +++ b/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php @@ -0,0 +1,34 @@ +getPasswordHash()->HashPassword($plaintext); + } + + /** + * Check that the password handler is supported in this environment + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function isSupported() + { + return class_exists(\PasswordHash::class); + } + + /** + * Validate a password + * + * @param string $plaintext The plain text password to validate + * @param string $hashed The password hash to validate against + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function validatePassword($plaintext, $hashed) + { + return $this->getPasswordHash()->CheckPassword($plaintext, $hashed); + } + + /** + * Get an instance of the PasswordHash class + * + * @return \PasswordHash + * + * @since __DEPLOY_VERSION__ + */ + private function getPasswordHash(): \PasswordHash + { + return new \PasswordHash(10, true); + } +} diff --git a/libraries/src/Authentication/Password/SHA256Handler.php b/libraries/src/Authentication/Password/SHA256Handler.php new file mode 100644 index 0000000000000..94eae296c4384 --- /dev/null +++ b/libraries/src/Authentication/Password/SHA256Handler.php @@ -0,0 +1,97 @@ +hashPassword($password, ['salt' => $salt]); + + return Crypt::timingSafeCompare($hashed, $testcrypt); + } +} diff --git a/libraries/src/Factory.php b/libraries/src/Factory.php index 7b8ae36be0eb8..5bf707d3c99a1 100644 --- a/libraries/src/Factory.php +++ b/libraries/src/Factory.php @@ -516,6 +516,7 @@ protected static function createContainer() { $container = (new Container) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Application) + ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Authentication) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Database) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Dispatcher) ->registerServiceProvider(new \Joomla\CMS\Service\Provider\Form) diff --git a/libraries/src/Service/Provider/Authentication.php b/libraries/src/Service/Provider/Authentication.php new file mode 100644 index 0000000000000..ac7456a6393a2 --- /dev/null +++ b/libraries/src/Service/Provider/Authentication.php @@ -0,0 +1,115 @@ +alias('password.handler.argon2i', Argon2iHandler::class) + ->alias(BaseArgon2iHandler::class, Argon2iHandler::class) + ->share( + Argon2iHandler::class, + function (Container $container) + { + return new Argon2iHandler; + }, + true + ); + + $container->alias('password.handler.chained', ChainedHandler::class) + ->share( + ChainedHandler::class, + function (Container $container) + { + $handler = new ChainedHandler; + + // Load the chain with supported core handlers + $handler->addHandler($container->get(BCryptHandler::class)); + $handler->addHandler($container->get(Argon2iHandler::class)); + $handler->addHandler($container->get(PHPassHandler::class)); + $handler->addHandler($container->get(SHA256Handler::class)); + $handler->addHandler($container->get(MD5Handler::class)); + + return $handler; + }, + true + ); + + // The Joomla default is BCrypt so alias this service + $container->alias('password.handler.default', BCryptHandler::class) + ->alias(BaseBCryptHandler::class, BCryptHandler::class) + ->alias('password.handler.bcrypt', BCryptHandler::class) + ->share( + BCryptHandler::class, + function (Container $container) + { + return new BCryptHandler; + }, + true + ); + + $container->alias('password.handler.md5', MD5Handler::class) + ->share( + MD5Handler::class, + function (Container $container) + { + return new MD5Handler; + }, + true + ); + + $container->alias('password.handler.phpass', PHPassHandler::class) + ->share( + PHPassHandler::class, + function (Container $container) + { + return new PHPassHandler; + }, + true + ); + + $container->alias('password.handler.sha256', SHA256Handler::class) + ->share( + SHA256Handler::class, + function (Container $container) + { + return new SHA256Handler; + }, + true + ); + } +} diff --git a/libraries/src/User/UserHelper.php b/libraries/src/User/UserHelper.php index 705f994fc5832..46968d81d91d6 100644 --- a/libraries/src/User/UserHelper.php +++ b/libraries/src/User/UserHelper.php @@ -10,7 +10,15 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Authentication\Password\Argon2iHandler; +use Joomla\Authentication\Password\BCryptHandler; use Joomla\CMS\Access\Access; +use Joomla\CMS\Authentication\Password\ChainedHandler; +use Joomla\CMS\Authentication\Password\CheckIfRehashNeededHandlerInterface; +use Joomla\CMS\Authentication\Password\MD5Handler; +use Joomla\CMS\Authentication\Password\PHPassHandler; +use Joomla\CMS\Authentication\Password\SHA256Handler; +use Joomla\CMS\Factory; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Utilities\ArrayHelper; @@ -24,6 +32,52 @@ */ abstract class UserHelper { + /** + * Constant defining the Argon2i password algorithm for use with password hashes + * + * Note: The value of the hash is the same as PHP's native `PASSWORD_ARGON2I` but the constant is not used + * as PHP may not be compiled with this constant + * + * @var integer + * @since __DEPLOY_VERSION__ + */ + const HASH_ARGON2I = 2; + + /** + * Constant defining the BCrypt password algorithm for use with password hashes + * + * @var integer + * @since __DEPLOY_VERSION__ + */ + const HASH_BCRYPT = PASSWORD_BCRYPT; + + /** + * Constant defining the MD5 password algorithm for use with password hashes + * + * @var integer + * @since __DEPLOY_VERSION__ + * @deprecated 5.0 Support for MD5 hashed passwords will be removed + */ + const HASH_MD5 = 100; + + /** + * Constant defining the PHPass password algorithm for use with password hashes + * + * @var integer + * @since __DEPLOY_VERSION__ + * @deprecated 5.0 Support for PHPass hashed passwords will be removed + */ + const HASH_PHPASS = 101; + + /** + * Constant defining the SHA256 password algorithm for use with password hashes + * + * @var integer + * @since __DEPLOY_VERSION__ + * @deprecated 5.0 Support for SHA256 hashed passwords will be removed + */ + const HASH_SHA256 = 102; + /** * Method to add a user to a group. * @@ -300,15 +354,48 @@ public static function getUserId($username) /** * Hashes a password using the current encryption. * - * @param string $password The plaintext password to encrypt. + * @param string $password The plaintext password to encrypt. + * @param string|integer $algorithm The hashing algorithm to use, represented by `HASH_*` class constants, or a container service ID. + * @param array $options The options for the algorithm to use. * * @return string The encrypted password. * * @since 3.2.1 + * @throws \InvalidArgumentException when the algorithm is not supported */ - public static function hashPassword($password) + public static function hashPassword($password, $algorithm = self::HASH_BCRYPT, array $options = array()) { - return password_hash($password, PASSWORD_DEFAULT); + $container = Factory::getContainer(); + + // If the algorithm is a valid service ID, use that service to generate the hash + if ($container->has($algorithm)) + { + return $container->get($algorithm)->hashPassword($password, $options); + } + + // Try a known handler next + switch ($algorithm) + { + case self::HASH_ARGON2I : + case PASSWORD_ARGON2I : + return $container->get(Argon2iHandler::class)->hashPassword($password, $options); + + case self::HASH_BCRYPT : + case PASSWORD_BCRYPT : + return $container->get(BCryptHandler::class)->hashPassword($password, $options); + + case self::HASH_MD5 : + return $container->get(MD5Handler::class)->hashPassword($password, $options); + + case self::HASH_PHPASS : + return $container->get(PHPassHandler::class)->hashPassword($password, $options); + + case self::HASH_SHA256 : + return $container->get(SHA256Handler::class)->hashPassword($password, $options); + } + + // Unsupported algorithm, sorry! + throw new \InvalidArgumentException(sprintf('The %s algorithm is not supported for hashing passwords.', $algorithm)); } /** @@ -326,63 +413,47 @@ public static function hashPassword($password) */ public static function verifyPassword($password, $hash, $user_id = 0) { - // If we are using phpass + $passwordAlgorithm = PASSWORD_BCRYPT; + $container = Factory::getContainer(); + + // Cheaply try to determine the algorithm in use otherwise fall back to the chained handler if (strpos($hash, '$P$') === 0) { - // Use PHPass's portable hashes with a cost of 10. - $phpass = new \PasswordHash(10, true); - - $match = $phpass->CheckPassword($password, $hash); - - $rehash = true; + /** @var PHPassHandler $handler */ + $handler = $container->get(PHPassHandler::class); } - // Check for Argon2i hashes elseif (strpos($hash, '$argon2i') === 0) { - // This implementation is not supported through any existing polyfills - $match = password_verify($password, $hash); + /** @var Argon2iHandler $handler */ + $handler = $container->get(Argon2iHandler::class); - $rehash = password_needs_rehash($hash, PASSWORD_ARGON2I); + $passwordAlgorithm = PASSWORD_ARGON2I; } // Check for bcrypt hashes elseif (strpos($hash, '$2') === 0) { - $match = password_verify($password, $hash); - - $rehash = password_needs_rehash($hash, PASSWORD_BCRYPT); + /** @var BCryptHandler $handler */ + $handler = $container->get(BCryptHandler::class); } elseif (substr($hash, 0, 8) == '{SHA256}') { - // Check the password - $parts = explode(':', $hash); - $salt = @$parts[1]; - - $testcrypt = '{SHA256}' . hash('sha256', $password . $salt) . ':' . $salt; - - $match = \JCrypt::timingSafeCompare($hash, $testcrypt); - - $rehash = true; + /** @var SHA256Handler $handler */ + $handler = $container->get(SHA256Handler::class); } else { - // Check the password - $parts = explode(':', $hash); - $salt = @$parts[1]; - - $rehash = true; - - // Compile the hash to compare - // If the salt is empty AND there is a ':' in the original hash, we must append ':' at the end - $testcrypt = md5($password . $salt) . ($salt ? ':' . $salt : (strpos($hash, ':') !== false ? ':' : '')); - - $match = \JCrypt::timingSafeCompare($hash, $testcrypt); + /** @var ChainedHandler $handler */ + $handler = $container->get(ChainedHandler::class); } + $match = $handler->validatePassword($password, $hash); + $rehash = $handler instanceof CheckIfRehashNeededHandlerInterface ? $handler->checkIfRehashNeeded($hash) : false; + // If we have a match and rehash = true, rehash the password with the current algorithm. if ((int) $user_id > 0 && $match && $rehash) { $user = new User($user_id); - $user->password = static::hashPassword($password); + $user->password = static::hashPassword($password, $passwordAlgorithm); $user->save(); } diff --git a/libraries/src/User/UserWrapper.php b/libraries/src/User/UserWrapper.php index e9bb4d19e0751..9e112b9b2aa91 100644 --- a/libraries/src/User/UserWrapper.php +++ b/libraries/src/User/UserWrapper.php @@ -137,7 +137,9 @@ public function getUserId($username) /** * Helper wrapper method for hashPassword * - * @param string $password The plaintext password to encrypt. + * @param string $password The plaintext password to encrypt. + * @param integer $algorithm The hashing algorithm to use, represented by `PASSWORD_*` constants. + * @param array $options The options for the algorithm to use. * * @return string The encrypted password. * @@ -145,9 +147,9 @@ public function getUserId($username) * @since 3.4 * @deprecated 4.0 Use `Joomla\CMS\User\UserHelper` directly */ - public function hashPassword($password) + public function hashPassword($password, $algorithm = PASSWORD_BCRYPT, array $options = array()) { - return UserHelper::hashPassword($password); + return UserHelper::hashPassword($password, $algorithm, $options); } /** diff --git a/libraries/vendor/composer/autoload_classmap.php b/libraries/vendor/composer/autoload_classmap.php index b584a2447912c..019c8a21fc3b8 100644 --- a/libraries/vendor/composer/autoload_classmap.php +++ b/libraries/vendor/composer/autoload_classmap.php @@ -47,6 +47,14 @@ 'Joomla\\Archive\\Gzip' => $vendorDir . '/joomla/archive/src/Gzip.php', 'Joomla\\Archive\\Tar' => $vendorDir . '/joomla/archive/src/Tar.php', 'Joomla\\Archive\\Zip' => $vendorDir . '/joomla/archive/src/Zip.php', + 'Joomla\\Authentication\\AbstractUsernamePasswordAuthenticationStrategy' => $vendorDir . '/joomla/authentication/src/AbstractUsernamePasswordAuthenticationStrategy.php', + 'Joomla\\Authentication\\Authentication' => $vendorDir . '/joomla/authentication/src/Authentication.php', + 'Joomla\\Authentication\\AuthenticationStrategyInterface' => $vendorDir . '/joomla/authentication/src/AuthenticationStrategyInterface.php', + 'Joomla\\Authentication\\Password\\Argon2iHandler' => $vendorDir . '/joomla/authentication/src/Password/Argon2iHandler.php', + 'Joomla\\Authentication\\Password\\BCryptHandler' => $vendorDir . '/joomla/authentication/src/Password/BCryptHandler.php', + 'Joomla\\Authentication\\Password\\HandlerInterface' => $vendorDir . '/joomla/authentication/src/Password/HandlerInterface.php', + 'Joomla\\Authentication\\Strategies\\DatabaseStrategy' => $vendorDir . '/joomla/authentication/src/Strategies/DatabaseStrategy.php', + 'Joomla\\Authentication\\Strategies\\LocalStrategy' => $vendorDir . '/joomla/authentication/src/Strategies/LocalStrategy.php', 'Joomla\\CMS\\Access\\Access' => $baseDir . '/libraries/src/Access/Access.php', 'Joomla\\CMS\\Access\\Exception\\NotAllowed' => $baseDir . '/libraries/src/Access/Exception/NotAllowed.php', 'Joomla\\CMS\\Access\\Rule' => $baseDir . '/libraries/src/Access/Rule.php', @@ -68,6 +76,13 @@ 'Joomla\\CMS\\Association\\AssociationExtensionInterface' => $baseDir . '/libraries/src/Association/AssociationExtensionInterface.php', 'Joomla\\CMS\\Authentication\\Authentication' => $baseDir . '/libraries/src/Authentication/Authentication.php', 'Joomla\\CMS\\Authentication\\AuthenticationResponse' => $baseDir . '/libraries/src/Authentication/AuthenticationResponse.php', + 'Joomla\\CMS\\Authentication\\Password\\Argon2iHandler' => $baseDir . '/libraries/src/Authentication/Password/Argon2iHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\BCryptHandler' => $baseDir . '/libraries/src/Authentication/Password/BCryptHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\ChainedHandler' => $baseDir . '/libraries/src/Authentication/Password/ChainedHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\CheckIfRehashNeededHandlerInterface' => $baseDir . '/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php', + 'Joomla\\CMS\\Authentication\\Password\\MD5Handler' => $baseDir . '/libraries/src/Authentication/Password/MD5Handler.php', + 'Joomla\\CMS\\Authentication\\Password\\PHPassHandler' => $baseDir . '/libraries/src/Authentication/Password/PHPassHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\SHA256Handler' => $baseDir . '/libraries/src/Authentication/Password/SHA256Handler.php', 'Joomla\\CMS\\Cache\\Cache' => $baseDir . '/libraries/src/Cache/Cache.php', 'Joomla\\CMS\\Cache\\CacheController' => $baseDir . '/libraries/src/Cache/CacheController.php', 'Joomla\\CMS\\Cache\\CacheStorage' => $baseDir . '/libraries/src/Cache/CacheStorage.php', @@ -436,6 +451,7 @@ 'Joomla\\CMS\\Schema\\ChangeItem\\SqlsrvChangeItem' => $baseDir . '/libraries/src/Schema/ChangeItem/SqlsrvChangeItem.php', 'Joomla\\CMS\\Schema\\ChangeSet' => $baseDir . '/libraries/src/Schema/ChangeSet.php', 'Joomla\\CMS\\Service\\Provider\\Application' => $baseDir . '/libraries/src/Service/Provider/Application.php', + 'Joomla\\CMS\\Service\\Provider\\Authentication' => $baseDir . '/libraries/src/Service/Provider/Authentication.php', 'Joomla\\CMS\\Service\\Provider\\Database' => $baseDir . '/libraries/src/Service/Provider/Database.php', 'Joomla\\CMS\\Service\\Provider\\Dispatcher' => $baseDir . '/libraries/src/Service/Provider/Dispatcher.php', 'Joomla\\CMS\\Service\\Provider\\Document' => $baseDir . '/libraries/src/Service/Provider/Document.php', @@ -626,6 +642,7 @@ 'Joomla\\Input\\Input' => $vendorDir . '/joomla/input/src/Input.php', 'Joomla\\Input\\Json' => $vendorDir . '/joomla/input/src/Json.php', 'Joomla\\Ldap\\LdapClient' => $vendorDir . '/joomla/ldap/src/LdapClient.php', + 'Joomla\\Ldap\\Tests\\LdapClientTest' => $vendorDir . '/joomla/ldap/Tests/LdapClientTest.php', 'Joomla\\OAuth1\\Client' => $vendorDir . '/joomla/oauth1/src/Client.php', 'Joomla\\OAuth2\\Client' => $vendorDir . '/joomla/oauth2/src/Client.php', 'Joomla\\Registry\\Factory' => $vendorDir . '/joomla/registry/src/Factory.php', @@ -693,6 +710,8 @@ 'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php', 'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php', 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php', + 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'ReCaptcha\\ReCaptcha' => $vendorDir . '/google/recaptcha/src/ReCaptcha/ReCaptcha.php', 'ReCaptcha\\RequestMethod' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod.php', 'ReCaptcha\\RequestMethod\\Curl' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php', @@ -720,6 +739,7 @@ 'Symfony\\Polyfill\\Util\\Binary' => $vendorDir . '/symfony/polyfill-util/Binary.php', 'Symfony\\Polyfill\\Util\\BinaryNoFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryNoFuncOverload.php', 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryOnFuncOverload.php', + 'Symfony\\Polyfill\\Util\\TestListener' => $vendorDir . '/symfony/polyfill-util/TestListener.php', 'Zend\\Diactoros\\AbstractSerializer' => $vendorDir . '/zendframework/zend-diactoros/src/AbstractSerializer.php', 'Zend\\Diactoros\\CallbackStream' => $vendorDir . '/zendframework/zend-diactoros/src/CallbackStream.php', 'Zend\\Diactoros\\Exception\\DeprecatedMethodException' => $vendorDir . '/zendframework/zend-diactoros/src/Exception/DeprecatedMethodException.php', diff --git a/libraries/vendor/composer/autoload_psr4.php b/libraries/vendor/composer/autoload_psr4.php index b40701bd2c9b7..285a429e8ee94 100644 --- a/libraries/vendor/composer/autoload_psr4.php +++ b/libraries/vendor/composer/autoload_psr4.php @@ -39,6 +39,7 @@ 'Joomla\\Crypt\\' => array($vendorDir . '/joomla/crypt/src'), 'Joomla\\Controller\\' => array($vendorDir . '/joomla/controller/src'), 'Joomla\\CMS\\' => array($baseDir . '/libraries/src'), + 'Joomla\\Authentication\\' => array($vendorDir . '/joomla/authentication/src'), 'Joomla\\Archive\\' => array($vendorDir . '/joomla/archive/src'), 'Joomla\\Application\\' => array($vendorDir . '/joomla/application/src'), 'Fig\\Link\\' => array($vendorDir . '/fig/link-util/src'), diff --git a/libraries/vendor/composer/autoload_static.php b/libraries/vendor/composer/autoload_static.php index 4170435eef41b..69e8609ed0968 100644 --- a/libraries/vendor/composer/autoload_static.php +++ b/libraries/vendor/composer/autoload_static.php @@ -76,6 +76,7 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Joomla\\Crypt\\' => 13, 'Joomla\\Controller\\' => 18, 'Joomla\\CMS\\' => 11, + 'Joomla\\Authentication\\' => 22, 'Joomla\\Archive\\' => 15, 'Joomla\\Application\\' => 19, ), @@ -226,6 +227,10 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 array ( 0 => __DIR__ . '/../../..' . '/libraries/src', ), + 'Joomla\\Authentication\\' => + array ( + 0 => __DIR__ . '/..' . '/joomla/authentication/src', + ), 'Joomla\\Archive\\' => array ( 0 => __DIR__ . '/..' . '/joomla/archive/src', @@ -290,6 +295,14 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Joomla\\Archive\\Gzip' => __DIR__ . '/..' . '/joomla/archive/src/Gzip.php', 'Joomla\\Archive\\Tar' => __DIR__ . '/..' . '/joomla/archive/src/Tar.php', 'Joomla\\Archive\\Zip' => __DIR__ . '/..' . '/joomla/archive/src/Zip.php', + 'Joomla\\Authentication\\AbstractUsernamePasswordAuthenticationStrategy' => __DIR__ . '/..' . '/joomla/authentication/src/AbstractUsernamePasswordAuthenticationStrategy.php', + 'Joomla\\Authentication\\Authentication' => __DIR__ . '/..' . '/joomla/authentication/src/Authentication.php', + 'Joomla\\Authentication\\AuthenticationStrategyInterface' => __DIR__ . '/..' . '/joomla/authentication/src/AuthenticationStrategyInterface.php', + 'Joomla\\Authentication\\Password\\Argon2iHandler' => __DIR__ . '/..' . '/joomla/authentication/src/Password/Argon2iHandler.php', + 'Joomla\\Authentication\\Password\\BCryptHandler' => __DIR__ . '/..' . '/joomla/authentication/src/Password/BCryptHandler.php', + 'Joomla\\Authentication\\Password\\HandlerInterface' => __DIR__ . '/..' . '/joomla/authentication/src/Password/HandlerInterface.php', + 'Joomla\\Authentication\\Strategies\\DatabaseStrategy' => __DIR__ . '/..' . '/joomla/authentication/src/Strategies/DatabaseStrategy.php', + 'Joomla\\Authentication\\Strategies\\LocalStrategy' => __DIR__ . '/..' . '/joomla/authentication/src/Strategies/LocalStrategy.php', 'Joomla\\CMS\\Access\\Access' => __DIR__ . '/../../..' . '/libraries/src/Access/Access.php', 'Joomla\\CMS\\Access\\Exception\\NotAllowed' => __DIR__ . '/../../..' . '/libraries/src/Access/Exception/NotAllowed.php', 'Joomla\\CMS\\Access\\Rule' => __DIR__ . '/../../..' . '/libraries/src/Access/Rule.php', @@ -311,6 +324,13 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Joomla\\CMS\\Association\\AssociationExtensionInterface' => __DIR__ . '/../../..' . '/libraries/src/Association/AssociationExtensionInterface.php', 'Joomla\\CMS\\Authentication\\Authentication' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Authentication.php', 'Joomla\\CMS\\Authentication\\AuthenticationResponse' => __DIR__ . '/../../..' . '/libraries/src/Authentication/AuthenticationResponse.php', + 'Joomla\\CMS\\Authentication\\Password\\Argon2iHandler' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/Argon2iHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\BCryptHandler' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/BCryptHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\ChainedHandler' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/ChainedHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\CheckIfRehashNeededHandlerInterface' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/CheckIfRehashNeededHandlerInterface.php', + 'Joomla\\CMS\\Authentication\\Password\\MD5Handler' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/MD5Handler.php', + 'Joomla\\CMS\\Authentication\\Password\\PHPassHandler' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/PHPassHandler.php', + 'Joomla\\CMS\\Authentication\\Password\\SHA256Handler' => __DIR__ . '/../../..' . '/libraries/src/Authentication/Password/SHA256Handler.php', 'Joomla\\CMS\\Cache\\Cache' => __DIR__ . '/../../..' . '/libraries/src/Cache/Cache.php', 'Joomla\\CMS\\Cache\\CacheController' => __DIR__ . '/../../..' . '/libraries/src/Cache/CacheController.php', 'Joomla\\CMS\\Cache\\CacheStorage' => __DIR__ . '/../../..' . '/libraries/src/Cache/CacheStorage.php', @@ -679,6 +699,7 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Joomla\\CMS\\Schema\\ChangeItem\\SqlsrvChangeItem' => __DIR__ . '/../../..' . '/libraries/src/Schema/ChangeItem/SqlsrvChangeItem.php', 'Joomla\\CMS\\Schema\\ChangeSet' => __DIR__ . '/../../..' . '/libraries/src/Schema/ChangeSet.php', 'Joomla\\CMS\\Service\\Provider\\Application' => __DIR__ . '/../../..' . '/libraries/src/Service/Provider/Application.php', + 'Joomla\\CMS\\Service\\Provider\\Authentication' => __DIR__ . '/../../..' . '/libraries/src/Service/Provider/Authentication.php', 'Joomla\\CMS\\Service\\Provider\\Database' => __DIR__ . '/../../..' . '/libraries/src/Service/Provider/Database.php', 'Joomla\\CMS\\Service\\Provider\\Dispatcher' => __DIR__ . '/../../..' . '/libraries/src/Service/Provider/Dispatcher.php', 'Joomla\\CMS\\Service\\Provider\\Document' => __DIR__ . '/../../..' . '/libraries/src/Service/Provider/Document.php', @@ -869,6 +890,7 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Joomla\\Input\\Input' => __DIR__ . '/..' . '/joomla/input/src/Input.php', 'Joomla\\Input\\Json' => __DIR__ . '/..' . '/joomla/input/src/Json.php', 'Joomla\\Ldap\\LdapClient' => __DIR__ . '/..' . '/joomla/ldap/src/LdapClient.php', + 'Joomla\\Ldap\\Tests\\LdapClientTest' => __DIR__ . '/..' . '/joomla/ldap/Tests/LdapClientTest.php', 'Joomla\\OAuth1\\Client' => __DIR__ . '/..' . '/joomla/oauth1/src/Client.php', 'Joomla\\OAuth2\\Client' => __DIR__ . '/..' . '/joomla/oauth2/src/Client.php', 'Joomla\\Registry\\Factory' => __DIR__ . '/..' . '/joomla/registry/src/Factory.php', @@ -936,6 +958,8 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php', 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php', 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', + 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', + 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'ReCaptcha\\ReCaptcha' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/ReCaptcha.php', 'ReCaptcha\\RequestMethod' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod.php', 'ReCaptcha\\RequestMethod\\Curl' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php', @@ -963,6 +987,7 @@ class ComposerStaticInit74ef86c5f34c77e33c93ad0a7df1d823 'Symfony\\Polyfill\\Util\\Binary' => __DIR__ . '/..' . '/symfony/polyfill-util/Binary.php', 'Symfony\\Polyfill\\Util\\BinaryNoFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryNoFuncOverload.php', 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryOnFuncOverload.php', + 'Symfony\\Polyfill\\Util\\TestListener' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListener.php', 'Zend\\Diactoros\\AbstractSerializer' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/AbstractSerializer.php', 'Zend\\Diactoros\\CallbackStream' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/CallbackStream.php', 'Zend\\Diactoros\\Exception\\DeprecatedMethodException' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/Exception/DeprecatedMethodException.php', diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 50e0ca770a369..4efb6b57ac3a6 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -2073,6 +2073,61 @@ "description": "Symfony Yaml Component", "homepage": "https://symfony.com" }, + { + "name": "joomla/authentication", + "version": "dev-2.0-dev", + "version_normalized": "dev-2.0-dev", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/authentication.git", + "reference": "54537e5c0379bd78006f81a7c8e3c8cde53508d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/authentication/zipball/54537e5c0379bd78006f81a7c8e3c8cde53508d8", + "reference": "54537e5c0379bd78006f81a7c8e3c8cde53508d8", + "shasum": "" + }, + "require": { + "php": "~7.0" + }, + "require-dev": { + "joomla/database": "~2.0", + "joomla/input": "~1.0|~2.0", + "joomla/test": "~1.0", + "phpunit/dbunit": "~1.3|~2.0", + "phpunit/phpunit": "^5.4.3", + "squizlabs/php_codesniffer": "1.*" + }, + "suggest": { + "joomla/database": "Required if you want to use Joomla\\Authentication\\Strategies\\DatabaseStrategy", + "joomla/input": "Required if you want to use classes in the Joomla\\Authentication\\Strategies namespace" + }, + "time": "2017-10-18T01:29:24+00:00", + "type": "joomla-package", + "extra": { + "branch-alias": { + "dev-2.0-dev": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Joomla\\Authentication\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Authentication Package", + "homepage": "https://github.com/joomla-framework/authentication", + "keywords": [ + "Authentication", + "framework", + "joomla" + ] + }, { "name": "google/recaptcha", "version": "1.1.3", diff --git a/libraries/vendor/joomla/authentication/LICENSE b/libraries/vendor/joomla/authentication/LICENSE new file mode 100644 index 0000000000000..1837b0acbe169 --- /dev/null +++ b/libraries/vendor/joomla/authentication/LICENSE @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/libraries/vendor/joomla/authentication/src/AbstractUsernamePasswordAuthenticationStrategy.php b/libraries/vendor/joomla/authentication/src/AbstractUsernamePasswordAuthenticationStrategy.php new file mode 100644 index 0000000000000..6c35964885123 --- /dev/null +++ b/libraries/vendor/joomla/authentication/src/AbstractUsernamePasswordAuthenticationStrategy.php @@ -0,0 +1,120 @@ +passwordHandler = $passwordHandler ?: new BCryptHandler; + } + + /** + * Attempt to authenticate the username and password pair. + * + * @param string $username The username to authenticate. + * @param string $password The password to attempt authentication with. + * + * @return string|boolean A string containing a username if authentication is successful, false otherwise. + * + * @since 1.1.0 + */ + protected function doAuthenticate($username, $password) + { + $hashedPassword = $this->getHashedPassword($username); + + if ($hashedPassword === false) + { + $this->status = Authentication::NO_SUCH_USER; + + return false; + } + + if (!$this->verifyPassword($username, $password, $hashedPassword)) + { + $this->status = Authentication::INVALID_CREDENTIALS; + + return false; + } + + $this->status = Authentication::SUCCESS; + + return $username; + } + + /** + * Retrieve the hashed password for the specified user. + * + * @param string $username Username to lookup. + * + * @return string|boolean Hashed password on success or boolean false on failure. + * + * @since 1.1.0 + */ + abstract protected function getHashedPassword($username); + + /** + * Get the status of the last authentication attempt. + * + * @return integer Authentication class constant result. + * + * @since 1.1.0 + */ + public function getResult() + { + return $this->status; + } + + /** + * Attempt to verify the username and password pair. + * + * @param string $username The username to authenticate. + * @param string $password The password to attempt authentication with. + * @param string $hashedPassword The hashed password to attempt authentication against. + * + * @return boolean + * + * @since 1.1.0 + */ + protected function verifyPassword($username, $password, $hashedPassword) + { + return $this->passwordHandler->validatePassword($password, $hashedPassword); + } +} diff --git a/libraries/vendor/joomla/authentication/src/Authentication.php b/libraries/vendor/joomla/authentication/src/Authentication.php new file mode 100644 index 0000000000000..06cdef5653fff --- /dev/null +++ b/libraries/vendor/joomla/authentication/src/Authentication.php @@ -0,0 +1,149 @@ +strategies[$strategyName] = $strategy; + } + + /** + * Perform authentication + * + * @param AuthenticationStrategyInterface[] $strategies Array of strategies to try - empty to try all strategies. + * + * @return string|boolean A string containing a username if authentication is successful, false otherwise. + * + * @since 1.0 + * @throws \RuntimeException + */ + public function authenticate(array $strategies = []) + { + if (empty($strategies)) + { + $strategyObjects = $this->strategies; + } + else + { + $strategyObjects = []; + + foreach ($strategies as $strategy) + { + if (!isset($this->strategies[$strategy])) + { + throw new \RuntimeException('Authentication Strategy Not Found'); + } + + $strategyObjects[$strategy] = $this->strategies[$strategy]; + } + } + + if (empty($strategyObjects)) + { + throw new \RuntimeException('No strategies have been set'); + } + + /** @var AuthenticationStrategyInterface $strategyObject */ + foreach ($strategyObjects as $strategy => $strategyObject) + { + $username = $strategyObject->authenticate(); + + $this->results[$strategy] = $strategyObject->getResult(); + + if (is_string($username)) + { + return $username; + } + } + + return false; + } + + /** + * Get authentication results. + * + * Use this if you want to get more detailed information about the results of an authentication attempts. + * + * @return integer[] An array containing authentication results. + * + * @since 1.0 + */ + public function getResults() + { + return $this->results; + } +} diff --git a/libraries/vendor/joomla/authentication/src/AuthenticationStrategyInterface.php b/libraries/vendor/joomla/authentication/src/AuthenticationStrategyInterface.php new file mode 100644 index 0000000000000..c03f9c8056b23 --- /dev/null +++ b/libraries/vendor/joomla/authentication/src/AuthenticationStrategyInterface.php @@ -0,0 +1,35 @@ +=') && defined('PASSWORD_ARGON2I')) + { + return password_hash($plaintext, PASSWORD_ARGON2I, $options); + } + + // Use the sodium extension (PHP 7.2 native or PECL 2.x) if able + if (function_exists('sodium_crypto_pwhash_str_verify')) + { + $hash = sodium_crypto_pwhash_str( + $plaintext, + SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, + SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE + ); + sodium_memzero($plaintext); + + return $hash; + } + + // Use the libsodium extension (PECL 1.x) if able + if (extension_loaded('libsodium')) + { + $hash = \Sodium\crypto_pwhash_str( + $plaintext, + \Sodium\CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, + \Sodium\CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE + ); + \Sodium\memzero($plaintext); + + return $hash; + } + + throw new \LogicException('Argon2i algorithm is not supported.'); + } + + /** + * Check that the password handler is supported in this environment + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function isSupported() + { + // Check for native PHP engine support in the password extension then fall back to support in the sodium extension + return (version_compare(PHP_VERSION, '7.2', '>=') && defined('PASSWORD_ARGON2I')) + || function_exists('sodium_crypto_pwhash_str') + || extension_loaded('libsodium'); + } + + /** + * Validate a password + * + * @param string $plaintext The plain text password to validate + * @param string $hashed The password hash to validate against + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + * @throws \LogicException + */ + public function validatePassword($plaintext, $hashed) + { + // Use the password extension if able + if (version_compare(PHP_VERSION, '7.2', '>=') && defined('PASSWORD_ARGON2I')) + { + return password_verify($plaintext, $hashed); + } + + // Use the sodium extension (PHP 7.2 native or PECL 2.x) if able + if (function_exists('sodium_crypto_pwhash_str_verify')) + { + $valid = sodium_crypto_pwhash_str_verify($hashed, $plaintext); + sodium_memzero($plaintext); + + return $valid; + } + + // Use the libsodium extension (PECL 1.x) if able + if (extension_loaded('libsodium')) + { + $valid = \Sodium\crypto_pwhash_str_verify($hashed, $plaintext); + \Sodium\memzero($plaintext); + + return $valid; + } + + throw new \LogicException('Argon2i algorithm is not supported.'); + } +} diff --git a/libraries/vendor/joomla/authentication/src/Password/BCryptHandler.php b/libraries/vendor/joomla/authentication/src/Password/BCryptHandler.php new file mode 100644 index 0000000000000..881fd28b889bc --- /dev/null +++ b/libraries/vendor/joomla/authentication/src/Password/BCryptHandler.php @@ -0,0 +1,60 @@ +input = $input; + $this->db = $database; + + $options['database_table'] = $options['database_table'] ?? '#__users'; + $options['username_column'] = $options['username_column'] ?? 'username'; + $options['password_column'] = $options['password_column'] ?? 'password'; + + $this->dbOptions = $options; + } + + /** + * Attempt to authenticate the username and password pair. + * + * @return string|boolean A string containing a username if authentication is successful, false otherwise. + * + * @since 1.1.0 + */ + public function authenticate() + { + $username = $this->input->get('username', false, 'username'); + $password = $this->input->get('password', false, 'raw'); + + if (!$username || !$password) + { + $this->status = Authentication::NO_CREDENTIALS; + + return false; + } + + return $this->doAuthenticate($username, $password); + } + + /** + * Retrieve the hashed password for the specified user. + * + * @param string $username Username to lookup. + * + * @return string|boolean Hashed password on success or boolean false on failure. + * + * @since 1.1.0 + */ + protected function getHashedPassword($username) + { + try + { + $password = $this->db->setQuery( + $this->db->getQuery(true) + ->select($this->dbOptions['password_column']) + ->from($this->dbOptions['database_table']) + ->where($this->dbOptions['username_column'] . ' = ' . $this->db->quote($username)) + )->loadResult(); + } + catch (\RuntimeException $exception) + { + return false; + } + + if (!$password) + { + return false; + } + + return $password; + } +} diff --git a/libraries/vendor/joomla/authentication/src/Strategies/LocalStrategy.php b/libraries/vendor/joomla/authentication/src/Strategies/LocalStrategy.php new file mode 100644 index 0000000000000..e12c2cd0b9842 --- /dev/null +++ b/libraries/vendor/joomla/authentication/src/Strategies/LocalStrategy.php @@ -0,0 +1,91 @@ +credentialStore = $credentialStore; + $this->input = $input; + } + + /** + * Attempt to authenticate the username and password pair. + * + * @return string|boolean A string containing a username if authentication is successful, false otherwise. + * + * @since 1.0 + */ + public function authenticate() + { + $username = $this->input->get('username', false, 'username'); + $password = $this->input->get('password', false, 'raw'); + + if (!$username || !$password) + { + $this->status = Authentication::NO_CREDENTIALS; + + return false; + } + + return $this->doAuthenticate($username, $password); + } + + /** + * Retrieve the hashed password for the specified user. + * + * @param string $username Username to lookup. + * + * @return string|boolean Hashed password on success or boolean false on failure. + * + * @since 1.1.0 + */ + protected function getHashedPassword($username) + { + return $this->credentialStore[$username] ?? false; + } +} diff --git a/tests/unit/suites/libraries/joomla/user/JUserHelperTest.php b/tests/unit/suites/libraries/joomla/user/JUserHelperTest.php index 12dca10009e3f..1c6b6e2c296a9 100644 --- a/tests/unit/suites/libraries/joomla/user/JUserHelperTest.php +++ b/tests/unit/suites/libraries/joomla/user/JUserHelperTest.php @@ -335,6 +335,29 @@ public function testHashPassword() ); } + /** + * Testing hashPassword() for argon2i hashing support. + * + * @covers JUserHelper::hashPassword + * @return void + * + * @since __DEPLOY_VERSION__ + * @requires PHP 7.2 + */ + public function testHashPasswordArgon2i() + { + if (!defined('PASSWORD_ARGON2I')) + { + $this->markTestSkipped('Argon2i algorithm not supported.'); + } + + $this->assertEquals( + strpos(JUserHelper::hashPassword('mySuperSecretPassword', PASSWORD_ARGON2I), '$argon2i'), + 0, + 'The password is hashed using the specified hashing algorithm' + ); + } + /** * Test cases for testVerifyPassword *