mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/oauth] Create OAuth service classes
PHPBB3-11673
This commit is contained in:
parent
00d0e10200
commit
947aa2b6b4
16 changed files with 442 additions and 31 deletions
|
@ -220,37 +220,6 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
|||
return $this->service[$service_name];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
32
phpBB/phpbb/auth/provider/oauth/service/base.php
Normal file
32
phpBB/phpbb/auth/provider/oauth/service/base.php
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/bitly.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/bitly.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/box.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/box.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/facebook.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/facebook.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/fitbit.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/fitbit.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/foursqare.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/foursqare.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
34
phpBB/phpbb/auth/provider/oauth/service/github.php
Normal file
34
phpBB/phpbb/auth/provider/oauth/service/github.php
Normal file
|
@ -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',
|
||||
);
|
||||
}
|
||||
}
|
35
phpBB/phpbb/auth/provider/oauth/service/google.php
Normal file
35
phpBB/phpbb/auth/provider/oauth/service/google.php
Normal file
|
@ -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',
|
||||
);
|
||||
}
|
||||
}
|
34
phpBB/phpbb/auth/provider/oauth/service/instagram.php
Normal file
34
phpBB/phpbb/auth/provider/oauth/service/instagram.php
Normal file
|
@ -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',
|
||||
);
|
||||
}
|
||||
}
|
31
phpBB/phpbb/auth/provider/oauth/service/interface.php
Normal file
31
phpBB/phpbb/auth/provider/oauth/service/interface.php
Normal file
|
@ -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();
|
||||
}
|
34
phpBB/phpbb/auth/provider/oauth/service/linkedin.php
Normal file
34
phpBB/phpbb/auth/provider/oauth/service/linkedin.php
Normal file
|
@ -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',
|
||||
);
|
||||
}
|
||||
}
|
34
phpBB/phpbb/auth/provider/oauth/service/microsoft.php
Normal file
34
phpBB/phpbb/auth/provider/oauth/service/microsoft.php
Normal file
|
@ -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',
|
||||
);
|
||||
}
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/soundcloud.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/soundcloud.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/tumblr.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/tumblr.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
26
phpBB/phpbb/auth/provider/oauth/service/twitter.php
Normal file
26
phpBB/phpbb/auth/provider/oauth/service/twitter.php
Normal file
|
@ -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
|
||||
{
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue