diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml index cc782376fc..e1c289334e 100644 --- a/phpBB/config/auth_providers.yml +++ b/phpBB/config/auth_providers.yml @@ -36,7 +36,7 @@ services: tags: - { name: auth.provider } auth.provider.oauth: - class: phpbb_auth_provider_oauth + class: phpbb\auth\provider\oauth\oauth arguments: - @dbal.conn - @config @@ -51,27 +51,27 @@ services: tags: - { name: auth.provider } auth.provider.oauth.service_collection: - class: phpbb_di_service_collection + class: phpbb\di\service_collection arguments: - @service_container tags: - { name: service_collection, tag: auth.provider.oauth.service } auth.provider.oauth.service.bitly: - class: phpbb_auth_provider_oauth_service_bitly + class: phpbb\auth\provider\oauth\service\bitly arguments: - @config - @request tags: - { name: auth.provider.oauth.service } auth.provider.oauth.service.facebook: - class: phpbb_auth_provider_oauth_service_facebook + class: phpbb\auth\provider\oauth\service\facebook arguments: - @config - @request tags: - { name: auth.provider.oauth.service } auth.provider.oauth.service.google: - class: phpbb_auth_provider_oauth_service_google + class: phpbb\auth\provider\oauth\service\google arguments: - @config - @request diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index e92462b344..de81ac0d04 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -30,7 +30,7 @@ class oauth extends \phpbb\auth\provider\base /** * Database driver * - * @var \phpbb\db\driver + * @var \phpbb\db\driver\driver */ protected $db; @@ -107,7 +107,7 @@ class oauth extends \phpbb\auth\provider\base /** * OAuth Authentication Constructor * - * @param \phpbb\db\driver $db + * @param \phpbb\db\driver\driver $db * @param \phpbb\config\config $config * @param \phpbb\request\request_interface $request * @param \phpbb\user $user @@ -118,7 +118,7 @@ class oauth extends \phpbb\auth\provider\base * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; diff --git a/phpBB/phpbb/auth/provider/oauth/service/base.php b/phpBB/phpbb/auth/provider/oauth/service/base.php index 1eb49b4265..61deb48695 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/base.php +++ b/phpBB/phpbb/auth/provider/oauth/service/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -abstract class phpbb_auth_provider_oauth_service_base implements phpbb_auth_provider_oauth_service_interface +abstract class base implements \phpbb\auth\provider\oauth\service\service_interface { /** * External OAuth service provider diff --git a/phpBB/phpbb/auth/provider/oauth/service/facebook.php b/phpBB/phpbb/auth/provider/oauth/service/facebook.php index 49206b7654..4a4eeba6d5 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/facebook.php +++ b/phpBB/phpbb/auth/provider/oauth/service/facebook.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,29 +22,29 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oauth_service_base +class facebook extends base { /** * phpBB config * - * @var phpbb_config + * @var phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb_request + * @var phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb_config $config - * @param phpbb_request $request + * @param phpbb\config\config $config + * @param phpbb\request\request_interface $request */ - public function __construct(phpbb_config $config, phpbb_request $request) + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { $this->config = $config; $this->request = $request; @@ -66,7 +68,7 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // This was a callback request, get the token @@ -86,7 +88,7 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // Send a request with it diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php index d4ef6e1d42..2449bbf523 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/google.php +++ b/phpBB/phpbb/auth/provider/oauth/service/google.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,29 +22,29 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth_service_base +class google extends base { /** * phpBB config * - * @var phpbb_config + * @var phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb_request + * @var phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb_config $config - * @param phpbb_request $request + * @param phpbb\config\config $config + * @param phpbb\request\request_interface $request */ - public function __construct(phpbb_config $config, phpbb_request $request) + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { $this->config = $config; $this->request = $request; @@ -77,7 +79,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // This was a callback request, get the token @@ -97,7 +99,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // Send a request with it diff --git a/phpBB/phpbb/auth/provider/oauth/service/interface.php b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php similarity index 90% rename from phpBB/phpbb/auth/provider/oauth/service/interface.php rename to phpBB/phpbb/auth/provider/oauth/service/service_interface.php index 3bba7c0e2c..ab69fe6ef3 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/interface.php +++ b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -interface phpbb_auth_provider_oauth_service_interface +interface service_interface { /** * Returns an array of the scopes necessary for auth @@ -52,7 +54,7 @@ interface phpbb_auth_provider_oauth_service_interface /** * Returns the results of the authentication in json format * - * @throws phpbb_auth_provider_oauth_service_exception + * @throws \phpbb\auth\provider\oauth\service\exception * @return string The unique identifier returned by the service provider * that is used to authenticate the user with phpBB. */ @@ -62,7 +64,7 @@ interface phpbb_auth_provider_oauth_service_interface * Returns the results of the authentication in json format * Use this function when the user already has an access token * - * @throws phpbb_auth_provider_oauth_service_exception + * @throws \phpbb\auth\provider\oauth\service\exception * @return string The unique identifier returned by the service provider * that is used to authenticate the user with phpBB. */