1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 07:08:09 +01:00

[feature/passwords] Modify passwords files for namespacing changes

PHPBB3-11610
This commit is contained in:
Marc Alexander 2013-09-27 11:16:47 +02:00
parent e41c9ef6cd
commit 3f63b9b470
10 changed files with 44 additions and 26 deletions

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,12 +20,12 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
abstract class phpbb_passwords_driver_base implements phpbb_passwords_driver_interface
abstract class base implements \phpbb\passwords\driver\driver_interface
{
/** @var phpbb_config */
/** @var phpbb\config\config */
protected $config;
/** @var phpbb_passwords_driver_helper */
/** @var phpbb\passwords\driver\helper */
protected $helper;
/** @var driver name */
@ -34,7 +36,7 @@ abstract class phpbb_passwords_driver_base implements phpbb_passwords_driver_int
*
* @return string Hash prefix
*/
public function __construct(phpbb_config $config, phpbb_passwords_driver_helper $helper)
public function __construct(\phpbb\config\config $config, \phpbb\passwords\driver\helper $helper)
{
$this->config = $config;
$this->helper = $helper;

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_driver_bcrypt extends phpbb_passwords_driver_base
class bcrypt extends \phpbb\passwords\driver\base
{
const PREFIX = '$2a$';

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_driver_bcrypt_2y extends phpbb_passwords_driver_bcrypt
class bcrypt_2y extends \phpbb\passwords\driver\bcrypt
{
const PREFIX = '$2y$';

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
interface phpbb_passwords_driver_interface
interface driver_interface
{
/**
* Check if hash type is supported

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_driver_helper
class helper
{
/**
* base64 alphabet

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_driver_phpass extends phpbb_passwords_driver_salted_md5
class phpass extends \phpbb\passwords\driver\salted_md5
{
const PREFIX = '$P$';

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords\driver;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_driver_salted_md5 extends phpbb_passwords_driver_base
class salted_md5 extends \phpbb\passwords\driver\base
{
const PREFIX = '$H$';

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_helper
class helper
{
/**
* @var phpbb_passwords_manager
@ -30,7 +32,7 @@ class phpbb_passwords_helper
*
* @param phpbb_passwords_manager $manager Crypto manager object
*/
public function set_manager(phpbb_passwords_manager $manager)
public function set_manager(\phpbb\passwords\manager $manager)
{
if ($this->manager === null)
{

View File

@ -7,6 +7,8 @@
*
*/
namespace phpbb\passwords;
/**
* @ignore
*/
@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* @package passwords
*/
class phpbb_passwords_manager
class manager
{
/**
* Default hashing method
@ -57,10 +59,10 @@ class phpbb_passwords_manager
/**
* Construct a passwords object
*
* @param phpbb_config $config phpBB configuration
* @param phpbb_di_service_collection $hashing_algorithms Hashing driver
* @param phpbb\config\config $config phpBB configuration
* @param phpbb\di\service_collection $hashing_algorithms Hashing driver
* service collection
* @param phpbb_passwords_helper $helper Passwords helper object
* @param phpbb\passwords\helper $helper Passwords helper object
* @param string $default Default driver name
*/
public function __construct($config, $hashing_algorithms, $helper, $default)
@ -75,7 +77,7 @@ class phpbb_passwords_manager
/**
* Fill algorithm type map
*
* @param phpbb_di_service_collection $hashing_algorithms
* @param phpbb\di\service_collection $hashing_algorithms
*/
protected function fill_type_map($hashing_algorithms)
{
@ -96,7 +98,7 @@ class phpbb_passwords_manager
/**
* Load passwords helper class
*
* @param phpbb_passwords_helper $helper Passwords helper object
* @param phpbb\passwords\helper $helper Passwords helper object
*/
protected function load_passwords_helper($helper)
{

View File

@ -25,14 +25,14 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
$this->phpbb_container = new phpbb_mock_container_builder;
// Prepare dependencies for manager and driver
$config = new phpbb_config(array());
$driver_helper = new phpbb_passwords_driver_helper;
$config = new \phpbb\config\config(array());
$driver_helper = new phpbb\passwords\driver\helper;
$this->passwords_drivers = array(
'passwords.driver.bcrypt' => new phpbb_passwords_driver_bcrypt($config, $driver_helper),
'passwords.driver.bcrypt_2y' => new phpbb_passwords_driver_bcrypt_2y($config, $driver_helper),
'passwords.driver.salted_md5' => new phpbb_passwords_driver_salted_md5($config, $driver_helper),
'passwords.driver.phpass' => new phpbb_passwords_driver_phpass($config, $driver_helper),
'passwords.driver.bcrypt' => new phpbb\passwords\driver\bcrypt($config, $driver_helper),
'passwords.driver.bcrypt_2y' => new phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
'passwords.driver.salted_md5' => new phpbb\passwords\driver\salted_md5($config, $driver_helper),
'passwords.driver.phpass' => new phpbb\passwords\driver\phpass($config, $driver_helper),
);
foreach ($this->passwords_drivers as $key => $driver)
@ -41,9 +41,9 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
$this->phpbb_container->set($key, $driver);
}
$this->helper = new phpbb_passwords_helper;
$this->helper = new phpbb\passwords\helper;
// Set up passwords manager
$this->manager = new phpbb_passwords_manager($config, $this->passwords_drivers, $this->helper, 'passwords.driver.bcrypt_2y');
$this->manager = new phpbb\passwords\manager($config, $this->passwords_drivers, $this->helper, 'passwords.driver.bcrypt_2y');
}
public function hash_password_data()