mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/oauth] Bitly authentication method, no user_id association
PHPBB3-11673
This commit is contained in:
parent
e9bf2bf09a
commit
469879716d
2 changed files with 31 additions and 1 deletions
|
@ -62,6 +62,7 @@ services:
|
|||
class: phpbb_auth_provider_oauth_service_bitly
|
||||
arguments:
|
||||
- @config
|
||||
- @request
|
||||
tags:
|
||||
- { name: auth.provider.oauth.service }
|
||||
auth.provider.oauth.service.box:
|
||||
|
|
|
@ -29,14 +29,23 @@ 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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue