-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #404 from antalaron/enhancement-disqus
Add Disqus provider
- Loading branch information
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* OAuth2 Client Bundle | ||
* Copyright (c) KnpUniversity <http://knpuniversity.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KnpU\OAuth2ClientBundle\Client\Provider; | ||
|
||
use Antalaron\DisqusOAuth2\DisqusResourceOwner; | ||
use KnpU\OAuth2ClientBundle\Client\OAuth2Client; | ||
use League\OAuth2\Client\Token\AccessToken; | ||
|
||
class DisqusClient extends OAuth2Client | ||
{ | ||
/** | ||
* @return DisqusResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface | ||
*/ | ||
public function fetchUserFromToken(AccessToken $accessToken) | ||
{ | ||
return parent::fetchUserFromToken($accessToken); | ||
} | ||
|
||
/** | ||
* @return DisqusResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface | ||
*/ | ||
public function fetchUser() | ||
{ | ||
return parent::fetchUser(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/DependencyInjection/Providers/DisqusProviderConfigurator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
/* | ||
* OAuth2 Client Bundle | ||
* Copyright (c) KnpUniversity <http://knpuniversity.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers; | ||
|
||
use Antalaron\DisqusOAuth2\Disqus; | ||
use KnpU\OAuth2ClientBundle\Client\Provider\DisqusClient; | ||
use Symfony\Component\Config\Definition\Builder\NodeBuilder; | ||
|
||
class DisqusProviderConfigurator implements ProviderConfiguratorInterface | ||
{ | ||
public function buildConfiguration(NodeBuilder $node) | ||
{ | ||
// no custom options | ||
} | ||
|
||
public function getProviderClass(array $config) | ||
{ | ||
return Disqus::class; | ||
} | ||
|
||
public function getProviderOptions(array $config) | ||
{ | ||
return [ | ||
'clientId' => $config['client_id'], | ||
'clientSecret' => $config['client_secret'], | ||
]; | ||
} | ||
|
||
public function getPackagistName() | ||
{ | ||
return 'antalaron/oauth2-disqus'; | ||
} | ||
|
||
public function getLibraryHomepage() | ||
{ | ||
return 'https://github.com/antalaron/oauth2-disqus'; | ||
} | ||
|
||
public function getProviderDisplayName() | ||
{ | ||
return 'Disqus'; | ||
} | ||
|
||
public function getClientClass(array $config) | ||
{ | ||
return DisqusClient::class; | ||
} | ||
} |