diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-18 11:51:10 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-18 11:51:59 -0400 |
commit | 469879716d86757c2e583bc746bebaa39cd630ef (patch) | |
tree | 04985b47e2d66dee7de18d458a2daa0a6a67440b /phpBB/phpbb/auth | |
parent | e9bf2bf09a2b1fcee0d206b691a739600fee49e0 (diff) | |
download | forums-469879716d86757c2e583bc746bebaa39cd630ef.tar forums-469879716d86757c2e583bc746bebaa39cd630ef.tar.gz forums-469879716d86757c2e583bc746bebaa39cd630ef.tar.bz2 forums-469879716d86757c2e583bc746bebaa39cd630ef.tar.xz forums-469879716d86757c2e583bc746bebaa39cd630ef.zip |
[feature/oauth] Bitly authentication method, no user_id association
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth')
-rw-r--r-- | phpBB/phpbb/auth/provider/oauth/service/bitly.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php index 6b6e08c19a..cbfad3d852 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/bitly.php +++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php @@ -30,13 +30,22 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ protected $config; /** + * phpBB request + * + * @var phpbb_request + */ + protected $request; + + /** * Constructor * * @param phpbb_config $config + * @param phpbb_request $request */ - public function __construct(phpbb_config $config) + public function __construct(phpbb_config $config, phpbb_request $request) { $this->config = $config; + $this->request = $request; } /** @@ -49,4 +58,24 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ 'secret' => $this->config['auth_oauth_bitly_secret'], ); } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) + { + // TODO: make exception class and use language constant + throw new Exception('Invalid service provider type'); + } + + // This was a callback request from bitly, get the token + $this->service_provider->requestAccessToken( $this->request->variable('code', '') ); + + // Send a request with it + $result = json_decode( $this->service_provider->request('user/info'), true ); + + // Get the user id + } } |