diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-14 15:16:34 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-14 15:16:34 -0400 |
commit | 947aa2b6b442b5e1ce06c755c3e8ebea677f63e3 (patch) | |
tree | 59cc5f20e3da47487803010ddbabc87e39fdfe04 /phpBB/phpbb | |
parent | 00d0e102008767f712145f55348a662f3e6750d6 (diff) | |
download | forums-947aa2b6b442b5e1ce06c755c3e8ebea677f63e3.tar forums-947aa2b6b442b5e1ce06c755c3e8ebea677f63e3.tar.gz forums-947aa2b6b442b5e1ce06c755c3e8ebea677f63e3.tar.bz2 forums-947aa2b6b442b5e1ce06c755c3e8ebea677f63e3.tar.xz forums-947aa2b6b442b5e1ce06c755c3e8ebea677f63e3.zip |
[feature/oauth] Create OAuth service classes
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb')
16 files changed, 442 insertions, 31 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index b6af9758e7..75e8a54ed4 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -221,37 +221,6 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base } /** - * Returns the scopes of the service required for authentication - * - * @param string $service_name - * @return array An array of the scopes required from the service - */ - protected function get_scopes($service_name) - { - $scopes = array(); - - switch ($service_name) - { - case 'GitHub': - $scopes[] = 'user'; - break; - case 'google': - $scopes[] = 'userinfo_email'; - $scopes[] = 'userinfo_profile'; - break; - case 'instagram': - case 'microsoft': - $scopes[] = 'basic'; - break; - case 'linkedin': - $scopes[] = 'r_basicprofile'; - break; - } - - return $scopes; - } - - /** * Returns the path desired of the service * * @param string $service_name diff --git a/phpBB/phpbb/auth/provider/oauth/service/base.php b/phpBB/phpbb/auth/provider/oauth/service/base.php new file mode 100644 index 0000000000..98a1fa16e4 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/base.php @@ -0,0 +1,32 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Bitly OAuth service +* +* @package auth +*/ +abstract class phpbb_auth_provider_oauth_service_base implements phpbb_auth_provider_oauth_service_interface +{ + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array(); + } +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php new file mode 100644 index 0000000000..23769b36a5 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Bitly OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/box.php b/phpBB/phpbb/auth/provider/oauth/service/box.php new file mode 100644 index 0000000000..cfa788da4d --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/box.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Box OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_box extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/facebook.php b/phpBB/phpbb/auth/provider/oauth/service/facebook.php new file mode 100644 index 0000000000..723c8f09f2 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/facebook.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Facebook OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/fitbit.php b/phpBB/phpbb/auth/provider/oauth/service/fitbit.php new file mode 100644 index 0000000000..a0f63a40e7 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/fitbit.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* FitBit OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_box extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/foursqare.php b/phpBB/phpbb/auth/provider/oauth/service/foursqare.php new file mode 100644 index 0000000000..9eb868b1c4 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/foursqare.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* FourSquare OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_foursquare extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/github.php b/phpBB/phpbb/auth/provider/oauth/service/github.php new file mode 100644 index 0000000000..1eddb26906 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/github.php @@ -0,0 +1,34 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* GitHub OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_github extends phpbb_auth_provider_oauth_service_base +{ + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array( + 'user', + ); + } +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php new file mode 100644 index 0000000000..d72c66ac5e --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/google.php @@ -0,0 +1,35 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Google OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth_service_base +{ + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array( + 'userinfo_email', + 'userinfo_profile', + ); + } +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/instagram.php b/phpBB/phpbb/auth/provider/oauth/service/instagram.php new file mode 100644 index 0000000000..c40acf9507 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/instagram.php @@ -0,0 +1,34 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* instragram OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_instagram extends phpbb_auth_provider_oauth_service_base +{ + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array( + 'basic', + ); + } +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/interface.php b/phpBB/phpbb/auth/provider/oauth/service/interface.php new file mode 100644 index 0000000000..c79413ee3a --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/interface.php @@ -0,0 +1,31 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* OAuth service interface +* +* @package auth +*/ +interface phpbb_auth_provider_oauth_service_interface +{ + /** + * Returns an array of the scopes necessary for auth + * + * @return array An array of the required scopes + */ + public function get_auth_scope(); +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/linkedin.php b/phpBB/phpbb/auth/provider/oauth/service/linkedin.php new file mode 100644 index 0000000000..118379b4ab --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/linkedin.php @@ -0,0 +1,34 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* LinkedIn OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_linkedin extends phpbb_auth_provider_oauth_service_base +{ + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array( + 'r_basicprofile', + ); + } +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/microsoft.php b/phpBB/phpbb/auth/provider/oauth/service/microsoft.php new file mode 100644 index 0000000000..0ad2a5173b --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/microsoft.php @@ -0,0 +1,34 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Microsoft OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_microsoft extends phpbb_auth_provider_oauth_service_base +{ + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array( + 'basic', + ); + } +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/soundcloud.php b/phpBB/phpbb/auth/provider/oauth/service/soundcloud.php new file mode 100644 index 0000000000..0b5de5af20 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/soundcloud.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* SoundCloud OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_soundcloud extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/tumblr.php b/phpBB/phpbb/auth/provider/oauth/service/tumblr.php new file mode 100644 index 0000000000..be4871322c --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/tumblr.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Tumblr OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_tumblr extends phpbb_auth_provider_oauth_service_base +{ + +} diff --git a/phpBB/phpbb/auth/provider/oauth/service/twitter.php b/phpBB/phpbb/auth/provider/oauth/service/twitter.php new file mode 100644 index 0000000000..e58b02fa41 --- /dev/null +++ b/phpBB/phpbb/auth/provider/oauth/service/twitter.php @@ -0,0 +1,26 @@ +<?php +/** +* +* @package auth +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Twitter OAuth service +* +* @package auth +*/ +class phpbb_auth_provider_oauth_service_twitter extends phpbb_auth_provider_oauth_service_base +{ + +} |